0
$\begingroup$

I've been trying to develop a Node Group for the Shader Editor that gives me more control over Light Paths on my various light sources and emissive materials.

Now I've hit a roadblock that I just can't figure out, and I'm relatively certain that it's just something about Cycles that I do not understand completely.

This is my Shader Setup: Shader Setup (Node Group)

All it's supposed to do is give me control over how strong each Ray Type should be, and it works (kinda). The problem is that the result is not the same to a pure emissive material and I don't understand why. Even if I give ALL ray types 100% and then use a Mix Shader with a full black, it looks different. It does look as if not all bounces are taken into account:

enter image description here enter image description here

If I use an Emission Node set up as Red the result looks like this:

enter image description here

What am I missing here? Aren't all rays combined supposed to look like a normal Emission Node?

$\endgroup$
7
  • 1
    $\begingroup$ No, they are not supposed to look like a normal Emission node... why should they? Who said that? $\endgroup$ Commented Jan 22 at 14:12
  • 1
    $\begingroup$ The output of your mask group varies between 0 and 8, while the mix shader typically expects a factor between 0 and 1. Where did you get the idea to create this setup ? $\endgroup$
    – Gorgious
    Commented Jan 22 at 14:39
  • 1
    $\begingroup$ I think the thing you want to do must be done in the compositing editor, not in the shader editor. $\endgroup$
    – Gorgious
    Commented Jan 22 at 14:47
  • 1
    $\begingroup$ @Gorgious Correct, and be done with the different passes. dasfrodo: here is the setup how the separate passes have to be combined in the Compositor to give the same output as the composite: Blender Manual: Passes $\endgroup$ Commented Jan 22 at 14:54
  • $\begingroup$ @GordonBrinkmann I am not feeding the Mask into the Emission Node, I am simply masking the Emission Node with the Light Path, as shown in the Screenshots. In my Head this works out like this: all light paths added together are as if there is no light path filtering at all. This is then used with a Mix Shader and a Emission Node. The other Mix Shader Input would in that case be everything that has NOT been masked with the node group. $\endgroup$
    – dasfrodo
    Commented Jan 22 at 15:04

1 Answer 1

1
$\begingroup$

You are confusing here something with the combination of Light Passes in the Compositor (see: Blender Manual: Passes). This setup in the compositor works, because there you have all light and color which the image contains in separate passes and add them together to get the final composite.

But the outputs of the Light Path node are nothing like that. They do not give the amount of light and/or color coming from diffuse and glossy parts etc. in all areas of the image. They are just taking the material itself and its reflections into account. The first outputs with the word "Is" in front are primarily Boolean outputs. They are giving information if a certain ray hits the camera coming from the kind of surface/shading in question. So on the object with the material itself the value is always 0 or 1. And when the "Is Camera Ray" output is 1 because the camera has unobstructed view on the object, the other "Is" outputs are 0 for this object.

So the other ray outputs can only be > 0 on the surrounding elements. They give information on the indirect paths where the light from the material hits the camera. Here is an overview on all ray outputs (as mix factor for a blue emission material) and what they result in when added together, "Shadow", "Singular" and "Transmission" having absolutely no part in the example image:

the different rays

As mentioned earlier, the "Is Camera Ray" only shows where the camera has a direct view on the material itself. "Is Diffuse Ray" is showing where light from the material bounces off of a diffuse surface into the camera, "Is Glossy Ray" is where the emissive material is directly mirrored, "Is Reflection Ray" is the specular diffused reflection on the surface.

Now if you compare the bottom right image where everything is added together with an image where I used the Emission shader directly, not using the combination of light rays, there is a difference, something's missing in the added rays on the left:

rays compared to regular emission

Most striking it is on the corners of the cube. Between the light from the cube's faces bouncing off the floor there is not much light. The reason for this can be found in the Light Passes in the Compositor: the DiffDir output (Diffuse Direct) shows light bouncing off all around the cube. This is where the material of the floor gets lit up by the blue emission and the brightened diffuse surface light directly shines into the camera. But this is not covered by any of the rays above:

diffuse direct

$\endgroup$
2
  • $\begingroup$ Thank you very much for taking the time to explain this so thoroughly. I think I understand where my though process went wrong now. The Node Group isn't as useful as I thought, but I think it'll still come handy in the future. $\endgroup$
    – dasfrodo
    Commented Jan 24 at 14:28
  • 1
    $\begingroup$ @dasfrodo The problem is, it is used in a material on an object - it does not provide all light paths of all objects and all materials - which are what it takes to generate a "proper" image. The node is quite useful for a lot of things which it is made for, but those are simply just other things ;) $\endgroup$ Commented Jan 24 at 14:34

You must log in to answer this question.

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