Jump to content

Microsurface & Bumpmap conflict in PBR (when textureLOD extension not supported)


Recommended Posts

Hello world :P

First of all, BIG THANKS to @Sebavan for its amazing PBR Material ! I'm taking a lot of fun playing with the differents features.

On monday, I enjoyed playing with microsurface parameter. It worked really fine until I added a bumpTexture.

After diving into the code, I understood that microsurface is handled in two different ways :

  • EXT_shader_texture_lod WebGL extension is supported, LODBASEDMICROSURFACE define is added to the shader, and we can sample reflection texture with the good LOD level.
  • EXT_shader_texture_lod WebGL extension is NOT supported, no define is added to the shader, we don't have access to LOD level and we have to bias mipmap level when sampling to fake LOD level or something like that.

Both ways seem to work fine when I don't use bumpTexture. But if I add a bumptexture to the PBR material, then only the first option works.

With the second option, we can see some flickering or pixelation, I don't know how to call that (left plane on the picture) :


Here is a basic PG showing the PBR material with all these parameters (this one should work !) : http://www.babylonjs-playground.com/#19SMAD#3
And here is the same PG, but I intentionally disabled the extension, to see how it works on devices which do not support the extension : http://www.babylonjs-playground.com/#19SMAD#4

It's less striking on the PG (don't look perpendicular to a face), that's why I posted the picture above.

Maybe it's not a bug and it's really impossible to have both microsurface and bumpmap working when the extension isn't available ? What do you think ?

Have a good day ^_^

Link to comment
Share on other sites

Yep, I am really not proud of the support without the extension... and your understanding is fully correct :-)

The main issues are both specular aliasing and normal map aliasing and it costs of lot to reduce in the shader if the texture have not been authored in a special way. Also normal map mip mapping should be done in a custom way not the the default mip map:


So, the first thing is to disable mip map generation off the normals.

Concerning the extension, the bias does not give at all the same result than the lod extension. I did not spend more time on it considering most of the browsers should supprd the lod ext soon :-) 

I would be happy for integrating any changes on this part but I am kind of short in research time currently :-(

I am afraid that does not help resolving the issue but could give you more hint on where it coes from.

See you,


Link to comment
Share on other sites

Hello !

Oh don't be afraid, these explanations are really helpful ! :D
I wouldn't be able to figure out all this on my own, thank you !

I agree with the fact most of the browsers support the lod extension (fortunately !) and I think it's enough. I just wanted to understand why this was happening, and maybe inform you if this issue wasn't a known issue. :)

So, thanks for the link, I'll read it right now !
And maybe I'll experiment things on this.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...