mrk-its / bevy_webgl2

WebGL2 renderer plugin for Bevy game engine
MIT License
172 stars 46 forks source link

GLTF objects are sometimes all blue or colored red #39

Open lights0123 opened 3 years ago

lights0123 commented 3 years ago

I'm still working on getting my game published, so I'll either get a link to you in an hour or tomorrow. I load three different GLTF files, which you can get here: assets.zip. The file ship.glb should look like this: Screenshot from 2021-04-23 22-49-21 However, sometimes, it will appear completely blue: Screenshot from 2021-04-23 22-49-36 And sometimes, colored red: Screenshot from 2021-04-23 22-49-27

It's pretty much a guessing game as to which will happen.

When this happens, the files ship.glb and Itokawa_1_1.glb (which both have images as their textures) have the same appearance, but cube.glb (which has a material defined by a single color) is completely unaffected. Additionally, any materials with a solid color created directly in Bevy are also unaffected.

This never happens natively, but I've seen it happen on FF and Chrome on Linux (Nvidia and Intel) and Windows (Intel) and Chrome on Chrome OS (Intel).

lights0123 commented 3 years ago

Demo: https://asteroids-3d.netlify.app/

mrk-its commented 3 years ago

What are the versions of bevy / webgl2?

lights0123 commented 3 years ago

Cargo.lock

[[package]]
name = "bevy"
version = "0.5.0"

[[package]]
name = "bevy_webgl2"
version = "0.5.2"
mockersf commented 3 years ago

Using your deployed app, I can see the same issue on macOS safari & firefox. But taking your model, I can't reproduce in my own code. Could you share your code with a reproducer as minimal as possible?

lights0123 commented 3 years ago

https://github.com/lights0123/asteroids_3d/tree/simple-web

lights0123 commented 3 years ago

Creating a minimal example is... difficult. I had it for a while that removing one plugin would remove the problem, but that plugin did absolutely nothing, e.g. the fn build within the impl was completely empty. And then tweaking other stuff brought it back. I'll try to cut it down a little bit further though.

lights0123 commented 3 years ago

Here's an example: commit ed5bb6e on that branch will sometimes be red or blue. Commit 4137ea4 will generally always be red—however, comment out either of these two parameters in this empty system, and the problem will now only happen intermittently.