Which Cycles Closure to use?

  • Hi,

    I'm still not straight in my mind when to use an Add Closure and when to use a Mix Closure.

    For instance in @bagginsbill's SF Nylon Shader we have an Anisotropic node that gives a nice nylon specular, however some hose also has glitter in addition to the anisotropic, which I'm guessing would be a glossy BSDF controlled by a spots node. So should I combine these with a mix closure at 0.5 or an add closure?


  • Poser Ambassadors

    Choose Add when the combination of two components is an artifact of shader construction, and not physics. Choose Mix when the combination is an artifact of physics.


    I split the incoming light into three parts, filtering such that part 1 only deals with the red component, part 2 only deals with the green component, and part 3 only deals with the blue component. An example is when we simulate dispersion.
    This effect is not built into Cycles, so I run three different refract nodes, each with a different index of refraction. In this case I artificially separated the light into three different shader paths. When I re-combine the paths, should the amount of refracted red, green, or blue light be reduced in any way? No - they are mutually exclusive sub-components of the original physics. Only my simulation has divided them into sub-problems, and the correct recombination of those sub-results is to Add, so AddClosure applies.


    When a quantum of light reaches a surface, it has a chance to bounce off without entering (Glossy), or to enter the surface and thereafter possibly get absorbed or scattered back out (Scatter) or pass through largely unaffected but with a direction change (Refract). Our Bsdf nodes simulate these different interactions. If we count up all the quanta that bounce and the quanta that scatter and the quanta that refract, the sum of these cannot exceed all the quanta that arrived. Therefore, the three effects, bounce, scatter, and refract, cannot be added together freely. If each shader component of these effects is built at full strength (calculated as if it was the only effect), then to combine these, we would use MixClosure.

    On the other hand, if we are not calculating them at full strength, but have already proportioned the arriving light intensity according to the appropriate distribution, then we would use AddClosure because in such case we have already separated the calculations into mutually exclusive and unrelated transactions.


    In the case you describe, we're judging that at various points on this surface, there are distributed some sparkly molecules, and that these are like tiny mirrors laying on top of the cloth fibers. When light arrives it has a certain probability of hitting the mirror and bouncing, or hitting the cloth and doing the original nylon thing, but NEVER both. So unless you pre-separate the incoming light into the proportions going to the cloth and the proportion going to the Glossy, the correct answer is to combine the nylon shader with the glossy shader using MixClosure. And the factor is not automatically .5 - the correct factor should be calculated based on the physics. The dominant decider of the factor is generally the Fresnel effect but in this case it isn't.

    Now - since the tiny mirrors are not uniformly distributed, I would use the Spots or similar node to select what factor to use in the mix. There is some trickery here - the question is how big is a mirror as a fraction of a pixel? If the spots says there is no mirror "here", obviously the mix factor should be 0. But if the spots says there is a mirror "here" then if the mirror occupies about 1/4 of the pixel then the maximum mix factor of the glossy vs. the original nylon would be 1/4. But then could there not be two mirrors falling within one pixel? If you decide that is possible (say by using a second spots node set to a different offset) then you would add the two spots together (1/4 + 1/4) to get the factor.

  • @bagginsbill Thank you, that makes perfect sense now.

    Off I go to create some nice glittery hose :)


Log in to reply

Looks like your connection to Graphics Forum was lost, please wait while we try to reconnect.