[x3d-public] taste of X3D-BabylonJS converter/viewer

Andreas Plesch andreasplesch at gmail.com
Mon Dec 13 21:52:59 PST 2021


I am interested in using BabylonJS, similar to ThreeJS, as a simple
web based X3D viewer since it has all the latest rendering features,
and a well supported code base and community.

First, I am just looking at Shapes, no events or anything dynamic.
Here is a first impression:

https://observablehq.com/@andreasplesch/x3d-babylon-viewer/2

Checkout out the node inspector. It is nice and could also provide
some inspiration.

Basic geometry and ITS as well as IFS work, as well as basic material
and diffuse image texture. Background, Viewpoint, headlight and a few
light types are also working. DEF/USE is also somewhat supported but
has to be tweaked for node types since Babylon has various kinds of
instancing for shapes, but other objects have to be shared by
referencing on a JS level. The converter works by constructing a BJS
scene, as intended, and then serializing to their JSON format which
supports most features. There will need to be some postprocessing
after importing back to reestablish some DEF/USE object references in
memory.

I think after adding Extrusion and ElevationGrid, this could already
be useful for static uses. Not sure about Inline as it will require
namescopes and invoking the parser from itself which ObservableHQs
reactive dataflow may not like. One idea which came up in BJS forum
was to hand code dynamic features around the imported Shapes (Meshes).

I am using ObservableHQ for rapid development/testing for now.
BabylonJS itself is TypeScript which will be an  interesting option.



-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list