Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 2.74 KB

geometry-tips.md

File metadata and controls

43 lines (32 loc) · 2.74 KB

Geometry tips and tips

This guide is intended to provide some tips on creating an experimental geometry for use within Phoenix.

At the time of writing, the threejs recommended geometry format is gltf (GL Transmission Format) or glb (the binary version of gltf). See this threejs documentation for details.

One big advantage of gltf/glb is Phoenix can use the embedded GLTF scenes to populate the geometry menu. So rather than having a lot of separate files for the different parts of an experiment, and then adding them individually to the top level scene and UI one-by-one e.g.:

    this.eventDisplay.loadGLTFGeometry(
      'assets/geometry/barrel.gltf',
      'Barrel',
      'Inner Detector',
      1000
    );
    this.eventDisplay.loadGLTFGeometry(
      'assets/geometry/end-cap.gltf',
      'Endcap',
      'Inner Detector',
      1000
    );

you can instead load one file, and Phoenix will loop over the internal structure and create the appropriate geometry UI entries. See the LHCB interactive example for how this works in practice (specifically, lhcb.component.ts is where the geometry is loaded).

It is also discussed here.

Creating gltf/glb content

Blender

Blender is an incredibly powerful free tool to create 3D content. It also has an comprehensive set of importers and exporters (including an gltf exporter, obviously) meaning you can load content from almost any format and save it as compressed glb. It also understands scenes (see the Blender documentation for more), so you can load many different geometry files, put them in their own scenes and export, and then Phoenix will fill the geometry UI menu for you as described above.

  • N.B. When exporting content from Blender it is very important that you remember to Apply all transformations - otherwise you can be in the situation that your geometry looks perfect inside Blender, but is the wrong size/rotation when viewed in Phoenix.

From ROOT or GDML

Read this guide for how to convert from gdml or ROOT to gltf.

Converting gltf to glb

Converting a gltf to glb, especially compressed glb, can lead to huge reductions in size (see #530 for an example).

The recommended way to do this is with the gltf-pipeline command line tool e.g.:

gltf-pipeline -i LHCb.gltf -o LHCb.glb -d