miLabel to control mib_amb_occlusion
There’re two ugly but useful attributes in mib_amb_occlusion – id_inclexcl and id_nonself. Along with custom miLabel attribute they can define which objects can occlude, which ones can’t and whether objects self-occlude or not. Key thing to understand here – it is question of just an ability to occlude, not of ability to receive occlusion.
It works this way – add integer attribute miLabel to transforms nodes of objects, assign specific values (that’s actually objects grouping by id):
and use these values for mib_amb_occlusion:
The only thing left is to understand how to operate these values 🙂
id_inclexcl with default value of 0 tells shader that all objects it’s assigned to can occlude each other. Positive values tell shader that only objects with corresponding miLabel value can occlude, and negative values – that all objects can occlude, except those with corresponding miLabel.
id_nonself with negative or default 0 values tells shader that all objects can occlude themselves, with positive ones – that objects with corresponding miLabel can’t occlude themselves (and each other). Of course, if according to id_inclexcl attribute an object doesn’t occlude, it won’t self-occlude also no matter what id_nonself is set to (actually, there’s a difference – if self-occlusion is disabled, regions of the object that are occluded by other regions of the same object, get filled with bright color… but if self-occlusion is enabled they continue to receive occlusion from other objects of the scene… so, in a way there’re some relations to receiving occlusion after all 🙂 )
Image above shows flowers with miLabel values 1, 2, 3 accordingly, plane beneath them – 4. mib_amb_occlusion (assigned to all these objects through surfaceShader) has following values:
id_inclexcl = -3 (objects with miLabel equal to 3 don’t occlude a thing)
id_nonself = 2 (objects with miLabel equal to 2 don’t self-occlude)
As a result:
- left flower occludes ground and itself, since it’s miLabel is 1;
- middle flower with miLabel set to 2 occludes ground, but doesn’t occlude itself;
- right one with miLabel = 3 occludes neither ground nor itself;
- ground with miLabel = 4 affects all flowers (notice the difference of it’s effect on middle and right flowers – with self-occlusion left enabled there’s a shadow leakage through petals).
Another example:
- left and right flowers and ground occlude neither themselves nor each other (hence they are almost invisible in this image);
- middle flower occludes everything, but it doesn’t self-occlude due to id_nonself setup.
If we join all flowers together under the same miLabel, we’ll get this:
Flowers occlude ground, but ground doesn’t affect them. Upper part – with self-occlusion, lower – without.
And yet another version – just ground affects flowers:
With self-occlusion left enabled (upper) ground incorrectly occludes flowers through petals.
In practice these abilities to control occlusion are useful for creating specific passes (for separate tuning in compositing), for disabling self-occlusion of live objects’ stand-ins, from which you need to get occlusion on the objects of the scene… and for baking. For example, having a scene like that:
we want to get only occlusion from spider on the face – without self-occlusion on eye sockets. Add miLabel for the head with a value, type this value into id_nonself and turn off primary visibility for the spider:
In: Render · Tagged with: id_inclexcl, id_nonself, maya, mentalray, mib_amb_occlusion, miLabel, occlusion, shading, shadow
on 17 April 2011 at 7:27
Permalink
hi, nice tips here, buti still confuse about this miLabel things.. can you attach file for the flowers?
regard
on 17 April 2011 at 12:59
Permalink
Here it is:
http://www.sigillarium.com/blog/wp-content/uploads/2009/06/06_occl_01.rar