VIVIA โ Rendering Pipeline
GPU Pipeline (wgpu)โ
The renderer uses wgpu 0.20 with custom WGSL shaders for all rendering.
Every pass below maps to a shader that exists in Core/Src/renderer/.
Render Passesโ
- Terrain โ instanced chunk geometry with per-fragment lighting and distance fog (
shader.wgsl) - Sky โ procedural sky with sun/moon and day/night cycle (
sky.wgsl) - Animals โ instanced voxel bodies with procedural walk animation (
animals.wgsl) - Weather โ rain/snow particles (
weather.wgsl) - UI โ HUD, inventory, crafting, text overlays (
ui.wgsl,ui_sprite.wgsl) - Text โ glyph rendering (
text.wgsl)
Lighting Modelโ
- Sun โ directional NยทL with day/night cycle
- Moon โ soft ambient at night
- Fog โ distance-based in the terrain shader (16 references in
shader.wgsl), sky-colored - Per-fragment lighting โ Blinn-Phong-style NยทL + specular for blocks and creatures
Geometryโ
Procedural 3D primitives generated by pure math (no model files needed):
- Sphere โ UV sphere with configurable rings/stacks
- Cylinder โ lathed with end caps
- Capsule โ cylinder + hemisphere ends
- Cone โ lathed with base cap
- Box โ unit cube
All shapes carry smooth per-vertex normals for organic creature bodies.
Texture Pipelineโ
texture_registry.rsconventions:blockname.png(all faces),blockname_side.png(side override),_top/_bottomvariants- Dynamic atlas (
dynamic_atlas.rs) โ MeMLP-generated procedural textures are uploaded into the atlas at runtime - Bilinear upscale + grain for close-up detail
- AI texture styles selected by the MeMLP
TEXTURE_ARCHhead (8โ12โ6)
Shaders (as shipped)โ
| Shader | Purpose |
|---|---|
shader.wgsl | Main terrain + block rendering, fog |
sky.wgsl | Procedural sky, sun/moon |
weather.wgsl | Rain/snow particles |
animals.wgsl | Voxel creature rendering + walk animation |
text.wgsl | Text/glyph rendering |
ui.wgsl | HUD elements |
ui_sprite.wgsl | Sprite rendering |
Performanceโ
- Instanced rendering โ one draw call per shape per chunk
- World mesh cache โ invalidation on block changes (
invalidate_world_mesh_cache) - No per-frame allocations on the hot path
- Low-end PC mode โ
low_end_pcsetting reduces render radius via performance profiles - Configurable
load_radius/render_radius/cleanup_radius
Planned (not in this build)โ
GLB model loading, mesh decimation and skeletal skinning for AI-generated creature models โ designed, not implemented. Today's creatures are animated voxel compositions.