8
$\begingroup$

Is it possible to use the rendered output of one renderlayer in the materials on another render layer?

How can I achieve this?

$\endgroup$

1 Answer 1

11
$\begingroup$

Yes, this is possible.

You can achieve this with an Image Sequence Texture node:

  1. Set up two render layers with each layer excluding the other:

    enter image description here

  2. Set up compositing nodes so the render layer that is being used to influence the materials renders out to a separate directory.
    This is possible with the File Path node:

    enter image description here

  3. Render only the influencing layer once to that directory by Pinning enter image description here that render layer.
    The file will be named something like Image0001.png. Rename it to Image0000.png

  4. Set up the material you want to be influenced.
    You can pull in the result of the other render layer by adding an Image Texture node, setting the image to Image0000.png, setting the Source to Image Sequence, and setting the Offset to -1

    enter image description here

    This is the result of the other render layer.

  5. Render the animation. (CtrlF12, or Info > Render > Render Animation

Here is a simple test with two spheres (one on each layer) and a moving light source:

enter image description here

Keep in mind that with this technique, the two layers are one frame apart. This could be fixed by rendering the influencing layer completely beforehand, and adjusting the offset accordingly.

$\endgroup$
3
  • 1
    $\begingroup$ You should probably use exr for temporary storage. Also, is it possible to let it overwrite temporary images, if you only need a temporary swap image. $\endgroup$
    – user877329
    Commented Mar 13, 2022 at 9:19
  • $\begingroup$ @user877329 As far as I know there isn't a way to override the frame number being appended to the filename, but you could use a post render hook and a little bit of python $\endgroup$
    – gandalf3
    Commented Mar 14, 2022 at 3:00
  • 1
    $\begingroup$ In deed, it would be nice to have a "Feedback texture" (usable from both shaders and compositor). Then you could easily use the output from cycles to affect growth of plants. $\endgroup$
    – user877329
    Commented Mar 14, 2022 at 20:30

You must log in to answer this question.

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