CesiumGS / obj2gltf

Convert OBJ assets to glTF
Apache License 2.0
1.71k stars 307 forks source link

minFilter 9986 vs 9987 - Moiré pattern on model viewer #239

Closed lanxinger closed 3 years ago

lanxinger commented 4 years ago

Hi,

We have been a long time user and have been using google's model viewer implementation which relies on the threeJS library.

We recently found an issue with the model textures that they appear to show a moiré pattern (upon closer inspection) as has also been discussed on this model viewer issue: https://github.com/google/model-viewer/issues/936

I have then gone ahead and edited the glb files manually and changed the minFilter value to the proposed 9987 and the issue disappeared.

How can we create a .glb file that uses minFilter 9987 instead of 9986.

Has anyone run into this issue before?

lilleyse commented 4 years ago

@lanxinger I think NEAREST_MIPMAP_LINEAR (9986) is a good default given the runtime/quality trade-off. Though I'm not opposed to removing the defaults and letting the runtime engine decide. Would that work for model-viewer?

lanxinger commented 4 years ago

@lilleyse thank you for your reply.

yes I think that would work. I checked the gltf export from blender and they are not using the minFilter at all and the exported file doesn’t cause moire issues. If people would still need it would it be a good option to have a flag that people can pass via CLI?

lanxinger commented 4 years ago

@lilleyse according to one of the Google model viewer developers:

"Yes, removing the default would be ideal. Technically that's not letting the engine decide, as the glTF spec specifies which default the engines must use. However, they chose that default with input from the engines, as we know anything other than LINEAR_MIPMAP_LINEAR results in significant rendering artifacts. The performance difference from this is small since it is handled in hardware anyway.

Thanks,"

https://github.com/google/model-viewer/issues/936#issuecomment-623535158

lilleyse commented 4 years ago

@lanxinger opened a PR here: https://github.com/CesiumGS/obj2gltf/pull/240