1
$\begingroup$

In the Object Properties tab I can choose the ray visibility of that object. In other words I can choose if that object is visible on camera, if it casts shadows on diffuse shaders, on glossy shaders, and so on.

Is there a way to choose on which objects it will have ray visibility? Maybe a trick using layers? What I want is an environment HDRI that is visible reflected on a glossy object A, but not on another object B.

EDIT: I saw the question was marked as a possible Duplicate, but maybe I need to explain my question in a better way.

I don't need to remove the environment reflections from the glossy objects. Both the object A and B have a glossy component in the node tree but I need:

  • the object A to reflect/refract the environment map with all its material components (glossy, diffuse, glass, etc...);
  • the object B to NOT reflect the environment map with any of its shaders.

I can choose which kind of shaders an object casts (in the Ray Visibility panel) but not on which objects it casts it (and that's what I need).

$\endgroup$
5
  • 1
    $\begingroup$ Possible duplicate of Cycles: How do I exclude the Environment Texture from reflections? $\endgroup$ Commented Oct 21, 2018 at 12:31
  • $\begingroup$ I edited my question to explain the difference. $\endgroup$
    – mugnozzo
    Commented Oct 22, 2018 at 18:03
  • $\begingroup$ Cycles being a physically based rendered is not adequate for these types of intricate relations $\endgroup$ Commented Oct 22, 2018 at 23:57
  • 1
    $\begingroup$ Possibly this could be done in the compositor... but that depends on how it should work with reflections of those objects... for example, if object B (which reflects the environment) is visible in the reflection off of A then should the environment be visible in that reflection of the reflection? If not then I think I have a compositor solution. If the environment should be reflected in that reflection of the reflection then I don’t think this is possible in Cycles (same goes for the opposite - A visible in reflection of B not showing environment). $\endgroup$ Commented Oct 30, 2018 at 9:46
  • $\begingroup$ Ok! Interesting... Actually I don't mind about the reflection in the reflection, so... could you tell me your compositor workaround? I'm looking forward to try it! :-) $\endgroup$
    – mugnozzo
    Commented Nov 2, 2018 at 16:12

1 Answer 1

2
$\begingroup$

One possibly solution to to render the image twice - once with the Envionment and the other without the environment - and then use the compositor to combine the images, using the render without the environment for the chosen object.

To demonstrate, consider the following scene :

scene

The cube is set to emissive (to reflect in the surfaces of the other objects), Suzanne is reflective, as are the two spheres. The left-hand sphere will be the one that doesn't reflect the environment; to indicate this, its object Pass Index has been set to '1' - the other sphere (and all other objects) have been left with Pass Index set to '0'. The environment has been set to an HDR image.

In order to render the scene twice, we can add an additional render layer :

render layers

One render layer should have Use Environment enabled and the other should have Use Environment disabled. Ensure to enable the Object Index pass - this will give us access to the object Pass Index in the compositor.

Setup the Compositor nodes as follows :

compositor

The IndexOB is used to generate a mask to pick out the object set to Pass Index of 1 (the left-hand sphere). The two rendered (one with and one without the environment) are mixed together based on this mask so that the 'without environment' image shows where one sphere is and the 'with environment' shows for the rest of the render. The Dilate/Erode node allow you to control the blending at the edges of the transition to remove any harse artifacts.

This produces the following result with the left-hand sphere showing all reflections except the environment :

result

$\endgroup$
1
  • 1
    $\begingroup$ Right! That's exactly what I needed! Thank yout very much! :-) $\endgroup$
    – mugnozzo
    Commented Nov 6, 2018 at 8:16

You must log in to answer this question.

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