Edges and wireframes not drawn in vectorized output?

I’m using geant 10.6.p02 on CentOS7. When I try to visualize my detector geometry, everything renders how I would expect in the live viewing window, using any of OGLIX, OGLSX, OGLIQt. However, when I try to save the render, edges and wireframes do not show up in vectorized output, even though trajectories do!

These example images were made with example B1, running the executable without any macro, then changing the style to wireframe in the Qt GUI that comes up. The files were made by right-clicking on the Qt window and going to Actions->Save. The PNG image, which is shown inline, is a reasonable representation of the view window, but the PDF has no wireframe lines. But I have tested producing the output directly with /vis/ogl/export using pdf, ps, and eps formats; none of them display wireframes in the output!

test2._0000.pdf (52.5 KB)

Is this a known effect that I’ve just missed in the documentation?

In a related question, if I could create PNG images that would be OK for now, but I don’t see any macro command to do so. /vis/ogl/export will only take vector formats, and there isn’t a subtree under /vis for Qt for me. I can save png’s by right-clicking on the Qt GUI, but I’m trying to draw several views at once, so need a way to programmatically trigger, ideally with macro commands.

Hi

You’re right - there are issues with .pdf, .eps, and related formats provided by our distribution of gl2ps. In particular, B1 gives trouble because it has a transparent volume.

Plain OpenGL (e.g., OGLSX) relies on gl2ps and the formats are limited. To see available formats, /vis/ogl/set/exportFormat (with no argument, as suggested in the command guidance), you get

Current formats availables are : eps ps pdf svg

If you open OpenGL in the Qt GUI (say OGLSQt), /vis/ogl/set/exportFormat gives:

Current formats availables are : eps ps pdf svg bmp cur heic heif icns ico jp2 jpeg jpg pbm pgm png ppm tif tiff wbmp webp xbm xpm

The additional formats come from Qt. In fact, in Release 11, we have made .jpg the default format for OpenGL windows in the Qt GUI; the motivation for that is: (a) modern screens give good resolution, so a pixmap is often adequate; (b) it is faithful; (c) with complex geometries and trajectories, pdf files can become enormous. I’d be interested in your thoughts on that. For example, does png make more sense than jpg as a default?

I think the above answers your “related question”. If I have understood correctly, you can use /vis/ogl/set/exportFormat,

John

Hi John,

Thanks for the quick response! Using the Qt renderer expands the list of available export formats. It would be useful to put a note in the user’s guide about the known issue with the native OGL renderer.

For my current purposes, png and jpg are roughly equivalent as they both let me render the wireframes. I’m not a graphics export, but I do think png is a better default than jpg. My understanding is that jpg compression does poorly near sharp borders, which simple geometries will have many of. I don’t know if you can see in this screenshot, but the jpg rendering (top right) of my wireframe image (top left) has some compression artifacts, and doesn’t reproduce the colors as faithfully as the png (bottom right), and the file is bigger (though both are small enough in this case not to matter). I’m not sure if the story changes for very complex geometries, but I would guess that usually just means more sharp edges, so the jpg might do even worse comparatively.

Seems I maybe spoke too soon. There are two issues:

First, the Qt vis drivers aren’t available in batch mode (e.g., /vis/open OGLSQt falls back to one of the OGL modes). It seems the UIExecutive needs to be instantiated. An annoying surprise, but easy enough to work around.

More seriously, the scene apparently doesn’t render before export takes the screenshot, resulting in a black image. Taking example B1, if I edit the vis.mac file to use OGLSQt and then add the following lines at the end:

/vis/viewer/flush
/vis/ogl/set/exportFormat png
/vis/ogl/export test

then run ./exampleB1 without arguments, I get a black test_0000.png file. Then if I type
/vis/ogl/export test
in the Qt GUI, I get test_0001.png with the scene rendered as expected. So it seems I need some way to force the viewer to draw to the screen before saving the file, but flush is not accomplishing that.

Hi Ben

Ah, yes. Batch mode. Yes, OGLSQt is not available. One option is to render to file - DAWNFILE, VRML2FILE, HepRepFile - and browse and export offline.

We do have some further ideas for “off-screen rendering” which will hopefully out this year.

Thanks for your input on jpg v. png.

John

1 Like