Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GGX VNDF PDF is incorrect #23

Open
LDAP opened this issue Dec 4, 2024 · 0 comments
Open

GGX VNDF PDF is incorrect #23

LDAP opened this issue Dec 4, 2024 · 0 comments

Comments

@LDAP
Copy link

LDAP commented Dec 4, 2024

The PDF for the GGX VNDF is wrong here:

float ImportanceSampleGGX_VNDF_PDF(float roughness, float3 N, float3 V, float3 L)
{
float3 H = normalize(L + V);
float NoH = saturate(dot(N, H));
float VoH = saturate(dot(V, H));
float alpha = square(roughness);
float D = square(alpha) / (M_PI * square(square(NoH) * square(alpha) + (1 - square(NoH))));
return (VoH > 0.0) ? D / (4.0 * VoH) : 0.0;
}

The correct version has to include the G1 term and the VoH of the determinant cancels:

// ...
float D = square(alpha) / (M_PI * square(square(NoH) * square(alpha) + (1 - square(NoH)))); 
float G1 = //...

return (D * G1) / (4 * VoN);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant