Changing the color of an Objects material in indirect reflection


First of all, if this topic was already being discussed, sorry for that.

I am wondering if following scenario is possible somehow:

I have one object, of which i want to change the diffuse color after rendering. This very object is visible in reflection of surrounding objects as well.

While the first problem can be solved very easily via passes, I’m having really a hard time identifying and changing the color of the object visible in the reflections of the surrounding.

I was wondering if there might be something like a material cryptomatte but only identifying pixels of materials already being reflected.

Is there any possibility doing of achieving that?

This is kind of what I read. You want to have something with one color be reflected as another color.

reflection-ray.blend (818.6 KB)

Thank you, that would be useful when rendering. But I would need it after rendering, changeable inside the Compositor.

The Scenario is following: I got a product rendering (Multilayer EXR) with the product being available in hundreds of different colors. While it’s easy to change the color of one material afterwards, it get’s way more difficult to change the reflection of this material in glossy or metallic parts…

If you could somehow identify certain materials inside the glossy indirect pass, that would solve this very problem.

Could something like this work?

  1. create two render layers, where in each one the product is rendered in a different color, say red in one and green in the other
  2. in the compositor, use the difference between the outputs of the render layers to identify the product and its reflections
  3. change the color of the composite with a mask obtained from 2.

(Never tried something like this myself)

I’ll try that, thank you!

It seems to work, despite some artifacts which may be the result of just trying it quick and dirty…


I got it working now. My solution was to create a third Renderlayer with the object in a neutral grey material.

So in total this works this way:
You have 3 Render Layers, on 2 of them are the products rendered in complementary colors.
The 3rd Render Layer will have a Neutral Color. This will also be the actual Renderlayer which will be used for modifying.

With the Difference Matte Key Node a mask can be created of the GlossInd Passes. I used this mask to mix in the desired color into the GlossInd Pass of the third Layer with the neutral color.

Now the rest of the Passes can be added together.

I’d try massive oversampling and maybe some additional blur to get rid of the artifacts.

The artifacts are almost gone now as soon as I started using the third RenderLayer with a neutral color. Some are still left, but maybe i can get rid of those with oversampling. Or I am mixing the color wrong. (Some of the “artifacts” also show up when mixing the diffuse color pass…)

Anyways, thank you @LordoftheFleas for the hint!

1 Like