DepthMaterial
Writes fragment depth without producing any color output. The renderer uses a single instance of this material internally to draw shadow casters, reconfiguring it per object, so it rarely needs to be created directly.
The texture maps exist solely to feed the alpha test. When a caster uses cutout transparency, its maps are assigned here so that discarded fragments leave holes in the shadow map. Color content is ignored; only the sampled alpha participates.
auto material = vglx::DepthMaterial::Create({
.albedo_map = foliage_texture
});
material->alpha_test = 0.5f;INFO
Derives from Material and inherits all public properties and methods.
Construction
Constructors
DepthMaterial()
Constructs a depth material with default parameters.
DepthMaterial::DepthMaterial();DepthMaterial()
Constructs a depth material from the given parameters.
DepthMaterial::DepthMaterial(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters. |
Factories preferred
DepthMaterial::Create() std::shared_ptr<DepthMaterial>
Creates a shared instance of DepthMaterial with default parameters.
static std::shared_ptr<DepthMaterial> DepthMaterial::Create();DepthMaterial::Create() std::shared_ptr<DepthMaterial>
Creates a shared instance of DepthMaterial.
static std::shared_ptr<DepthMaterial> DepthMaterial::Create(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters. |
Types
DepthMaterial::Parameters struct
Parameters for constructing a DepthMaterial object.
| Parameter | Description |
|---|---|
| albedo_map std::shared_ptr<Texture> | Color texture whose alpha channel feeds the alpha test. |
| alpha_map std::shared_ptr<Texture> | Alpha-only texture feeding the alpha test. |
Properties
Color texture sampled for its alpha channel only.
std::shared_ptr<Texture> albedo_map {};Alpha-only texture providing per-pixel opacity.
std::shared_ptr<Texture> alpha_map {};Functions
Identifies this material as Material::Type::DepthMaterial.
Type DepthMaterial::GetType() const override;