20
$\begingroup$

This question already has an answer here:

Here's a sample scene:

A room with a window, a point light to project light into the room, an HDR environment outside the room and a nice Image by Rembrandt that should be somewhat reflected on the glass:

enter image description here

Using a standard glass shader on the window, the direct light from the lamp does not shine into the room, regardless of how bright that light is. So I can't recreate the impression of hard day light, with clearly defined areas of light and shadow.

enter image description here

Adding a transparent shader to the glass shader I get a very pleasing result. The light from the lamp illuminates into the room creating defined shadows, transparency seems unaffected, to see the HDR in the background, the refection seem correct to me (I also like how I get double reflections from the thick glass).

enter image description here

Even though I am quite happy with this solution, I've gotten a few comments on making a setup with light path nodes controlling the mix of transparent and glass. The biggest issue is that the reflections on the glass are brighter than what they should be.

So the question is: By using this approach am I messing up any of the qualities of glass? And if so, what would make a proper glass shader that is realistic, in terms of letting direct light through, while keeping reflections, refraction and transparency?

A file to play with:

The HDR image used was created by GiantCowFilms

$\endgroup$

marked as duplicate by cegaton, Community Feb 28 '16 at 9:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Why not use Is camera ray to mix the transparent and glass? $\endgroup$ – GiantCowFilms Feb 28 '16 at 0:27
  • $\begingroup$ @GiantCowFilms because it changes the transparency: i.stack.imgur.com/efCNj.jpg or it doesn't let the lamp's light through again: i.stack.imgur.com/oTo21.png $\endgroup$ – cegaton Feb 28 '16 at 0:28
  • $\begingroup$ Why does it change the transparency? smells second followup question $\endgroup$ – GiantCowFilms Feb 28 '16 at 0:28
  • $\begingroup$ @GiantCowFilms see how the trees in the background change. It looks like all we get is refraction $\endgroup$ – cegaton Feb 28 '16 at 0:29
  • 1
    $\begingroup$ Have you tried putting a portal over the window? That helps with light calculation and distribution in an enclosed scene. $\endgroup$ – Italic_ Feb 28 '16 at 3:00
20
$\begingroup$

This has been answered before with a very clear explanation here.

Using the Shadow Ray and Reflection Ray trough a Math/Maximum node to combine the glass and transparent shaders.

I'll just post the node setup here, maybe someone will find it useful.

enter image description here

$\endgroup$

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