Verify my GGX + Lambert Directional light

Started by
21 comments, last by Rannion 8 years, 8 months ago

Hi, as I'm rewriting some old stuff, I had a look at this thread and it seams really good. I might go for GGX specular soon.

But I have a stupid question I guess, I was wondering about that line:

float3 l_diffuse = in_diffuse * PI_INV * NdotL;

Is it standard now to multiply by (1/pi) for the lambert term ? And also if I go for this model, is it applicable for directional, point and spot lights ? Or just for a specific one ?

Also as this is going to be way darker, I assume it HAS to be used with GGX specular to compensate, am I right ?

Edit:

Got more questions now... How would one go from the old normal material model to this new one ? Like for specular I was using a specular colour with rgb and "a" was the specular factor. Specular power was also known as material shininess.

Now we are left with the roughness which I suppose is correlated with the old shininess. And F0 which I'm guessing is what I had in the specular colour but this is pure speculation. Is there a way to transform one to another ?

Cheers

Advertisement

Is it standard now to multiply by (1/pi) for the lambert term ?

It is the normalization function for Lambert. Yes, it should always be done for the sake of energy conservation.

And also if I go for this model, is it applicable for directional, point and spot lights ? Or just for a specific one ?

The type of light has no relationship to the lighting model. The only things that change based on the type of light are the intensity (due to fall-off) and direction (directional lights use a single direction, other light types derive the direction based on the light location and the location of the point being shaded).
Shading models are not coded into lights. They accept a set of parameters and don’t care how those parameters were created (whether from a directional light, point light, spot light, or tube light).

Also as this is going to be way darker, I assume it HAS to be used with GGX specular to compensate, am I right ?

No. Why?
Lambert is used with Cook-Torrance, GGX, Blinn-Phong, etc.
…or you can instead use another albedo model such as Burley’s (Disney).

How would one go from the old normal material model to this new one ? Like for specular I was using a specular colour with rgb and "a" was the specular factor. Specular power was also known as material shininess.

It is up to you.
Clearly you will want to make tools to allow authoring the data with the new terms (roughness, etc.), but for starting off you can convert your specular power to roughness using the equations I already listed.
The 1st is for Oren-Nayar, the 2nd is fitted to GGX.

And F0 which I'm guessing is what I had in the specular colour but this is pure speculation.

It is. If your specular “factor” is a multiplier (not specular power/shininess), then pre-multiply it before sending it through the Fresnel function.

Is there a way to transform one to another ?

The questions I already listed convert specular power to roughness. See above.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Thank you very much Spiro, you are such a helpful person. Don't know how you can reply to all those threads while still have your own work.

Anyway this is much appreciated and I think you deserved a real thank you here.

You just replied to all my interrogations right now so, I'm going to give it another go very soon.

This topic is closed to new replies.

Advertisement