# RayTracerX not available

**URL:** <https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582>\
**Category:** Recording, Visualizing and Persisting Data\
**Created:** [May 17, 2023, 7:14am UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582 "2023-05-17T07:14:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmori](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/nmori/32/6325_2.png) [@nmori](https://geant4-forum.web.cern.ch/u/nmori)\
**Post date:** [May 17, 2023, 7:14am UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/1 "2023-05-17T07:14:30Z")

</div>

I built G4 11.0.2 enabling the RayTracerX visualization; here’s the configuration taken from the output of ccmake:

```auto
 GEANT4_BUILD_MULTITHREADED OFF
 GEANT4_INSTALL_DATA ON
 GEANT4_INSTALL_DATADIR           
 GEANT4_USE_G3TOG4 OFF
 GEANT4_USE_GDML ON
 GEANT4_USE_INVENTOR OFF
 GEANT4_USE_INVENTOR_QT OFF
 GEANT4_USE_OPENGL_X11 OFF
 GEANT4_USE_PYTHON OFF
 GEANT4_USE_QT ON
 GEANT4_USE_RAYTRACER_X11 ON
 GEANT4_USE_SYSTEM_CLHEP OFF
 GEANT4_USE_SYSTEM_EXPAT ON
 GEANT4_USE_SYSTEM_ZLIB OFF
 GEANT4_USE_TBB OFF
 GEANT4_USE_TOOLSSG OFF
 GEANT4_USE_XM OFF

```

I guess it’s ok since `GEANT4_USE_RAYTRACER_X11` is `ON`. The installed library seems to effectively contain the RayTracerX stuff:

```auto
$ nm /home/mori/software/install/GEANT4_11.0.2/lib/libG4RayTracer.so | grep RayTracerX
6:0000000000022390 T G4RayTracerXScannerWaitForNotify
42:0000000000013aa0 t _GLOBAL__sub_I_G4RayTracerX.cc
43:0000000000013b70 t _GLOBAL__sub_I_G4RayTracerXViewer.cc
169:0000000000021f30 T _ZN12G4RayTracerX12CreateViewerER15G4VSceneHandlerRK8G4String
170:0000000000012cbc t _ZN12G4RayTracerX12CreateViewerER15G4VSceneHandlerRK8G4String.cold
171:0000000000021ef0 T _ZN12G4RayTracerX18CreateSceneHandlerERK8G4String
172:0000000000012ca6 t _ZN12G4RayTracerX18CreateSceneHandlerERK8G4String.cold
173:0000000000022010 T _ZN12G4RayTracerXC1Ev
. . .

```

and it is correctly linked to my executable:

```auto
$ ldd `which GGSPenny` | grep RayTracer
19: libG4RayTracer.so => /home/mori/software/install/GEANT4_11.0.2/lib/libG4RayTracer.so (0x00007fd7ac3eb000)

```

Still I cannot start the RayTracerX visualizer: when issuing the `/vis/open RayTracerX` command I get this error:

```auto
parameter value (RayTracerX) is not listed in the candidate List.
  Candidates are: ASCIITree ATree DAWNFILE G4HepRepFile HepRepFile RayTracer VRML2FILE gMocrenFile OpenGLImmediateQt OGLIQt OGLI OpenGLStoredQt OGLSQt OGL OGLS

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
      issued by : G4UImanager::ApplyCommand
Invoked command has failed - see above. Available graphics systems are (short names):
  ATree DAWNFILE HepRepFile OGL OGLI OGLIQt OGLS OGLSQt RayTracer VRML2FILE gMocrenFile
Error code : 500
***This is just a warning message.***
-------- WWWW -------- G4Exception-END --------- WWWW -------

command refused (500):"/vis/open RayTracerX"

```

I never used the RayTracerX before and I didn’t modify my code to make use of it, since as far as I understand no viewer-specific code paths are needed in user software.  
Am I missing something?

---

<div class="post-metadata">

**Author:** ![bmorgan](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/bmorgan/32/7_2.png) [@bmorgan](https://geant4-forum.web.cern.ch/u/bmorgan)\
**Post date:** [May 17, 2023, 8:27am UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/2 "2023-05-17T08:27:05Z")

</div>

Could you try rebuilding your executable and check that the compile commands include the `-DG4VIS_USE_RAYTRACERX` flag please? If you’re using `G4VisExecutive`, that flag is needed to enable the use of `RayTracerX`. The flag should be added automatically by CMake etc, but it’s worth checking as the libraries are clearly built with RayTracerX support.

---

<div class="post-metadata">

**Author:** ![nmori](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/nmori/32/6325_2.png) [@nmori](https://geant4-forum.web.cern.ch/u/nmori)\
**Post date:** [May 17, 2023, 10:10am UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/3 "2023-05-17T10:10:15Z")

</div>

I didn’t have the `vis_raytracer_x11` component specified in the optional components list of `find_package`, adding it and rebuilding my application the error vanished and the RayTracerX window shows as expected. Thanks @bmorgan !

---

<div class="post-metadata">

**Author:** ![nmori](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/nmori/32/6325_2.png) [@nmori](https://geant4-forum.web.cern.ch/u/nmori)\
**Post date:** [May 17, 2023, 10:40am UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/4 "2023-05-17T10:40:03Z")

</div>

I have another problem now: I get these errors in the console:

```auto
WARNING: G4RayTracerViewer::DrawView: true orthogonal projection
  not yet implemented. Doing a "long shot", i.e., a perspective
  projection with a half field angle of 1e-06 radians.

```

and a garbage detector image. I tried to change the viewpoint with:

```auto
/vis/viewer/set/viewpointVector 1 1 0

```

but this didn’t help. So how can I fix the warning?

---

<div class="post-metadata">

**Author:** ![allison](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allison](https://geant4-forum.web.cern.ch/u/allison)\
**Post date:** [May 17, 2023, 6:06pm UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/5 "2023-05-17T18:06:33Z")

</div>

Hi, The WARNING is nothing to worry about. But in what sense “garbage detector image”? How?

---

<div class="post-metadata">

**Author:** ![nmori](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/nmori/32/6325_2.png) [@nmori](https://geant4-forum.web.cern.ch/u/nmori)\
**Post date:** [May 18, 2023, 6:29am UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/6 "2023-05-18T06:29:45Z")

</div>

Hi John, this is the detector image produced by the OGL visualizer:

 ![Screenshot_20230518_082401](https://geant4-forum.web.cern.ch/uploads/default/original/2X/a/ad040d209f83c02d8ed0b8c37c3c1a4fbed65f85.png)  
The black element is a tray imported from a GDML file and filled with cubic gray cubes. This same geometry is rendered by RayTracerX as:  
 ![Screenshot_20230518_082459](https://geant4-forum.web.cern.ch/uploads/default/original/2X/0/0b78dd7ea1150c59841028a76d27be8cd47c1f4e.png)  
During the rendering the X window shows something like this:  
 ![Screenshot_20230518_082452](https://geant4-forum.web.cern.ch/uploads/default/original/2X/d/d05be28e522d4655112b0041899873405c808576.png)  
which turns to the flat gray image at the end. This is the visualization macro I am using for both images:

```auto
/tracking/storeTrajectory 1
/vis/open RayTracerX 600x600-0+0
#/vis/open OGL 600x600-0+0
/vis/verbose errors

/vis/drawVolume
/vis/viewer/set/upVector 0 0 1
/vis/viewer/set/viewpointVector 1 -1 0
/vis/viewer/zoom 20

/vis/viewer/flush

```

Maybe there is something wrong with it?

---

<div class="post-metadata">

**Author:** ![allison](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allison](https://geant4-forum.web.cern.ch/u/allison)\
**Post date:** [May 19, 2023, 12:51pm UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/7 "2023-05-19T12:51:25Z")

</div>

Hi

Be aware RayTracer will render surfaces. It does not recognise wireframe.

I don’t see anything “garbage” about the OGL image. Could you be a little more precise about your problem?

Cheers, John

---

<div class="post-metadata">

**Author:** ![nmori](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/nmori/32/6325_2.png) [@nmori](https://geant4-forum.web.cern.ch/u/nmori)\
**Post date:** [May 19, 2023, 2:06pm UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/8 "2023-05-19T14:06:02Z")

</div>

Hi,

my problem is that I’d like to render the detector with RayTracer(X) since OGL produces [this kind of artifacts](https://geant4-forum.web.cern.ch/t/boolean-solids-and-precision/10577). These artifacts are not visible in the OGL image posted above, but become visible when incrteasing the zoom level to very high values.  
“Garbage” was not relative to the OGL image but to the RayTracer one, which is a flat gray field. But I understand that it could be the outcome of the geometry being a tessellated solid imported from GDML, right? I didn’t imagine RayTracer had problems with that since I read that it “can render any geometry that Geant4 can handle” (see [this presentation](https://indico.cern.ch/event/294651/sessions/55918/attachments/552022/760637/Visualisation.pdf), slide 60).

---

<div class="post-metadata">

**Author:** ![evc](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/evc/32/862_2.png) [@evc](https://geant4-forum.web.cern.ch/u/evc)\
**Post date:** [May 19, 2023, 2:51pm UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/9 "2023-05-19T14:51:40Z")

</div>

The top level shape can be defined without using union, see G4ExtrudedSolid.

---

<div class="post-metadata">

**Author:** ![nmori](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/nmori/32/6325_2.png) [@nmori](https://geant4-forum.web.cern.ch/u/nmori)\
**Post date:** [May 19, 2023, 4:40pm UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/10 "2023-05-19T16:40:37Z")

</div>

Thank you, I’ll look into it and use the extruded solid instead of the boolean.

---

<div class="post-metadata">

**Author:** ![system](https://geant4-forum.web.cern.ch/uploads/default/original/1X/ce519a43ebdf7ac48a98a03c6ad6eea013b68c46.png) [@system](https://geant4-forum.web.cern.ch/u/system)\
**Post date:** [May 26, 2023, 4:40pm UTC](https://geant4-forum.web.cern.ch/t/raytracerx-not-available/10582/11 "2023-05-26T16:40:48Z")

</div>

Closed on May 26, 2023, 4:40pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
