question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] Are brdfLUT sampling coordinates correct?

See original GitHub issue

Hi!

I was going through several PBR implementation and noticed that this implementation samples the BRDF LUT texture using the (1.0 - roughness) as a second texture coordinate: https://github.com/KhronosGroup/glTF-WebGL-PBR/blob/master/shaders/pbr-frag.glsl#L151 texture2D(u_brdfLUT, vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))

while all other implementations use just roughness (no “1.0 - roughness” flip):

  1. Google’s Filament: https://github.com/google/filament/blob/master/shaders/src/light_indirect.fs#L58
  2. LearnOpenGL: https://github.com/JoeyDeVries/LearnOpenGL/blob/master/src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.fs#L162
  3. McNopper’s OpenGL: https://github.com/McNopper/OpenGL/blob/master/Example33/shader/brdf.frag.glsl#L46
  4. SaschaWillems’ Vulkan-glTF: https://github.com/SaschaWillems/Vulkan-glTF-PBR/blob/master/data/shaders/pbr.frag#L175
  5. SaschaWillems’ Vulkan: https://github.com/SaschaWillems/Vulkan/blob/master/data/shaders/pbribl/pbribl.frag#L136

LUT files across the different implementation look similar (see below). This fact makes me wonder who has it right? Our LUT: Filament’s LUT: LearnOpenGL’s LUT:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
javaglcommented, Oct 15, 2018

As far as I understood, the reference viewer is about to be developed in this fork/branch: https://github.com/ux3d/glTF-WebGL-PBR/tree/reference-viewer , but it only just started. Correct me if I’m wrong.

1reaction
lhogcommented, Oct 16, 2018

Guess this one is sorted out. Thanks a lot for your inputs and closing it for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specular IBL - LearnOpenGL
In the previous chapter we convoluted the environment map by generating sample vectors uniformly spread over the hemisphere Ω using spherical coordinates.
Read more >
Metal texture sampling questions | Apple Developer Forums
In GL, I was sometimes making use of texture2DProj() to sample a texture using homogenous coordinates (vec3). There does not seem to be...
Read more >
Texture sampling incorrect uv coordinate - Stack Overflow
I figured out the problem: normals/texture coords/etc must all share the same index as the vertex. I was arranging my texture coordinate ...
Read more >
Texture Gathers and Coordinate Precision - Nathan Reed
A few years ago I came across an interesting problem. I was trying to implement some custom texture filtering logic in a pixel...
Read more >
Solved Question #9: Texture sampling modes There are various
a) g1.Nearest mode will just take the pixel color of the single pixel that is closest to the texture coordinates it is currently...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found