esp::gfx::TextureVisualizerShader class

A shader to visualize the depth buffer information.

Public types

enum (anonymous): Magnum::UnsignedInt { ColorOutput = Magnum::Shaders::GenericGL3D::ColorOutput }
enum class Flag: Magnum::UnsignedShort { DepthTexture = 1 << 0, ObjectIdTexture = 1 << 1 }
Flag.
using Flags = Corrade::Containers::EnumSet<Flag>

Constructors, destructors, conversion operators

TextureVisualizerShader(Flags flags) explicit
Constructor.

Public functions

auto setColorMapTexture(Corrade::Containers::ArrayView<const Magnum::Vector3ub> colorMap, float offset, float scale, Magnum::GL::SamplerWrapping sampleWrapHandling, Magnum::GL::SamplerFilter filterType) -> TextureVisualizerShader&
Build the colorMapTexture_ based on the passed colorMap of colors.
auto setColorMapTransformation(float offset, float scale) -> TextureVisualizerShader&
Offset and scale applied to each input pixel value from depth texture or the ObjectId texture, resulting value is then used to fetch a color from a color map bound with bindColorMapTexture(). Here we use either the Magnum built-in color map: Magnum::DebugTools::ColorMap::turbo(), or a synthesized map based on semantic scene descriptor-specified vertex colors;.
auto bindDepthTexture(Magnum::GL::Texture2D& texture) -> TextureVisualizerShader&
Bind depth texture. It can only be called when Flag::DepthTexture is set.
auto bindObjectIdTexture(Magnum::GL::Texture2D& texture) -> TextureVisualizerShader&
Bind object Id texture. It can only be called when Flag::ObjectIdTexture is set.
auto setDepthUnprojection(const Magnum::Vector2& depthUnprojection) -> TextureVisualizerShader&
Set the depth unprojection parameters directly. It can only be called when Flag::DepthTexture is set.
auto rebindColorMapTexture() -> TextureVisualizerShader&
rebind internal color map texture. NOTE: this must be called when shaders have been switched.

Protected variables

Flags flags_
Magnum::GL::Texture2D colorMapTexture_
GLint colorMapOffsetScaleUniform_
GLint depthUnprojectionUniform_

Enum documentation

enum esp::gfx::TextureVisualizerShader::(anonymous): Magnum::UnsignedInt

Enumerators
ColorOutput

Color shader output. Generic output, present always. Expects three- or four-component floating-point or normalized buffer attachment.

enum class esp::gfx::TextureVisualizerShader::Flag: Magnum::UnsignedShort

Flag.

Enumerators
DepthTexture

visualize depth texture

ObjectIdTexture

visualize object-id texture (semantic info)

Function documentation

TextureVisualizerShader& esp::gfx::TextureVisualizerShader::setColorMapTexture(Corrade::Containers::ArrayView<const Magnum::Vector3ub> colorMap, float offset, float scale, Magnum::GL::SamplerWrapping sampleWrapHandling, Magnum::GL::SamplerFilter filterType)

Build the colorMapTexture_ based on the passed colorMap of colors.

Parameters
colorMap The map of colors to use
offset
scale
sampleWrapHandling Whether queries exceeding the length of colorMap will use the final color, or will wrap around on the texture.
filterType Type of filter to use for when pxl size is incompatible with texture size. Options are Magnum::GL::SamplerFilter::Nearest or Magnum::GL::SamplerFilter::Linear.
Returns Reference to self (for method chaining)

TextureVisualizerShader& esp::gfx::TextureVisualizerShader::setColorMapTransformation(float offset, float scale)

Offset and scale applied to each input pixel value from depth texture or the ObjectId texture, resulting value is then used to fetch a color from a color map bound with bindColorMapTexture(). Here we use either the Magnum built-in color map: Magnum::DebugTools::ColorMap::turbo(), or a synthesized map based on semantic scene descriptor-specified vertex colors;.

Returns Reference to self (for method chaining)

Default Value (set in the constructor): For depth texture, the initial value is 1.0f/512.0f and 1.0 / 1000.f. For object id texture, the initial value is 1.0f/512.0f and 1.0/256.0f, meaning that for a 256-entry colormap the first 256 values get an exact color from it and the next values will be either clamped to last color or repeated depending on the color map texture wrapping mode (here we use "repeat.")

Expects that Flag::DepthTexture or Flag::ObjectIdTexture is enabled.

In depth texture visualization, the scale (1 / dis) is to adjust overall intensity of the final visual result. Ideally it is the furthest distance in the scene. In practice, user can set e.g., the "dis" less than or equal to the far plane.

TextureVisualizerShader& esp::gfx::TextureVisualizerShader::bindDepthTexture(Magnum::GL::Texture2D& texture)

Bind depth texture. It can only be called when Flag::DepthTexture is set.

Returns Reference to self (for method chaining)

TextureVisualizerShader& esp::gfx::TextureVisualizerShader::bindObjectIdTexture(Magnum::GL::Texture2D& texture)

Bind object Id texture. It can only be called when Flag::ObjectIdTexture is set.

Returns Reference to self (for method chaining)

TextureVisualizerShader& esp::gfx::TextureVisualizerShader::setDepthUnprojection(const Magnum::Vector2& depthUnprojection)

Set the depth unprojection parameters directly. It can only be called when Flag::DepthTexture is set.

Returns Reference to self (for method chaining)

TextureVisualizerShader& esp::gfx::TextureVisualizerShader::rebindColorMapTexture()

rebind internal color map texture. NOTE: this must be called when shaders have been switched.

Returns Reference to self (for method chaining)