Skip to content

3D Rendering

Enable the model-3d feature to create and draw models:

toml
[dependencies]
spottedcat = { version = "1.0.0", features = ["model-3d"] }

Create models through spottedcat::model::create and describe position, rotation, and scale with DrawOption3D. Enable gltf to load GLTF files; it also enables image-decoding utilities.

Instancing

Use draw_instanced when the same model appears many times. Grass, particles, repeated props, and crowds can be submitted in one CPU draw call, significantly reducing submission overhead.

Materials and animation

The 3D stack supports PBR material textures, normals, ambient occlusion, emissive maps, bone matrices, and animated GLTF. Model shader vertex input includes position, UV, normal, joint indices, weights, and tangent; the instanced path adds a transform matrix.

Fog

Enable effects to use distance and height fog. Parameters are grouped by purpose:

  • Physical controls: strength, distance, and height
  • Style controls: color and background
  • Quality controls: sampling

Fog is disabled by default and only activates when strength is greater than zero and at least one density term is non-zero.

Released under the MIT OR Apache-2.0 License.