Shadows and Holdouts


#1

Hi… having a little trouble with krakatoa particles and scene geo in Maya, want to confirm the workflow for shadows and holdout objects.

Building a shockwave like effect with an object entering from above, descending, and making contact with a ground plane. Dust particles are stirred up and blow out in a circle away from the object. Using a PRT loader with 100 passes to get the density desired and the dust particles look great. Now comes the next step: contact shadows particle to ground, and a holdout of the descending object.

shadows:
From looking at the boards/google a potential way to get a shadow pass in Maya is to make a proxy for the ground out of a VOL object. Would I override the particle color of the dust and ground particles to white? How do you just get the ground (VOL) to receive shadows and not get the dust self shadowing, or is that not possible and the best one can get is a shadow pass of both ground and dust?

holdout:
I added holdout geometry for the ground object and it worked fine when rendering the dust, however when I added the geo of the descending object group as holdout matte objects it appears to make no difference, the particles that are behind the holdout still are visible. Are there any requirements or special preparations that need to be done to holdout geo to get it to work? The ground geo is a single triangulated mesh (since it was also exported to realflow) but the entering geo is quads and multiple meshes grouped together. I selected the meshes that form the overall volume to be occluded and added them both as a group, and then as individual meshes, but neither has them actually occluding the dust particles.

Any advice for properly casting shadows and creating occlusion geometry would be greatly appreciated.


#2

Got occlusion working better. Took the meshes and combined them into one mesh, adding that as an occluding matte object worked. Is there a limit to the number of matte objects?

The VOL object (replacing the ground mesh) catches shadows, though self shadowing was a slight problem. Only one thing remaining… is it possible to have one set of particles (the dust) cast shadows without self-shadowing? Ideally I would like only the shadows on the ground object in this pass.

edit: added an emission value of 1,1,1 to the dust, no self shadowing! This seems to work. Only question: does emission generate light. ie. cast light on surrounding particles or is it contained to only the particle object that is emitting?


#3

No, Emission is just an added color to the particle (similar to old-school “Ambient Light” term in 90s shaders), and does not (currently) illuminate surrounding particles. However, it is on the Wishlist as it would be quite cool to do so :slight_smile:


#4

I could see how making particles radiate light would be cool. However in this case having emission not cast light makes it possible to “mask out” those particles when making a shadow pass.

Any word on limitations on matte objects… is that there can be only one?


#5

No, in theory any object marked as Matte via an extra attribute should be respected. However, this is Maya, which I not my strongest area, so it is quite possible we are not supporting every possible case of scene geometry. As far as I know, all you would need to do is select all scene mesh geometry objects that you want to use as holdouts, and press the button to set the Matte attribute. But it is possible that we don’t loop through them correctly.

The function, found in the script for the respective Maya version under “C:\Program Files\Thinkbox\Krakatoa Maya\Maya20XX_x64\scripts\KrakatoaRenderer.mel”, looks like this:

[code]//TAGS THE SELECTED OBJECTS AS MATTE.
global proc KMY_tagSelectedAsMatte ()
{
print “Tagging Selected Objects As Krakatoa Matte Objects (Holdouts)\n”;
string $sel[] = ls -sl;
string $anObject;
for ($anObject in $sel)
{

	string $childShapeNodes[] = `listRelatives -fullPath -allDescendents $anObject`;
	
	string $shapeObject;
	for ( $shapeObject in $childShapeNodes )
	{
		// TODO: support other types of objects such as NURBS
		if ( `nodeType $shapeObject` == "mesh" )
		{
			//Determine if this is the "Original" shape of a deformed node. If it is, it will have the "intermediateObject" attribute set, and we don't want to tag it.
			if (!`getAttr ($shapeObject + ".intermediateObject")`) {
		
				string $attrs[] = eval ("attributeInfo -all " + $shapeObject);
				int $found = stringArrayContains("KrakatoaMatte", $attrs);
				if ($found == 0)
					addAttr -longName "KrakatoaMatte" -shortName "KMatte" -at bool $shapeObject;
				eval ("setAttr " + $shapeObject+".KrakatoaMatte on;");
			}
		}
	}
}

}[/code]

Assuming your MEL knowledge is better than mine, please take a look at this script and modify it as necessary. If you can figure out what we are doing wrong, please let us know and we will fix it in future versions.

Thanks in advance!


#6

Thanks! That looks okay. The only thing that might be going wrong is how my meshes are grouped, it may be that they are parented under a shape node not a transform which might confuse listRelatives. I can do some tests on that specifically later. Right now it is good to know there is no limit and I will just make sure what ever mesh I am using for a matte object is in a clean normal hierarchy.


#7

It seems to be working fine now… maybe I had the wrong selection before.

Running into another problem involving a timewarp, but that is for another thread.