Reply To: How to display numbers with the contours?

Home Forums AR Sandbox Forum How to display numbers with the contours? Reply To: How to display numbers with the contours?

#111006
Oliver Kreylos
Keymaster

Contour lines are generated by the surface rendering fragment shader. The exact code is in Shaders/SurfaceAddContourLines.fs. Basically, the shader detects whether a given screen pixel is intersected by at least one contour line, and if so, colors that pixel black. That’s why the contour lines can’t easily be labeled.

The base plane equation is stored in two classes, for different purposes. The DepthImageRenderer class contains the base plane equation used to generate contour lines and a bathymetry DEM for water simulation, and the ElevationColorMap class contains the base plane equation used to color-map the surface. Normally those two are the same, but they don’t need to be.

There is already a function to change the color mapping base plane dynamically. It’s exposed at the SARndbox’s pipe command interface. If you create a named pipe and attach to it with ./bin/SARndbox ... -cp <pipe name>, and then write the following to the pipe while the sandbox is running:

echo "heightMapPlane <normal x> <normal y> <normal z> <offset>"

(concrete example: echo "heightMapPlane 0.0 0.0 1.0 -95.0" to put the base plane flat at 95cm below the camera)

it will immediately change the elevation color mapping. If you want to change the contour line base elevation at the same time, call depthImageRenderer->setBasePlane() with the same plane equation from the same location in the code (inside Sandbox::frame).

In short, insert


/* Override the elevation base plane in the depth image renderer: */
depthImageRenderer->setBasePlane(heightMapPlane);

before line 1152 in Sandbox.cpp.

Comments are closed.