Shimmer when zooming on reflective object with detailed environment map - mipmapping problem?

Zoom the camera in and out in this playground: Babylon.js Playground
You should see the reflection on the surface of the ball shimmer.

In more detail: The ball is a reflective PBR material (metallic = 1, roughness = 0). It’s hovering over black ground with a regular pattern of small white rectangles on it. The ground is reflected on the ball, however as you zoom out, instead of blurring slightly the reflection of the white rectangles shimmers. I am not a graphics expert but I think this sort of shimmering is what mipmapping is intended to avoid, so I am wondering if somehow mipmaps aren’t being used? The probe used to generate the environment texture does have mipmap set to true.

Just in case this is browser/OS/hardware related: I have seen this on an M1 MacBook Pro 14" running Chrome and Safari.

I’m not sure you can do much about that, the pattern texture is notoriously bad for this kind of effect. You can try to apply a Fxaa post process and see if that helps.

cc @sebavan in case he has a tip to improve things.

I d love if we could find smthg for it !!! but I am not aware of any easy way

You might be right. Just one thing though: If you try rotating the view in the playground so that the camera is looking more directly at the ground and then zooming out, you get to see how the pattern looks when it’s just the StandardMaterial displaying the texture zooming out, rather than the reflection of the texture in the sphere. It does alias a little but it looks much less bad than the reflection. As you zoom further away, the dotty pattern fades to grey, which is what I would expect with mipmapping - in the end you’re using a very scaled-down image which blurs the black and white together.

Compare that with how the reflection of the same pattern in the sphere behaves as you zoom out: It never goes grey. Even when you zoom out very far, it stays black with some white dots on it, and the white dots flicker as you zoom. That’s what makes me think that the environment map texture isn’t using mipmapping, and that perhaps there’s something not working right in the shader.

Actually, @sebavan found a way to make it look a lot better. On the PBR material:

  • enable realtime filtering
  • enable specular antialiasing

The downside is that it uses a little more GPU power as enabling realtime filtering is not free.

1 Like

Thanks very much both, those two settings when used together do indeed make it look miles better! Much appreciated.