miLabel to control mib_amb_occlusion

There’re two ugly but useful attributes in mib_amb_occlusionid_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.

Disabling self-occlusion with miLabel attribute

Disabling self-occlusion with miLabel attribute

It works this way – add integer attribute miLabel to transforms nodes of objects, assign specific values (that’s actually objects grouping by id):

Adding miLabel attribute

Adding miLabel attribute

and use these values for mib_amb_occlusion:

id_inclexcl and id_nonself attributes of mib_amb_occlusion

id_inclexcl and id_nonself attributes of 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 🙂 )

Different occlusion relationships

Different occlusion relationships

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:

Another example:

Different occlusion relationships

Different occlusion relationships

If we join all flowers together under the same miLabel, we’ll get this:

Flowers affect ground only and vice versa

Flowers affect ground with and without self-occlusion

Flowers occlude ground, but ground doesn’t affect them. Upper part – with self-occlusion, lower – without.

And yet another version – just ground affects flowers:

Ground affects flowers with and without self-occlusion

Ground affects flowers with and without self-occlusion

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:

Default occlusion behavior

Default occlusion behavior

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:

No self-occlusion for the head and spider is hidden

No self-occlusion for the head and spider is hidden

Posted on June 6, 2009 at 23:24 by · Permalink
In: Render · Tagged with: , , , , , , , ,

2 Responses

Subscribe to comments via RSS

  1. Written by asin
    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

Subscribe to comments via RSS

Leave a Reply