Jump to content
  • Advertisement
schneckerstein

DX11 Need help implementing NDF-Filtering + LEAN mapping

Recommended Posts

Hello,

I manged so far to implement NVIDIA's NDF-Filtering at a basic level (the paper can be found here). Here is my code so far:

//...
// project the half vector on the normal (?)
float3 hppWS = halfVector / dot(halfVector, geometricNormal)
float2 hpp = float2(dot(hppWS, wTangent), dot(hppWS, wBitangent));	

// compute the pixel footprint
float2x2 dhduv = float2x2(ddx(hpp), ddy(hpp));

// compute the rectangular area of the pixel footprint
float2 rectFp = min((abs(dhduv[0]) + abs(dhduv[1])) * 0.5, 0.3);

// map the area to ggx roughness 
float2 covMx = rectFp * rectFp * 2;
roughness = sqrt(roughness * roughness + covMx);
//... 

Now I want combine this with LEAN mapping as state in Chapter 5.5 of the NDF paper.

But I struggle to understand what theses sections actually means in Code: 

Quote

To combine this filtering method with our NDF filtering, we do
the following: We first interpret the first-order moments as a regular
shading normal coming from the normal map and perturb the shading
tangent frame with it.

I suppose the first-order moments are the B coefficent of the LEAN map, however things like

float3 hppWS = halfVector / dot(halfVector, float3(lean_B, 0));

doesn't bring up anything usefull.

Next theres:

Quote

We then compute a covariance matrix SIGMA
of the estimated Beckmann distribution (Eq. 5 in [OB10]) and interpret
this as another kernel filter image.png induced by variations of half
vectors caused by the normal map.

This simply means:

// M and B are the coefficents from the LEAN map
float2x2 sigma_mat = float2x2(
  M.x - B.x * B.x, M.z - B.x * B.y,
  M.z - B.x * B.y, M.y - B.y * B.y);

does it?

Finally:

Quote

Finally, using the convolution formulation of NDF filtering from
Eq. 12, we perform a nested convolution

eq21.png

This is the part confuses me the most: how am I suppose to convolute two matrices? I know the concept of convolution in terms of functions, not matrices. Should I multiple them? That didn't make any usefully output.

I hope someone can help with this maybe too specific question, I'm really despaired to make this work and i've spend too many hours of trial & error...

Cheers,

Julian

Edited by schneckerstein

Share this post


Link to post
Share on other sites
Advertisement

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!