Skip to content

mcdisplay webgl

Peter Willendrup edited this page Mar 16, 2017 · 6 revisions

This version of mcdisplay features a webgl visualization of instruments and particle rays. mcdisplay-webgl is intended to be an instructive and immersive visualization, as well as a method of validation, to be applied while writing or editing instruments. It can be quickly run by a menu option in mcgui.

During the mcdisplay trace run, a few files are written into a subfolder. This is done in a completely self-contained and portable way, making the result viewable in any modern browser, offline or hosted. (The particle rays are thus fixed after this step.)

View controls: Drag the instrument using the right mouse button (meta-click on some platforms) to center the area you wish to view in greater detail. Zoom in on a detail using the mouse-wheel/scroll, and rotate around the detail by dragging with the left mouse button. Reset the view using the buttons "Home", "Side" or "Top" at the top of the mcdisplay page (not shown above).

Ray colouring: The colours of the rays reflect particle momentum, but in a somewhat arbitrary way. The min and max values for the colour range are determined dynamically.

Ray statistics indication: Check "Keep rays" to accumulate particle rays in the view. Hereby you get a visualization of the typical paths through the instrument of rays, and of rays of varying energies, since these are coloured by (some monotonous functions of) energy. You can even change the colour map by editing the file _mcdisplay.js - search for "color maps".

Note that the folder and html/js data generated by mcdisplay-webgl is fully transportable and viewable in most browsers, including on smartphones and tablets. Hence it provides an easy way to share 3D information about your instrument with colleagues, see e.g. this webpage: http://ess_butterfly.mcstas.org/visualisation/

Clone this wiki locally