Babylon viewer with RHS and multiple root transforms

I would like to use the Babylon viewer as it is very configurable. Here is a PG with the scene I would like to use:

https://playground.babylonjs.com/#58T0JY#22

And here is a simple default Viewer configuration:

There are two problems:

  • the viewer uses a LHS scene but the model is intended for RHS
  • the viewer collapses all root transforms, essentially ignoring them.

Are the configuration options which may address these problems ?

Adding @RaananW the father of the viewer

Thanks. Handedness in the viewer appears to be addressed by serialization of scene.useRightHandedSystem:

It may work to group everything under a single no-op root transform although I hope that is not necessary.

First, to the RHS. Anything you pass to scene.flags will be used to extend the scene. And though it is not a part of the declaration file, RHS can be used as well so adding:

...
scene: {
   ...
   flags: {
      useRightHandedSystem: true
   }
}

to your configuration (or use the HTML-configuration option, of course!) will work. Like this:

Not sure why it all collapsed like that. TBH - I am not sure how to edit the HTML on the demo you provided. it seems to be importing the other demo, but I can’t change it directly there.

1 Like

Thanks. Here is a codepen to edit, now using the scene.flags option:

Any thought how to avoid the collapsing ?

The viewer is using ImportMesh, which fails in the playground as well - load rhs babylon | Babylon.js Playground (babylonjs.com)

It doesn’t take the scene configuration from the file but was meant to only import the meshes from the serialized data. How are you defining the transform nodes? could you, just as a test, convert them to meshes?

Ok, that explains it. It really is a mesh viewer rather than a scene viewer. I was just hoping that there is an option for scenes.

Here is the node graph in the inspector:
image
The Transform nodes are created and then the meshes parented to them, nothing special. The scene is created from parsing a recipe (another 3d standard). That can contain an arbitrary transform hierarchy, so I need to use Transform nodes.

It sounds like Transform nodes would be ignored in general, so grouping everything under a single Transform node would not help. Only mesh transforms may be preserved.

I would be looking for an option in the viewer to use .SceneLoader.Load which may not be a goal for the Viewer as it focuses on nice presentation of single models.

I probably can figure out another way for have a simple scene viewer if Viewer is not targeted that way.

Hi @andreasplesch just checking in, do you have any more questions about this? :slight_smile:

Thanks. I ended up doing a simple scene viewer based on SceneLoader in observablehq:

It is not too difficult to do that, so a dedicated Scene Viewer rather than Model Viewer may not be needed.

2 Likes