Cook-Torrance problems - Real Time VFX
1598261992 91cfdab36e69bc2e9d2521270815339077c79c5a 2 1024x481.jpeg

hi Guys

I calculate Cook-Torrance BRDF. It looks fine and mostly fine, but I found a problem with the term geometry.
Code for "G" term are:

float GeometrySchlickGGX (float NdotV, float k)
{

  • float nom = NdotV; *
  • float denom = NdotV * (1.0 – k) + k; *
  • return nom / denom; *
    }}

float GeometrySmith (vec3 N, vec3 V, vec3 L, float k)
{

  • float NdotV = max (point (N, V), 0.0); *
  • float NdotL = max (point (N, L), 0.0); *
  • float ggx1 = GeometrySchlickGGX (NdotV, k); *
  • float ggx2 = GeometrySchlickGGX (NdotL, k); *
  • return ggx1 * ggx2; *
    }}

Where k = roughness and calculated as:
float r = (roughness + 1.0);
float k = (rr) / 8.0; *

Here is the problem. In this case, I just output the term "G" itself without any other calculations (completed calculations also have the same problem).
Notice how the area that should remain lit turns pure black.

Take a look at the lighted area.

Now this “illuminated” area turns black.

I don't really understand the BRDF theory and the BRDF code, so I'm not sure if it's a problem with these G-term calculations or a generic Cook Torrance problem.
I think these behaviors are probably correct, as the surface normals of these problematic areas are more like looking at the light position and looking at the camera from some sort of "backside". I mean something like this:

But I'm not sure it should really work that way either.

All of the code is from
https://learnopengl.com/PBR/Theory
https://nccastaff.bournemouth.ac.uk/jmacey/OpenGL/shaders/PBR/pbr.html

LEAVE A REPLY

Please enter your comment!
Please enter your name here