Skip to main content

Module decal

Module decal 

Source
Expand description

Projected decals: a box that paints whatever surface lies inside it (any shape of geometry, no UVs needed). The box projects along its local -Y axis, so its +Y should point out of the surface; its X and Z scale give the size, its Y scale the depth it reaches.

A decal can carry an image, a normal map and an ORM map, or draw a built-in procedural shape, and blends with the surface in one of several modes (normal, multiply, lighten, overlay…). Decals are drawn after the opaque scene by builtin:decal, sorted by order, culled by the view frustum and by max_distance, and grouped by image so thousands stay cheap.

use kvas_engine::decal::{Decal, DecalBlend};
let d = Decal { blend: DecalBlend::Multiply, opacity: 0.8, ..Default::default() };
assert_eq!(d.shader_params()[0], DecalBlend::Multiply as i32 as f32);

Structs§

Decal
A projected decal. Put it on an entity and move, turn and scale it like any object.

Enums§

DecalBlend
How a decal combines with the surface under it.
DecalShape
Built-in shapes for decals without an image.

Constants§

PRESETS
Names accepted by preset.

Functions§

preset
A ready look for common uses: "blood", "scorch", "bullet_hole", "cracks", "puddle", "dirt", "paint", "moss", "rust", "leaks", "graffiti_glow", "light_spot".