Glass shows BG even when other objects are behind the glass

I don’t know if it’s a bug or something that I do wrong but I have a scene where the glass shows the BG color even when objects are behind the glass blocking any background.

To see what I mean, please check the 2 screenshots below. The one where you see the chrome headlight reflector is where I’ve hidden the glass. The other one is with the glass visible. As you can see, when the glass is visible you can’t see the chrome behind, just the bg color (which is white in this case).

Here is also a screenshot of the render setup:



Isn’t that reflection on the glass?

1) Does the headlight glass have thickness? Can you show the materials settings for the glass?
2) Why do you override the refraction environment to white? What happens when you untick that?

1) Yes, they do have thickness. Here’s the material of the glass:

2) I override the refraction environment so that I can see white color behind the windows of the car to make it look like it’s rendered in a studio. Otherwise, refractive parts show the HDRI image which is not what I want. When I disable the override, the headlights render as they should but then I don’t get the effect that I want for the windows.

Hello, Alex_M

It appears this is the expected behavior. The reflector behind the glass of the headlight will “see” through the glass only what the glass perceives.
So, I suggest the following workaround:
Create a Dome VRayLight and use for it the same map that is in your reflection environment. Set the light to be Invisible and set its Exclude list mode to Include and then add the glass geometry from the headlights to it. This way the dome will bee refracted only through that glass geometry which should work alright in this particular case. How about this?

Regards,
Margarita

Hm, one more thing… in fact, perhaps with this invisible light you could even just disable your reflection/refraction environment, clear the exclude list from the dome light (and set it back to exclude mode), and so get what you want in a simple way.

Thanks for the reply and workaround, Margarita. However, I don’t understand why this is an expected behavior as you put it. In the real world, the chrome reflector, which is a solid nontransparent object, will be blocking whatever is behind it. So no BG color should be visible anywhere in the headlight area. I’m really perplexed as to why this happens.

I think it’s because the glass refractions are calculated before the reflections of it on other geometry.

Thanks for the reply but I’m still confused. What do reflections and refractions have to do with the fact that solid objects allow the background through them? I expect solid objects to block whatever is behind them, correct? That’s how the real world works. If I put my hand before my eyes I don’t see through it.

I apologize that I skipped the details. The gray you see in your headlights is not the background behind the car but the reflection of the refracted environment through the glass, isn’t it?

Best regards,
Margarita

Do you mean the reflection of the environment? If that’s what you mean, then no, the grey color is not coming from the reflection of the environment. I’m 100% sure it comes from the background. I’ve made a new example that I hope is more clear (please see below). I’ve made the background green so that it’s more visible and I’ve added a chrome ball on the bonnet and a stripe of glass in front of it. As you can see, there’s something strange happening with the glass. It shows the background where the chrome ball reflects only background. Where the ball reflects the car, no BG color is visible. Shouldn’t the glass show the whole chrome ball behind it? I expect that the whole ball is visible behind the glass.

I forgot to mention that no object properties were changed on any objects (visible in reflections, visible in refraction etc..).

If you use the same color for background and refraction environment its a little confusing at first sight. Let’s change one of the two colors and see what happens. See the attached images below.

So, what happens is the glass is reflected green in the ball. Also, the environment that is reflected in the ball but seen trough the glass is overridden by the refraction environment which is a little unexpected, but it is by design. There is another setting that can control the reflection of the environment through refraction in this case. See the next image below.

What I’ve done is simply place the reflection environment map in the Environment slot of the material for the ball.
And for the green color to disappear from the reflection of the box (the glass geometry), I assign a VRayOverrideMtl to the geometry that uses the glass material. I keep the glass material as base and use a copy of it as Reflection material (it controls its appearance in reflections) with that same map that we have for environment reflection in its Environment slot.

This would be the setup with overrides. I’d use the dome light instead.

Cheers!





Thanks a lot for the detailed example and explanation. I changed to using Dome light instead of the environment slots as you suggested. Now everything works as I expect. :slight_smile: