0
$\begingroup$

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 direct view

Here's the sphere shader. shader

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

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

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.

Added HDRI ShadersHDRI Shader

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.

enter image description here

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?

$\endgroup$
5
  • $\begingroup$ Can you show a screenshot of your HDRI nodes? $\endgroup$
    – Emir
    Jul 23 at 18:21
  • 1
    $\begingroup$ Does this answer your question? Use a HDRI just for lighting and change the background color $\endgroup$
    – Emir
    Jul 23 at 18:27
  • $\begingroup$ 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. $\endgroup$
    – Leo
    Jul 23 at 20:09
  • $\begingroup$ @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 $\endgroup$
    – Emir
    Jul 24 at 4:19
  • $\begingroup$ @Leo Now, im not sure to understand what you need, but is it something like this ? HERE The nodes are from the HDRI $\endgroup$
    – Emir
    Jul 24 at 13:29
1
$\begingroup$

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

enter image description here

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. enter image description here

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


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

Useful links:

  1. https://blenderartists.org/t/glass-shader-keeps-reflection-of-environment-map-even-though-it-is-set-to-transparent/1126301

  2. https://devtalk.blender.org/t/principled-bsdf-transmission-behaviour/2096/3

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.

enter image description here

  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.

enter image description here

  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.

enter image description here

  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 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.

enter image description here

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.

enter image description here

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!

enter image description here enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.