New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VRMLLoader problem suspected #12209
Comments
This is primarily a parsing error and can maybe fixed in the .getTree() function. The problematic file contains patterns like that:
But the loader expects it in this way:
So the break lines after |
I had spent some time in VRMLLoader before, and I don't think it can be fixed. You need to replace current method with tokenizer or some other way that would treat line breaks like other whitespace. |
Perhaps someone needs to help the author of #10371 to make 3rd PR if his parsing method is better. |
@makc Maybe there is a way to detect the above pattern with a new regular expression. Have you considered something like this? |
@Mugen87 see for yourself, I mean it's not impossible, but any "fix" like that is duct tape. It will only make things worse. #5391 All those are bad parser issues. In addition, this parser has performance problems |
At least, it is now clear why Anyway, with @makc's comment in mind the options are:
Considering that Also see: |
@mrdoob It's actually tempting to kill |
xml is only "easier to parse" in the browser. current collada loader does not work under node, for example. the project I worked in needed wrl files because - strangely enough - 3D printing software was using it. |
node.js users can try to work with https://www.npmjs.com/package/xmldom or similar projects. I have not tested it but it is more or less a replacement for the browsers native |
I also think that |
It's just sometimes people ask for server-side rendering for fall-back or whatever, and I then have to convert their daes into jsons. |
I see. May i ask how you are performing this conversion? |
I save object.toJSON() result. |
You would be surprised. There are still institutions out there using VRML beacuse it's a ISO standard. I know CERN is still using it, I don't know if that's the reason though. |
I think doing a |
Interesting. I'm actually curious why they work with
It looks like meshlab (open-source 🙌) can do this conversion, too: https://stackoverflow.com/questions/14849593/vrml-to-x3d-conversion |
I am interested in a reader for VRML because I have tools that write it. I have nothing that writes x3d so cannot see the use of a reader for it yet. My main goal is to visualise STEP in a browser, but there is nothing I can find to do that. But there are converters from STEP to VRML. |
Probably the most widely used open source CAD tool is FreeCAD, that writes VRML but not X3D. |
Is it possible to produce see https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/STLLoader.js |
also see #7125 |
This first PR does not solve the parsing problems but at least the faces of the cube are drawn correctly now. |
Yeh, STL is an option and we have that already as a place holder until we can get a full colour flow working. |
I've added a commit to the PR that should solve the parsing problems with |
Brillant! It works not just with the cube but with FreeCAD output of our more complex parts. |
How can we convert STEP file to VRML so that we can load selected STEP file in browser |
You should not use |
As discussed here this file cube.wrl.zip contains a single solid cube and loads fine in other tools, e.g. view3dscene, FreeCAD, sketchfab.
However VRMLLoader shows an empty scene. Example here
Three.js version
Browser
Chrome + Safari tested and behave the same.
OS
The text was updated successfully, but these errors were encountered: