Opticks + LHCbRich_Simplified with NVIDIA OptiX 7

Opticks + LHCbRich_Simplified with NVIDIA OptiX 7

Open source, https://bitbucket.org/simoncblyth/opticks

Opticks replaces Geant4 optical photon simulation with an equivalent implementation that benefits from state-of-the-art GPU ray tracing from NVIDIA OptiX. All optically relevant aspects of Geant4 context must be translated+copied to GPU:

  • geometry : solids, structure, material+surface properties
  • generation : Cerenkov + Scintillation (using Gensteps from Geant4)
  • propagation : Rayleigh scattering, absorption, reemission, boundary
  • transformative performance benefits >1000x Geant4

Fast Render => Fast Simulation (same ray tracing bottleneck)

  • Optimization : vary included geometry, measure render times
    • look for bottleneck geometries

Simon C Blyth — Feb 27, 2022


Shortlived Fork of 4ed756b9d72df3a615

#!/bin/bash

# logging control
export X4PhysicalVolume=INFO
export GMeshLib=INFO

# alt geometry mode
export RichTbLHCbR1SphMirror_mode=1
export RichTbLHCbR1FlatMirror_mode=1

TimeTest

Steps for producing OptiX 7 renders

  1. update opticks
cd ~/opticks
git pull
oo        # update builds opticks (not OptiX 7 build)
  1. run TimeTest to create Opticks geocache geometry
    • get key from logging : "export OPTICKS_KEY=TimeTest.X4PhysicalVolume.WorldPhys.a7810..."
    • copy the export into eg ~/.bashrc
  2. translate geometry from GGeo (pre 7) into CSGFoundry (OptiX 7)
cd ~/opticks/CSG_GGeo    # OR "cg" shortcut
./run.sh
  1. now build and run OptiX 7 render scripts
cd ~/opticks/CSGOptiX
oo                     # update opticks build
opticks-build7         # OR "b7" shortcut (builds only CSGOptiX)

;: will need to set some envvars to find OptiX7 install

cxr_view.sh : OptiX 7 Render

All following renders use cxr_view.sh script and CSGOptiXRenderTest binary

NVIDIA OptiX 7 build and run:

cd ~/opticks/CSGOptiX         ;:  OR  "cx" shortcut function
opticks-build7                ;:  OR "b7" shortcut function
MOI=WorldBox ./cxr_view.sh    ;: creates .jpg and .json files

OptiX launch time at bottom left of render image and in sidecar .json

CSGOptiXRenderTest view control envvars

EYE, LOOK, TMIN are in units of the extent of target geometry

MOI=WorldBox
pick target geometry using G4VSolid name
EYE=1,0,0
eye position
LOOK=0,0,0
point where the gaze is directed
UP=0,0,1
up vector (+Z default)
CAM=0
0: perspective (default) 1: orthographic
TMIN=0.5
ray tmin : cutaway sphere(plane) in perspective(orthographic) projection
ZOOM=4
changes field of view

cxr_view___eye_1,-2.2,0__zoom_1__tmin_0.4_RichTbR1MagShBox_box_two_mirr.jpg

EYE=1,-2.2,0 MOI=RichTbR1MagShBox   ./cxr_view.sh

cxr_view___eye_0,1,0__zoom_1__tmin_0.5_RichTbR1MagShBox.jpg

EYE=0,1,0 MOI=RichTbR1MagShBox TMIN=0.5 ./cxr_view.sh












circular "window" is due to TMIN=0.5 sphere cutting, in perspective projection

cxr_view___eye_0,-1,0__zoom_1__tmin_0.5_RichTbR1MagShBox_backview.jpg

EYE=0,-1,0 MOI=RichTbR1MagShBox  TMIN=0.5 ./cxr_view.sh













Vertical black line artifact (appears when view precisely from -Y)

cxr_view___eye_0,-2.2,0__zoom_1__tmin_0.4_RichTbR1MagShBox_two_mirr_and_box.jpg

EYE=0,-2.2,0 MOI=RichTbR1MagShBox   ./cxr_view.sh

cxr_view___eye_1,0,0__zoom_1__tmin_0.4_RichTbR1MagShBox_sideview_of_detelem.jpg

EYE=1,0,0 MOI=RichTbR1MagShBox ./cxr_view.sh













TMIN=0.4 default cuts into the boxes

cxr_view___eye_1,0,0__look_0,0.1,0.1__zoom_10__tmin_0.96_WorldBox_side_mirr_and_box.jpg

EYE=1,0,0 LOOK=0,0.1,0.1 MOI=WorldBox CAM=1 ZOOM=10 TMIN=0.96 ./cxr_view.sh













CAM=1 TMIN=0.96 plane cutaway of side of box (plane as CAM=1 orthographic)

cxr_view___eye_10,20,0__zoom_1__tmin_0.4_R1PmtMasterBox_diag_det.jpg

MOI=R1PmtMasterBox EYE=10,20,0 ./cxr_view.sh