I'm trying to (perhaps foolishly) use the shipped glass material in a pbr render, and I'm getting black artifacts whenever I set the refractive IOR to anything but 1. The closer I set it to 1, the less black I get. I've tried surrounding the entire scene with a white cube so that there is no possibility of the refractive material ray not hitting legitimate geometry, and I still get the same result. I'd like not to start from scratch and write my own glass shader, but that's what I'm looking at now. Surely the shipped glass shader still isn't broken, and I've just missed something really simple?
Turning off the reflections in the glass shader additionally turns off total internal reflection. I believe that is the reason for the black in this scene.
After doing some poking around, it looks like at least part of my problem is that the Trace Vop in the vopnet that contributes the refraction contribution isn't taking into account either the reflection map or the background colour when geometry isn't hit by a ray. In a traditional micropolygon render this works fine. Can you confirm?
That being the case, how best is it to completely surround my geometry with a dummy environment for the refraction rays to find while still being able to use the envlight (if I surround my geometry with an environment, light is no longer cast from the envlight because of the shadow cast onto the scene by the dummy environment - the shadow mask input field doesn't seem to have any affect in a pbr render).
I believe that reflection and shadow masks aren't evaluated in PBR modes (?). You could try rendering an environment map of your scene (including any objects you want to have show up in the refractions) and use that as a a map for the environment light.
That doesn't solve the problem - I can't use the glass shader in a pbr render unless the environment is completely contained (rays that don't strike geometry will return a black result), and if the environment is completely contained, I can't use the envlight because whatever geometry that I've used to contain the environment eliminates the envlight's contribution.
I'm determined to get this to work with the tools at hand - I'm still convinced that I must be missing something simple. Certainly it's not impossible to use the glass shader and the envlight together in a pbr render. Right?
I added an isShadowRay test in the constant shader for the constant material used for the environment sphere. If tracing a shadow ray the shader now returns opacity of 0
Making the constant shaded geometry invisible to shadow casting rays, as far as I can tell, reintroduces the same black faces/rays hitting nothing problem.
phew - I was wondering, too. Could it be that the isshadowray test only works in PBR since the 9.5 line? And if yes, what other nice raytracing related function work now in PBR? raylevel? :wink:
I looked at your file and it's working for me in 9.5 - thank you. Now the trick is to not have the giant sphere contribute any indirect illumination to the scene…