Add to the visuals

Home Forums AR Sandbox Forum Add to the visuals

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #101167


    I have the Sandbox up and running. Works perfectly.

    I would like to add something to the software. Two things actually, but focusing on one for now.

    I need to make it so that it renders everything between an upper and lower depth limit with a particular texture, I’m more or less familiar with how to do such a thing in OpenGL and C++, but I’m not sure how to read the Kinect to determine the depth or exactly which of the included files to do this in. Any help you could provide would be greatly appreciated.

    Oliver Kreylos

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Comments are closed.