# HDRI image not visible when viewed directly, but visible through glass

new to Blender and I'm trying to replace the HDRI image, but keep the lighting. After trying the compositing method, I decided to go with a big sphere around the model.

I am able to view get the sphere to be visible when viewed directly

but when looking through the glass the HDRI image is still visible and not the sphere.

The windows are Archipack rail windows with portals enabled and a basic glass shader.

I suspect it might be my glass shader, since when I remove the diffuse ray, the blue sphere shows up through the window, but the HDRI remains in the reflections. I played around with the different rays, and by replacing the diffuse with a camera ray, I could get the sphere to show in window, but it got rid of the reflections which I'd like to keep.

I'd appreciate some help with either troubleshooting the issue or if I'm going about doing the sky replacement the wrong way.

Update: So after a lot of faffing about, I wanted to clarify the question a bit more. I was able to get both the reflections and the outside to render simultaneously by using a glossy BSDF and transparent BSDF into an add shader, however the HDRI image still overlays it.

I think what I want is how to remove the HDRI image from the glossy or glass BSDF? Or any way to only render the reflections on glass, but not the HDRI image itself?

• Can you show a screenshot of your HDRI nodes?
– Emir
Jul 23 at 18:21
• Does this answer your question? Use a HDRI just for lighting and change the background color
– Emir
Jul 23 at 18:27
• I can't comment and I'm waiting for an account merge, but here’s the hdri setup. ![enter image description here](i.stack.imgur.com/073gc.png) Also, I tried the method mentioned in the comment already and the same issue persists. Visible only when viewed directly.
– Leo
Jul 23 at 20:09
• @Leo My recommendation for you is to delete the spehre that is blocking the HDRI and use the method above. But it's just a recomendation because i'm not sure why you need the sphere
– Emir
Jul 24 at 4:19
• @Leo Now, im not sure to understand what you need, but is it something like this ? HERE The nodes are from the HDRI
– Emir
Jul 24 at 13:29

First turn off Glossy in the Ray Visibility panel in World Settings.

Instead of a Glossy BSDF and Transparent BSDF into an Add Shader, plug it into a Mix Shader instead. You can then vary the Fac to determine how transparent and how reflective the material is.

I can then see through the windows and keep the reflection of the objects without the HDRI image being visible as well.

I found an even better answer after some more digging. Apparently what I wanted was something called thin glass and it is pretty complicated.

I basically grabbed the Node Group from the second link and it worked perfectly.

For any beginners who see this here are the steps:

1. For the front of the glass, add a Mix Shader with a Fresnel node in the Factor and a Transparent BSDF in the top Shader point and a Glossy BSDF in the bottom Shader point. Set Roughness on the Glossy to 0.

1. For the back of the glass, copy all the nodes from the node setup for the front of the glass. Add a Math node set to Divide and plug that into the IOR of the Fresnel node. Set the Value of Divide to 1.

1. Add another Mix Shader node and a Geometry node. Plug the Backfacing from the Geometry node into the Factor of the new Mix Shader. Then plug the outputs from the other two Mix Shaders into this new Mix Shader. The front glass output into the top Shader point, the back glass into the bottom.

1. You can then highlight all these nodes, ⌃ Ctrl + G to make a new Node Group.

2. Plug one of the color points from the fours BSDFs into the empty point on the Group Input node. Hold ⇧ Shift + drag RMB then let go to create a split the node connection. Connect the other three Color points to this split connection.

3. Next, plug the bottom IOR point of the Fresnel node into the next empty point in the Group Input. Split the connection and then connect to the bottom point of the Divide node. Make sure it says IOR in the Group Input and not Value.

4. Finally plug the final Mix Shader output into the Group Output node.

You can then ⌃ Ctrl + ↹ Tab out and plug this node group into a Material Output node and you should be all set. If you want to organize a little, ↹ Tab back into the node group and add a Frame node.

You can then separate the node groups. Press N to open properties and edit the names of the Frame nodes or the final node group.

Remember to still turn Glossy off under Ray Visibility in World Properties if you don't want the HDRI image to be visible in reflections. And to hide the HDRI image in general by checking the Transparent box in the Film tab under Render Properties.

Here's how it looks! Good luck with your own!