Closed javagl closed 7 years ago
This viewer isn't meant to do anything but pass the files into THREE.GLTF2Loader. Are you seeing a different result than when testing against threejs directly?
The reason why I used the viewer was that I hoped to avoid setting up everything locally.
(Downloading the few-hundred-MB (!) threejs repo, building it, sneaking it into a locally running webserver ... the same for BabylonJS, to have a committee... I just wanted to test some models quickly, and I'm lazy :-) but also not deeply familiar with JavaScript etc, so hoped I could avoid this and quickly get some results).
But I see that this may not be your issue, in this regard, so I'll close this.
(Now, I could allocate some time for setting up the JavaScript-based viewers, or continue with my Java-based viewer - decisions, decisions....)
Ok yes, that's why I made the viewer too. 😉
I think I would assume that if any part of a file is displayed in the viewer, that the viewer has given that file correctly to GLTF2Loader, and bugs would be in three.js / GLTF2Loader. If there were an entire texture file missing, that would more likely be a bug in the viewer.
In any case this looks like a bug in THREE.GLTF2Loader, so we will look at it there.
Sure. If you had answered here with "Yes, this is a known issue", I wouldn't have to do this, but now, I also consider having a look at the THREE loader. There's some learning curve involved, though. Although I recently read+wrote a few lines of JavaScript, there are still a few impediments for me to productively contribute at this point. Among others...
the tendency of JavaScript to be written in a very sloppy way. No offense to anyone, but
if ( material.pbrMetallicRoughness !== undefined ) {
...
if ( material.pbrMetallicRoughness !== undefined ) {
...
}
}
just looks confusing, and methods with >500 LOC and a ridiculous nesting depth of 12 (!) tabs are not something that I'm eager to dive into, to be honest....
I don't mean to say that you need to debug three.js code yourself, I'm very happy to do that. Agreed that it's difficult to dive into, and this code is not the cleanest. Just that since we're already tracking most issues with THREE.GLTF2Loader in the three.js repo, I'd like to keep reporting any issues we find there. Sorry if it is unclear what could be a bug with the viewer vs. a bug in the three.js loader. Report bugs wherever it makes sense to you and we can redirect them if needed.
As for whether this is a known issue, no, this is the first I've heard of it. So thank you for reporting it!
Hm so I'm testing this out now, and the model's primitive doesn't contain any reference to the mesh. Is this a hand-generated model or should I report it somewhere else?
(if I fix that, it loads as black, so there may be more bugs to fix on my side too...)
Going to re-open this bug, maybe it's as good a place as any to have the issue after all.
You're right, there is no reference from the primitive to the material. Stupid me. Apologies for bothering you.
(Without a material, it should be rendered as a uniformly gray object, but that's only a minor thing)
For me, it is rendered as black only in the "None"-Enviroment. In the others, it appears yellowish-golden.
(The effect of the "shiny gold" may not be visible, though: The model does not have normals. It was supposed to be a 2.0 version of the https://github.com/javagl/glTF-Sample-Models/tree/master/2.0/SimpleMaterial, which should show the simplest possible material (only setting the emissive color). However, for 2.0 and PBR, it might make more sense to start with a model that does contain normals, even for the simplest case)
In view of https://github.com/KhronosGroup/glTF-Sample-Models/issues/53 I wanted to update the remaining (material-related) simple test models to glTF 2.0, but already got stuck with the first one. This model https://github.com/javagl/glTF-Sample-Models/blob/c25938698c36c7530d2572725de4bafc894c0985/2.0/SimpleMaterial/glTF-Embedded-buffer/SimpleMaterial.gltf (it should be complete and "standalone") seems to be displayed as a gray, semi-transparent triangle, although it should be a "gold" material.
Is the viewer supposed to support textureless materials?
(This was tested on FireFox 52.1.1. In Chrome, nothing is displayed at all, but that may be due to being an old version of Chrome - I'll test it with a newer one later. The BabylonJS viewer doesn't display anything either, ... these are basically different flavors of what I referred to in https://github.com/KhronosGroup/glTF-Sample-Models/issues/53#issuecomment-298900241 ...)