7
$\begingroup$

I would just like to understand why in the cycles fake absorption setup he ray length have to be multiplied against the backfacing value in order to tell Cycles when the ray starts and stops. I did the BlenderDiplom tutorial and there was no explanation as to why that does what it does. I can use the fake absorption setup with no problem, I would just like to understand exactly how it works so I can use it knowing exactly what it is doing.

enter image description here

$\endgroup$
3
  • $\begingroup$ What context is this node used in? What would you plug the color output into? $\endgroup$
    – PGmath
    Commented Aug 25, 2015 at 21:47
  • $\begingroup$ @PGmath I think it can only really be used with a glass, translucent, or transparent shader. As for context, I'm sorry I have none. I have been using this with a translucent shader, but I would like an explanation for all three shaders if they are different. According to gandalf3, "it only allows you to control the shading of backfaces", so I think it is doing the same in all three shaders but I really have no idea. $\endgroup$
    – Wyvernul
    Commented Aug 25, 2015 at 21:56
  • $\begingroup$ Ahh, that's what I guessed, I'm working on writing an explanation for you now. $\endgroup$
    – PGmath
    Commented Aug 25, 2015 at 21:58

1 Answer 1

7
$\begingroup$

The way the node setup you are referencing works is by coloring the inside wall of a material based on how far the ray has traveled within the material.

enter image description here

The backfacing output gives 1 if the ray is hitting the side opposite the normal (the "front" of the face), and 0 if the ray is hitting the side with the normal (the "front" of the face). So the output of the first multiply node (from the left) will be ray_length * 1 = ray_length if the ray is hitting the backside of a face (meaning it is inside the object) and ray_length * 0 = 0 when the ray is hitting the front of a face (meaning it is outside of the object).

The rest of the nodes just convert the linear falloff to exponential and use that result to mix the base color with the absorption color.

$\endgroup$
3
  • $\begingroup$ Okay, just for clarification: When the rays hit the front faces and return ray_length * 0 = 0, is the ray length value acting as if it resets to 0 and continues traveling, and then travels until it hits the back face and returns ray_length * 1 = ray_length? $\endgroup$
    – Wyvernul
    Commented Aug 25, 2015 at 23:03
  • $\begingroup$ @Wyvernul ray_length is the distance since the last surface/volume calculation (i.e. it resets to 0 every time it interacts with a shader). $\endgroup$
    – PGmath
    Commented Aug 26, 2015 at 0:56
  • 3
    $\begingroup$ One thing to note is that for x^0 so you will get 1 as a result so for the case of a ray hitting the front of face you will get the base colour and for a ray hitting the back of a face the mix of base and absorption colour. Without that, you would get the length of the ray before it entered the surface for absorption when it hits the front face. $\endgroup$ Commented Aug 26, 2015 at 7:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .