Reply To: Add to the visuals

Home Forums AR Sandbox Forum Add to the visuals Reply To: Add to the visuals

#101183
Oliver Kreylos
Keymaster

Color mapping is done via a GLSL shader. This particular shader is programmatically generated inside SurfaceRenderer.cpp, and compiled on-demand. To modify it, you have to embed GLSL code into the C++ code via string manipulations.

Look at line 310 in SurfaceRenderer.cpp:

vec4 baseColor=texture1D(heightColorMapSampler,heightColorMapTexCoord);\n\

This is where the fragment shader queries a color from the height color map texture based on the fragment’s elevation relative to the base plane. This is where you would add code to check the fragment’s elevation against your upper and lower bounds, and, if it lies inside, get the base color from a second 2D texture image based on the fragment’s (x, y) position instead of the 1D color map texture.

You would then also have to add code to create and manage that 2D texture, upload it to an unused texture unit before shader execution, and add a uniform sampler variable to the shader to access the texture image.

Comments are closed.