ValveSoftware / the_lab_renderer

Valve’s VR renderer used in The Lab (Valve’s VR launch title for the HTC Vive).
BSD 3-Clause "New" or "Revised" License
282 stars 58 forks source link

Still Uses Phong Shading and Not GGX #15

Open TheSchaeff opened 7 years ago

TheSchaeff commented 7 years ago

It appears that the lighting model in the shaders is based off of the phong lighting that Unity had at the time The Lab Renderer was created. Unity now has the more physically correct GGX lighting which is crucial when working with PBR in things like Substance Painter, as a lack of consistency makes it impossible to make things look right. Is there any way to use GGX with this renderer?

k0091601 commented 7 years ago

That's intentional, Phong shading is much cheaper than GGX. GGX would not be optimal for VR. However it wouldn't take much to switch from Phong to GGXto test for your self. As for consistency issues, they should be fairly minimal as this is still a pbr based renderer.

TheSchaeff commented 7 years ago

I know it was intentional, especially since that's what Unity used at the time, but the consistency issues are too much unless the assets are designed specifically for it. I've been trying to switch from Phong to GGX, but still haven't been able to find exactly where in the code to do that. It seems that the functions that affect the lighting are quite spread out.

k0091601 commented 7 years ago

shaders/vr_lighting ComputeDiffuseAndSpecularTerms is the function your looking for, It computes both diffuse and specular terms.