VRML Loader - Need Help

Hi,

I try to build a VRML model loader, but I got a big lack of performance with a small model. Also, every thing it to be completed…

See : GitHub - nicrf/babylonejsVRMLLoader: Simple VRML wrapper based on ThreeJS and bartmcleod isVrmlParser

Thank

What is the performance issue? rendering speed? loading time?
if rendering time, can you share a running example somewhere so we can analyze it Spector or the inspector?

It is the render time, I got two polygon and one line and I got a really bad FPS.

You can try with the model small.wrl from the Github.

I got problem with the polygone mesh for now.

Can you repro in the Playground? I’m interested to understand what is the problem

The link : https://www.babylonjs-playground.com/#KW4LR4#1

I was not able to run in in playground.

Well to help you I certainly need a working example :slight_smile:
There must be plenty of reasons why it is slow

Perhaps you have a running version somewhere ?

Yep, clone this : GitHub - nicrf/babylonejsVRMLLoader: Simple VRML wrapper based on ThreeJS and bartmcleod isVrmlParser

Change the url of model for input.wrl to see the slow model.
BABYLON.SceneLoader.ImportMesh("", “”, “input.wrl”, scene, function (newMeshes)

Does this reproduce the behavior you were seeing?

https://www.babylonjs-playground.com/#KW4LR4#3

(Not a fix, just hopefully a repro where we can all easily look at it in the same environment. :smile:)

1 Like

Yes, I got the same behavior(performance).

Okay, cool! In that case, it looks like the importer may not be functioning exactly as intended. Take a look at that Playground with the Inspector (look for a button near the top of your browser, just above the script area). It looks to me like there are quite a few more meshes and materials in the scene than I would have expected. Perhaps some intermediate objects aren’t getting cleaned up?

image

With something like that BabylonJS Guide ?

That code’s certainly worth understanding, but I’m guessing the necessary changes are going to be a lot more invasive than that. I haven’t dived deep into the importer itself, but the source of a lot of the performance impact (I think) is that there are extraneous meshes, not just extraneous vertices within a mesh. It looks like there are also a whole lot more materials than are probably intended.

I think you’ll probably need to dig fairly deep into the importer to figure out why this is happening. Also, make sure you have an expectation of how this mesh should be imported. I took a look at the source of the WRL and it’s…elaborate… I’m not familiar enough with the format to know how that should ultimately be represented, but it might be more complex than visual inspection would indicate.

Yeah, I understand, the Vrml file structure look like GTlF. Here is the specification : http://tecfa.unige.ch/guides/vrml/vrml97/spec/

The high mesh with vertex are from FaceSetIndex (VRML97, ISO/IEC 14772-1:1997 -- 6 Node Reference), it’s a list of points and indinces. Should I build a list of all the vertexes and after build the mesh? Now, I build a single mesh for every FaceSetIndex.

Definitely as the goal is to reduce the number of draw calls

1 Like

Hi,

I found a small fix for now (LineSystem). Now the model load and I got an 60FPS. But, I got a rotation problem.

WRL file are tree model form and they use quaternion rotation. The first object is ok, but child not, if I use an basic rotation, I got a bad rotation and quaternion and rotation are not compatible(Euler Angles and Quaternions - Babylon.js Documentation).

Can some one can help me with that?

Link : https://www.babylonjs-playground.com/#KW4LR4#10

Result :


MeshLab :

Hi,

For your information, the base parser is working, you can try it (https://www.babylonjs-playground.com/#KW4LR4#14). Now, I need to rebuild the parser for a batch Mesh and Material generation for optimisation. But first, I will add the light support.

It work with small model (<50mb) for now. I need tweak performance, I need to load 500 mb model (a will add a gzip load too).

I,

I need help with that, my model are mirror (flipped), I don’t know why : https://www.babylonjs-playground.com/#KW4LR4#16

So it starts working! good news :slight_smile:

This PG: https://www.babylonjs-playground.com/#KW4LR4#16 does not work for me. Does it for you?

Hi,

It work, but the camera don’t target the model after the parsing. Here is the new version, I found my problem, wrl use right hand system : https://www.babylonjs-playground.com/#KW4LR4#17

1 Like