google / model-viewer

Easily display interactive 3D models on the web and in AR!
https://modelviewer.dev
Apache License 2.0
6.88k stars 816 forks source link

Maps moiré effect #936

Closed Sbstnlhmchr closed 3 years ago

Sbstnlhmchr commented 4 years ago

Description

Our objects have a moiré effect on certain maps. It is the same with glb and gltf.

Is there a solution for this?

Live Demo

https://framework.tv/leistungen/digital/webar-obi-uebergabedaten/

Browser Affected

OS

<

hybridherbst commented 4 years ago

Looks like incorrectly generated mipmaps to me - also curious about this.

elalish commented 4 years ago

I believe I fixed that in #880, which is slated to be released imminently in 0.8 (we're just finishing up a few bug fixes at the moment). Can you try master and see if it's improved?

Sbstnlhmchr commented 4 years ago

@elalish I took the well-known route to installation because I don't know exactly how to use master. We got the problem under control by deleting all maps (normal, metallic, AO) and reducing the contrast of the diffuse map by approx. 70%. At usdz we kept all maps.

Thanks for your help

elalish commented 4 years ago

@Sbstnlhmchr Oh my, please don't delete all your maps! We just released 0.8 yesterday, so that should make it much easier to test. If any rendering problems remain, please let me know!

cdata commented 4 years ago

@Sbstnlhmchr can you confirm that you are (or are not) still experiencing this issue in our latest release (v0.8.1)

Sbstnlhmchr commented 4 years ago

@cdata hello, thanks for asking. I turned off the url because the project is submitted. To solve the problem, we reduced the contrast and deleted almost all maps. It is not yet optimal, but it looks good - the URL is online again for two days.

cdata commented 4 years ago

No problem, hopefully we can help discover the problem. Would it be possible for you to share a screenshot (or better: a model) w/ maps?

Sbstnlhmchr commented 4 years ago

https://framework.tv/wp-content/uploads/2020/01/Problem-Moire.zip Here is an example created from C4D. It is just a cube and has a NormalMap and DiffuseMap.

elalish commented 4 years ago

@Sbstnlhmchr Thank you for the example! The problem is with the model, but it's very easy to fix (and oddly common; may I ask what program created the glTF?). The samplers are set to LINEAR interpolation: "minFilter":9729, but you want LINEAR_MIPMAP_LINEAR: "minFilter":9987. With that change to both samplers, the Moire is gone.

lanxinger commented 4 years ago

@elalish we are also having this issue. It wasn't apparent to me right away but it amplifies when using multiple models on a single page.

our models are using the obj2gltf tool by cesium.

I filed a bug report there: https://github.com/CesiumGS/obj2gltf/issues/239

lanxinger commented 4 years ago

@elalish got a reply from obj2gltf developer:

image

would that work?

elalish commented 4 years ago

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,

-Emmett

On Sun, May 3, 2020 at 6:41 PM Markus Lanxinger notifications@github.com wrote:

@elalish https://github.com/elalish got a reply from obj2gltf developer:

[image: image] https://user-images.githubusercontent.com/20549552/80931297-70f29b00-8deb-11ea-90c9-62110cd65bc7.png

would that work?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/model-viewer/issues/936#issuecomment-623223376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMS2LDGUWICY2L6V5CLPV3RPYMN7ANCNFSM4J4IGDLA .

lanxinger commented 4 years ago

thank you @elalish