🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

BRDF lut sampling coordinates

Started by
4 comments, last by PLCrashy 1 year, 4 months ago

Hi,

I've implemented specular IBL following this article https://learnopengl.com/PBR/IBL/Specular-IBL

But right now when I compare my results with what I see in Substance Painter, I feel like I did something wrong.

When I invert flip the y lookup direction I have much more consistent results.

vec2 envBRDF          = texture2D(BRDFIntegrationMap, vec2(NdotV, 1.0-roughness)).xy;// reverted the Y lookup

I've double checked all the maths, various shadertoy implementations, and everything seems to show my LUT is flipped upside down, which makes sense in OpenGl. This post is also talking aobut this kind of issue https://github.com/KhronosGroup/glTF-Sample-Viewer/issues/89

However I'm still not 100% convinced I'm not doing something wrong elsewhere, so let me ask this simple question:

I assume the LUT is expected to be sampled like that:

Am I correct ?

Advertisement

PLCrashy said:
When I invert flip the y lookup direction I have much more consistent results.

Maybe there is some inaccuracy on the LUT itself too. The image on the LearnOGL site shows a dark gradient on the left edge of the green spot, which seems missing from yours.

The posted image is from the UE 4 presentation, used this one because it already had the Roughness / cos theta legend, I'm indeed using the one from learn OGL

PLCrashy said:
I'm indeed using the one from learn OGL

You mean the compressed 8 bit png from the webpage? If so, maybe precision is not enough, and you need to generate it procedurally like they did with a shader.

Sadly i can't answer your question.
However, beside flipping one axis, swapping X and Y would be worth to try as well. The lut image is quite symmetric on the diagonal, so i guess that's easy to confuse and hard to be sure as well.

Besides, the difference to Substance Painter you see could also come from other details everybody does a bit differently.
If the difference is not big, i would not worry. It's all approximations anyway. Most of those PBS equations are not based on real world optics, but just analytical functions tweaked to match some measured real world results closely, while being cheap to compute. And even if we could get this right, we would still fail on computing the incoming light precisely.

When i learned about path tracing, i could match my Cornell Box renders with other applications for reference. But only with a diffuse Lambert material. As soon as the materials gets more complicated and involve reflections, i don't think that's possible anymore.
The roughness term already lacks a proper definition, for example. At least i could not find one which made sense.

Thanks for you long reply.

No, I'm not using this 8bits png, I meant I use a 16 bit one I generated with some shader I found elsewhere which is producing the same LUT.

I've checked again various implementations of PBR BRDF on shadertoy like this one https://www.shadertoy.com/view/wlscRH​ and I'm now 99% convinced I indeed flipped the Y axis before.

About the differences with Substance, I agree that I shouldn't focus too much on it, their viewport shading model is full IBL without any direct sunlight nor shadow maps, I've managed to get something close to my game by exporting some HDRi envmaps captured in-engine and using the same tonemapper, but there was still a huge difference with the fresnel reflections until I - maybe - fixed that issue with the LUT.

This topic is closed to new replies.

Advertisement