6

I'm playing round with a fairly common Cycles node setup for glass that gives the reflections of glass but without the darkness that you get with the default glass shader:

enter image description here

The left panel uses a custom 'fast glass' material (node setup below), and the right one uses just the default glass shader. While I'm expecting the double reflections on the left panel - since that's what happens with glass IRL - they seem really far apart depth wise. The glass is only 12mm thick, so I was expecting those two reflections to be almost on top of each other. Also, one of the reflections is noticeably larger than the other, which I imagine is also due to the exaggeration of depth. I'm stumped as to why.

Setup:

  • Both glass panels have had scale applied.
  • Both glass panels are closed meshes at 12mm thick.
  • Both glass panels are flat shaded, with normals facing outwards.
  • The default glass is using the default glass shader with an IOR of 1.450 degrees.
  • The 'fast glass' uses the following material:

enter image description here

Edit:

File uploaded here (swapped out the floor so I could drop the texture, but otherwise the nothing else changed):

Tinkering some more, I noticed that if I use the Shadow Ray and Diffuse Ray as my factor I get just the one reflection, so it looks very similar to the standard glass shader, minus the shadow. Interestingly if I use the glossy ray I get a lot of refraction going on, which doesn't seem right given the thickness of the material, but I can't begin to figure out why.

Dre
  • 161
  • 4
  • Hard to tell, could be a shading issue. Are your glass objects flat shaded or smooth shaded. Smoothing could be messing up with your normals, leading to unexpected reflection results – Duarte Farrajota Ramos Feb 27 '17 at 16:50
  • @DuarteFarrajotaRamos Both are flat shaded, with normals pointing outwards. – Dre Feb 27 '17 at 17:12
  • Might be nothing to do with the issue, but I'm suspicious of the Math node performing the operation "maximum" (i.e. picking the greater of the two inputs). I would have expected Add. – Lewis Feb 27 '17 at 17:14
  • 1
    Could you upload the file for an easier understanding? You can use this link http://blend-exchange.giantcowfilms.com/ (if some textures, please pack them in) – lemon Feb 27 '17 at 17:15
  • @Lewis Changing it to Add doesn't appear to make a difference. My - admittedly limited - understanding was that it makes no difference as the factor clamps it down to 1 anyway, so it doesn't matter if 1 or 2 is passed into it. – Dre Feb 27 '17 at 17:29
  • Well it is definitely related to the Maximum changing it to Add or Subtract* eliminates de double reflection at least. – Duarte Farrajota Ramos Feb 27 '17 at 17:38
  • @DuarteFarrajotaRamos Odd: I see no difference changing to Add. However, Round or Subtract do remove the double reflection. In lieu of a better solution I might use that for the time being. Would still be great if someone could explain why this is happening: trying to wrap my head around how some of this works is a brain melter! – Dre Feb 27 '17 at 17:47
  • 2
    Eliminating variables all together and removing the Light Path and Math nodes from the equation I think it may be something related to the Shader Mix or the Transparency shader and how they work internally. If you gradually increase it's value by hand you can actually see the reflections gradually growing apart – Duarte Farrajota Ramos Feb 27 '17 at 17:49
  • Maximum is exactly what is giving the reflection, which is a natural occurrence in double pane glass. In reality it is usually barely noticeable, but is there. Adding another source of light will likely alleviate the effect. – Timaroberts Feb 27 '17 at 17:50
  • 1
    @Timaroberts The issue is not that the reflections are there, that is expected and wanted, the issue is that the reflections of each pane look unnaturally apart. Which doesn't happen with the pure glass shader. It is probably an expected side effect of the "cheating" we are introducing into an otherwise physically correct system. – Duarte Farrajota Ramos Feb 27 '17 at 17:53
  • 2
    @DuarteFarrajotaRamos You're onto something: setting the mix of glass and transparent to 0.5 -- or anything between 0 and 1 -- seems to increase the refraction, which is in turn affecting the reflections. I'm guessing that somehow the mixing the two shaders together messes up how Cycles calculates IOR? Baffling. – Dre Feb 27 '17 at 18:00
  • 2
    It seems to be specifically the inclusion of Reflection Ray into that calculation that breaks the IOR. If you plug just the Shadow Ray input into the mix node directly (bypass the Math node) the results are what you would expect. If you plug Reflection Ray into the mix node directly, you get the odd double reflection. Not sure why, but including Reflection Ray in that calculation breaks it. – Lewis Feb 27 '17 at 20:49
  • Well, someone post the answer... ;-) And, sounds like a bug perhaps... – Cyberchipz Mar 01 '17 at 20:50
  • I think this should probably be using the 'is Glossy Ray' socket rather than 'is Reflection Ray' for the reflection off the back pane of glass (internal reflection - ie, Glossy on the inside surface) and then mix in a Glossy shader for the reflection of the front surface. – Rich Sedman Apr 15 '17 at 11:05
  • After playing around with it some more, I believe mixing based on the 'is Reflection Ray' is the problem as it is interfering with the natural refraction. Normally a refracted ray must travel both into and out of the solid and the refraction into the solid would refract one way while the refraction out of the solid would refract the opposite way. Using the is Reflected Ray is allowing the ray to refract on entry to the glass but is preventing it from refracting on exiting the glass - so it's as if it's a non-manifold refractive surface which produces strange effects.... – Rich Sedman Apr 15 '17 at 20:50

1 Answers1

1

The problem is that the Mix node using the 'is Reflection Ray' is causing the glass to behave as a single refractive surface - which doesn't exist in the 'real' world. Normally the refraction would bend the light one way on entering a solid and the other way on exiting the solid, effectively cancelling each other out.

However, I believe the Mix node is resulting in rays entering the glass and being refracted as normal, reflecting off the back surface of the glass, and then passing out of the front surface of the glass without refracting back the other way.

In order to demonstrate this, change the color of the Glass Shader to give the light that passes through it a tint to make it identifiable to that reflected off the surface. Also, increase the IOR to make its effect more pronounced. You should get something like the following :

reflections

As you can see, the 'untinted' reflection is the same as that on the surface of the other pane. This is not passing through the glass and is not refracting - it is simply the reflection off the surface of the glass.

The 'tinted' reflection is entering the glass and reflecting off the back surface. However, it is not being refracted at both surfaces - only one since the Mix is causing the surface to behave as Transparent on one transition - and this is causing it to act as a lens.

Rich Sedman
  • 44,721
  • 2
  • 105
  • 222