I am switchting from the standard shader to the VR_standard shader of “The Lab Renderer” from Valve. During this process, my materials (which are exported in metallic mode from Substance Painter) seem to partially experience a drastic increase in Fresnel reflection. You can see this below on the top wooden board which is fine in the Standard shader (top) but not in the VR_Standard shader (bottom), where the wooden board has a full-cover “shine”.
I tried playing around with the settings in Substance Painter. If I set the boards to fully metallic and fully rough the effect goes away - but then the boards are no longer reflective AT ALL which is not what I want. And, it looks completely fine in Unity’s shader to begin with. The project is set up for Vive VR (forward rendering, linear color space) and is indoor (no ambient intensity, no reflection intensity, point lights + reflection probes + light probes).
So, I am guessing that the VR_Standard shader (this guy here on Github) somehow uses a different fresnel implementation (or even exaggerates it, as I heard someone say). The problem is that I am new to shader programming and I don’t know where to look for any such code and how to possibly adapt it.
I would thus appreciate it if someone can point me at the correct values / search terms to control fresnel in the shader code.
Unity’s Standard shading model is a physically based model that uses a GGX Specular lobe.
Valve’s vr_standard shading model is a normalized blind-phong model roughly balanced to look similar to Unity’s standard shader with the same inputs, but only roughly.
In short they’re very different shaders and will not look the same.
As for your specific question there’s no easy answer as there isn’t a value exposed by the shader to control the fresnel easily. You would have to go through the shader and accompanying .cginc files to find where that fresnel effect is being applied and add your own variable to adjust the power or intensity.
ok, so what you’re saying is that the vr_standard shader is outdated. Fair enough ;-).
Unfortunately the Valve VR shadows far surpass Unity’s with realtime lights, and they require the vr_standard shader, so I seem to be stuck with it. Thus, I would like to change it to handle Fresnel differently. Do you think this is possible? You mention “balancing”. Could you point me to which settings in the shader code could be responsible for the effect I am seeing?
Outdated is perhaps the wrong word. It’s a shader designed for VR, and in that capacity they’ve chosen optimization for virtual reality, both in shader complexity and aliasing reduction, over a potentially more accurate, but significantly more expensive shading model.
By “balanced” I mean they take the same textures that the Unity Standard shader takes and handwavely produces similar results. Here’s a comment in the function that handles part of that converts the smoothness from the metallic / smoothness texture to the blinn phong exponent.
Basically they’re just trying to get something that doesn’t look totally wrong when using the same content.
As for “changing the fresnel”, it’s totally possible, but it requires figuring out exactly what parts of the shader you don’t like and modifying them. I don’t know exactly where in the shader that kind of powdery white glow comes from, so your best bet might be just going through the shader and commenting in / out parts until it goes away and then try to reverse engineer what they’re doing. That’s what I would do if I was trying to tackle this.
I’ve now had an in-depth look at the shader code. I found two places where the Fresnel is calculated, and by multiplying the reflection lerp adjustment value with a scalar I can now fine-tune Fresnel without touching other reflections.
For anyone else looking, the values to adjust are in lines 177 and 566 of vr_lighting.cginc.