2
$\begingroup$

I created a Cube, and then a small Plane above it with an Emission shader. In Cycles, the plane casts light onto the Cube.

If I disable the Visibility > Ray Visibility > Diffuse property for the Plane object, making it invisible to diffuse rays, the cast light is gone.

I expect that I will get the same result if I use a Light Path node to make the Plane invisible to diffuse rays, but there is still light.

Why is this? And how should I get the same effect with a Light Path node?

Note that doing this for eg. Ray Visibility > Camera and Is Camera Ray does work as expected.

$\endgroup$

1 Answer 1

1
$\begingroup$

I filed an issue about this on the bug tracker and received an amazing response from Alaska

For reference, this issue only occurs in the Next Event Estimation (NEE) part of the light sampling.

Looking at the code, this appears to be a known limitation, presumably from performance enhancing code.

/* No proper path flag, we're evaluating this for all closures. that's weak but we'd have to do multiple evaluations otherwise. */
surface_shader_eval<KERNEL_FEATURE_NODE_MASK_SURFACE_LIGHT>(kg, state, emission_sd, NULL, PATH_RAY_EMISSION);

Source: af4b09a61c/intern/cycles/kernel/light/sample.h (L67)

So what's happening in Cycles is:

  1. A light gets pick for NEE (This is done early in integrate_surface_direct_light()).

  2. Cycles calculates how much light the light is actually emitting (done in the middle of integrate_surface_direct_light() with the function light_sample_shader_eval())

  3. Inside light_sample_shader_eval() we encounter the code from above, that passes NULL rather than path_flags to surface_shader_eval(). surface_shader_eval() being the function that figures out how the node setup of the light influences it's output.

  4. Since NULL is passed rather than path_flags, many features inside the light path node don't work since they rely on this information.

  5. Then the rest of the rendering code runs as expected.

I'll leave the final decision on how to handle this report up to other people.


In the meantime I have a recommendation for @scurest. You can remove mesh lights from NEE to get the desired results. This does come at the cost of increased noise in various situations, but this might be a trade off you're willing to take. To do this, follow these steps:

  1. Go to the Materials Properties tab in the Properties editor.

  2. Locate and expand the section titled Settings

  3. In the subsection titled Surface, set Emission Sampling to None. The light will no longer be sampled by NEE, but can still be sampled by forward path tracing (which does work with your node setup)

$\endgroup$

You must log in to answer this question.

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