mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
100.67k stars 35.22k forks source link

VRML Example Doesn't Work on Safari after r106 #16919

Closed ghost closed 5 years ago

ghost commented 5 years ago
Description of the problem

Example just results in a black screen with the following error:

image

Also, the VRML files I've been working with stopped parsing correctly on all browsers with the new dependency added, but that's probably for a separate issue.

Three.js version
Browser
OS
Mugen87 commented 5 years ago

I'll have a look.

BTW: Can you also share one of the WRL files that don't work in other browser?

ghost commented 5 years ago

Here's a gist with the .wrl file contents.

It seems all other .wrl files exported from this application (Helitronic Tool Studio) also fail in the same way.

Mugen87 commented 5 years ago

The PR closed the issue but I still looking for your WRL file 👍

Mugen87 commented 5 years ago

The general Safari issue is fixed in dev:

https://raw.githack.com/mrdoob/three.js/dev/examples/webgl_loader_vrml.html

It was necessary to change one of the regular expression since it was not evaluated correctly in Safari! Crazy stuff...

ghost commented 5 years ago

Awesome, thank you! 🙏

Mugen87 commented 5 years ago

I've investigated the other VRML file and found a strange issue. Some shape definitions contain no definition of coord and coordIndex:

Shape {
      appearance Appearance {
        material Material {
          diffuseColor 0.700 0.700 0.700 
          ambientIntensity 0.500 
          specularColor 0.500 0.500 0.500 
          shininess 0.500 
          transparency 0.000 
        }
      }
      geometry IndexedFaceSet {
        color Color {
          color [
            0.435 0.000 1.000
          ]
        }
      }
    }

Geometries like this are not valid since the actual vertex data are missing. In other words, you can't render a geometry with just its color data. So this looks like a bug in the exporter of your content creation tool.

May I ask, how should the model ex-2.wrl look like? Can you share a screenshot of the intended result?

ghost commented 5 years ago

This is what it looks like loaded in r105. Also works by dragging the file (or any file exported by the program) into the r105 editor.

image

And just to verify it works, I copied the gist I posted earlier into a new file and loaded it to make sure the contents are the same.

mrdoob commented 5 years ago

I'll update gh-pages.

mrdoob commented 5 years ago

Done!

mrdoob commented 5 years ago

Still getting this error with ex-2.wrl in https://threejs.org/editor/ though...

Screen Shot 2019-06-27 at 4 21 52 PM
Mugen87 commented 5 years ago

I was able to load ex-2.wrl with the last PR. The loader is now a bit more fault-tolerant. However, it logs a warning to notify about the missing geometry data.

ghost commented 5 years ago

Awesome, it works now. Just one minor problem, is that the material reproduction might be off. It's an easy fix though, I just need to change each material's shininess, specular, and emissive props to match the original. This is probably a result of the new loader more closely adhering to the VRML spec, right?

Screen Shot 2019-06-28 at 10 28 48 AM

r105 on the left, dev/r106.x on the right

Mugen87 commented 5 years ago

This is probably a result of the new loader more closely adhering to the VRML spec, right?

Yes, the loader implements the VRML spec more strictly than before. That was also the reason why your geometries could not processed in the first place.