Adjustable strength for SpecularAntiAliasing of PBR material

It would be nice if the strength of the SpecularAntiAliasing which is part of the PBR material would be adjustable. In my case it is to strong and the material does not look like shiny metal anymore (not enough contrast).

I don’t know if this is the correct place but i was playing around with this factor in the shader: Babylon.js/pbrHelperFunctions.fx at master · BabylonJS/Babylon.js · GitHub
Lowering it to 0.25 seems to be a good compromise in my case.

SpecularAntiAliasing disabled

SpecularAntiAliasing enabled (factor 0.75)

SpecularAntiAliasing enabled (factor 0.25)

1 Like

I will let @Deltakosh / @sebavan answer this one, but I’m not sure we want to add yet a new parameter to the PBR material, that already has a lot (also, I find the rendering with 0.75 better than with 0.25 in your screenshots above)…

Maybe you would want to enable FXAA or greater MSAA instead?

Maybe this is a better image to show the issue:

If you look at the anti alialiasing itself, factor 0.75 is the clear winner but the material looks much brighter now. All the black areas in our env-map are now grey. With factor 0.25 the result is much closer to what we want and the aliasing is acceptable. FXAA is already enabled.

@Deltakosh , @sebavan What is your opinion about this?

I let @sebavan decide but I’m not in favor of more parameters either

Can we fix it with a NodeMaterial maybe r a CustomPBRMaterial?

My use for this would be to calm down the reflection shake of a smooth mesh, possibly metallic, on a headset. Quest has minor rotation oscillation. It makes edges a little jumpy, but really destroys the interior when it is shiny.

My, on headset, material testing capabilities might be able dial in a sweet spot with ease.

As far as parameters, I would probably add this to Blender, so you could generate your geo with the value already set.

One way to do it is with a PBRCustomMaterial:

http://playground.babylonjs.com/#FUAAU1#1

But you will need this PR first:

Hmmm … i’m not a big fan of those string replace “hacks”. This seems very fragile and could break with every babylonjs update if the shader was changed. For my case i could just patch the pbrHelperFunctions in the IncludesShadersStore if i want to solve it in a hacky way.

I would be happy to not have a new parameter as well for this, the thing is that here the normals are changing direction so fast between 2 pixels that it almost feels like roughness so overall from far away both colors fetched from far away in the env texture gets blurred :frowning:

Thank you. For our next release i decided to enable SpecularAntiAliasing and use it as it is without modifications. Let`s see if someone from the marketing will complain :grinning:

1 Like