Sign in to follow this  

PDF derivation in UE4

Recommended Posts

Hi all,


In Karis's 2013 course notes for PBR in Unreal Engine 4, he states the PDF used in importance sampling in shader code:

// Incident light = SampleColor * NoL
// Microfacet specular = D*G*F / (4*NoL*NoV)
// pdf = D * NoH / (4 * VoH)
SpecularLighting += SampleColor * F * G * VoH / (NoH * NoV);

Given the specular lobe of the microfacet BRDF being used (Smith GGX), I'm having a bit of trouble arriving at the stated PDF. In particular, I'm working through the derivation described in the GPU Gems chapter on importance sampling, and I don't fully understand how to get the material function in terms of spherical coordinates (like in equation 4 of the GPU gems chapter).


Maybe it's just that my knowledge of calculus and coordinate systems has gotten increasingly rusty over the years, but could anyone walk me through the derivation or point me in the right direction? Thanks!

Edited by brkho

Share this post

Link to post
Share on other sites

You'll want to read Walter's original paper where he (re-)introduced GGX, and derived the formula for sampling the distribution (see section 5.3). If I recall correctly, you'll need to also read the referenced paper if you want to understand how they arrive at the final weighting function.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this