Home Technical Talk

Metalness PBR in BabylonJS seems to be buggy

I'm seeing some metalness PBR weirdness, is it supposed to work like this? Or are these bugs? I'm kind of new to the metalness workflow.

We're exporting models from 3ds Max 2018 to the glTF model format using the Max2Babylon exporter and viewing them in the BabylonJS web player.

First issue
The ball with Diffuse:white, Roughness:white, Metalness:white...  shouldn't the ball be brighter?
The ball with Diffuse:grey, Roughness:white, Metalness:white ... should the ball be darkening like this?
The rest of the balls look basically correct to me. 


Second issue
Ambient occlusion seems to be occluding direct light, but it should only be occluding ambient right?
All these meshes are using diffuse:white, roughness:white, metalness:black.
There's a white light at upper left.
The knot has baked ambient occlusion, the top ball has white AO, the middle ball has grey AO, the bottom ball has black AO.
Shouldn't the bottom ball have zero ambient, but still be hit by the direct light? It has a white diffuse after all...


Would love a sanity check on these.

Replies

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    AO should only really occlude indirect light so that is a bit shonky. 

    The rough metal ball is a grey area I think - appearance will depend greatly on what they're doing with the microsurface light scattering calculations and what they're doing to the IBL in it's way through the Shader. 
    Once the metalllc map becomes white you should lose all diffuse lighting, that combined with scattering from the roughness will naturally result in less light hitting the camera than hits the surface so it's not implausible that the object would appear darker with regard to specular response. 
    Do you know how they're sampling the specular IBL? 

    It might be worth trying a coloured IBL and/or pitching it against arnold/whatever for a sanity check.  The realtime implementations are all fundamentally bollocks so it's worth double checking them against something that does the sums properly  
  • Eric Chadwick
    "a grey area" harhar. ;)

    Thanks for the reply. Talking with the BabylonJS guys.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Thinking about it,  It's possible they're reusing AO for specular occlusion - it wouldn't be a huge crime to use the bottom 10% or so of the AO map rather than using a separate texture even if its not "correct" and you shouldn't really apply it to metals. 

    It's often useful to apply gradients as maps when attempting to reverse engineer these things. 

  • oblomov
    Offline / Send Message
    oblomov polycounter lvl 8
    The ball with Diffuse:white, Roughness:white, Metalness:white...  shouldn't the ball be brighter?
    The ball with Diffuse:grey, Roughness:white, Metalness:white ... should the ball be darkening like this?

    On a completely theoretical level, it should indeed be brighter in both cases. It is, however, not a problem specific to the BabylonJS implementation or the "metalness" workflow (the same thing would happen with the spec/gloss workflow if you try black diffuse white specular
    and black glossiness). This is a problem with most physically based reflection models currently used, based on microfacet theory (e.g. GGX is the one generally used nowadays).
    Most current PBR reflection models use a roughness or glossiness term to model the amount of microscopic variation of normals in the material. If the roughness increases, it means the microscopic geometry varies a lot, and the mathematical model takes that into account by increasing the spread of reflections and by increasing the amount of self-shadowing due to the microscopic geometry.  However, to be perfectly energing conserving, the models should also take into account the fact that increasing roughness should also increase the amount of intereflection between microfacets as well, which is where most of the reflection models currently used are falling short. Since interreflection is not modelled properly, self-shadowing is not compensated for and there is a perceivable loss of brightness for very rough specular materials.


  • Eric Chadwick
    Many thanks gents, good infos.
Sign In or Register to comment.