google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.79k stars 1.89k forks source link

High frequency texture filckering and moire effect when moving camera #4666

Closed JackeryShh closed 3 years ago

JackeryShh commented 3 years ago

Describe the bug A clear and concise description of what the bug is. High frequency texture filckering when moving camera To Reproduce Steps to reproduce the behavior:

  1. moving camera

Expected behavior A clear and concise description of what you expected to happen. No texture filckering and moire effect

Screenshots If applicable, add screenshots to help explain your problem.

Logs If applicable, copy logs from your console here. Please do not use screenshots of logs, copy them as text.

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

romainguy commented 3 years ago

Did you generate mipmaps on those textures? There's an API for this. We don't have this issue when mipmaps are enabled.

JackeryShh commented 3 years ago

Did you generate mipmaps on those textures? There's an API for this. We don't have this issue when mipmaps are enabled.

Thank you for your reply. I used to think it was a problem of not enable the mipmap, but I didn't find an API to enable mipmap. In texture.cpp, I saw some APIs for generating mipmaps, but they did not solve the current problem. Which API is used to enable mipmaps?

romainguy commented 3 years ago

Texture.generateMipMaps()

JackeryShh commented 3 years ago

thanks, I just debugged and looked at this interface. The mipmap interface is enabled by default? My app calls canGenerateMipmaps() by default and it return true. My 3D model format is the glb.

image

romainguy commented 3 years ago

Do you have dynamic resolution enabled?

JackeryShh commented 3 years ago

Yes, I tried to enable DynamicResolution a few days ago, but it doesn't seem to work

romainguy commented 3 years ago

My point was more about disabling it (and it won't do anything if you hit the performance target). Can you share the glb?

JackeryShh commented 3 years ago

ok, the zip file is the glb model.zip

romainguy commented 3 years ago

So unfortunately this particular texture doesn't play well with mipmapping. I tried other glTF viewers and they have the same issue. I would recommend tweaking the textures (including the normal maps). Another alternative is to enable TAA which solves the problem in our renderer.

JackeryShh commented 3 years ago

Yes, other gltfl viewers also have this problem, such as gltf-viewer, but in Blender it seems well . I also have tried to turn on TAA a month ago, and the effect has been improved, but it will produce the certain ghost effect(especially when the frame rate is low) .

fanbinnet commented 3 years ago

Yes, other gltfl viewers also have this problem, such as gltf-viewer, but in Blender it seems well . I also have tried to turn on TAA a month ago, and the effect has been improved, but it will produce the certain ghost effect(especially when the frame rate is low) .

Can you start a issue for the ghost effect when TAA is enable ?

romainguy commented 3 years ago

This is a know limitation of our current TAA implementation (and something that's always somewhat present anyway, but we can limit it). Fixing it will come at a cost though.

fanbinnet commented 3 years ago

Fixing it will come at a cost though.

Thanks for the quickly replay!

JackeryShh commented 3 years ago

This is a know limitation of our current TAA implementation (and something that's always somewhat present anyway, but we can limit it). Fixing it will come at a cost though.

Do we plan to fix this problem about the ghost effect in the future?

JackeryShh commented 3 years ago

Yes, other gltfl viewers also have this problem, such as gltf-viewer, but in Blender it seems well . I also have tried to turn on TAA a month ago, and the effect has been improved, but it will produce the certain ghost effect(especially when the frame rate is low) .

Can you start a issue for the ghost effect when TAA is enable ?

This problem is very obvious in high-frequency textures, and there is no plan to start a issue for the ghost effect. And I plan to adjust the texture and normals to avoid this problem.