Soorat
Soorat (Arabic/Urdu: صورت — form, image, appearance) — GPU rendering engine for AGNOS
wgpu-based rendering engine designed for the Kiran game engine. Provides 2D sprites, 3D PBR meshes, shadows, skeletal animation, debug wireframes, post-processing, terrain, text, UI, and fluid rendering.
Features
- 2D Sprites — rotation, atlas UV regions, batched multi-texture draw, persistent GPU buffers, u16/u32 index paths
- 3D PBR — Cook-Torrance/GGX/Fresnel-Schlick (ported from prakash), multi-light loop (8 lights), metallic-roughness materials, inverse-transpose normals
- Skinned Meshes —
SkinnedVertex3Dwith 4 joint weights, vertex skinning shader, tangent-space normal mapping - Shadows — directional PCF 3x3, cascaded shadow maps (1–4 cascades), shadow atlas, point light cube shadows
- Lighting — directional, point (range attenuation), and spot (cone falloff) lights
- Animation — skeleton/joint hierarchy, glTF skin loading, keyframe interpolation
- Debug — wireframe lines, boxes, circles, spheres, capsules, grids, physics collider shapes
- Post-Processing — HDR framebuffer (Rgba16Float), Reinhard + ACES tone mapping, bloom (threshold + Gaussian blur), SSAO
- Terrain — heightmap mesh generation with computed normals
- Text — bitmap font glyph atlas with text batching
- UI — screen-space panels, labels, and HUD overlays
- Fluids — SPH particle quads with velocity/density/pressure color mapping, shallow water surface meshes (via pravash)
- glTF — model + animation loading with zero-copy buffer borrowing
- Multi-window — shared GPU context across windows
- LOD — distance-based mesh and terrain resolution selection
- Instancing — per-instance transforms + color, auto-growing GPU buffer
- Compute — general-purpose compute shader pipeline with storage buffer helpers
- Profiling — CPU frame timing (EMA + FPS), GPU timestamp queries, per-pass timing
- Capabilities — GPU feature/limit reporting, WebGPU compatibility validation
Architecture
src/
├── Core: color, vertex, error, gpu, window, profiler, capabilities, math_util
├── 2D: pipeline (sprites), sprite, texture, text, ui
├── 3D: mesh_pipeline (PBR), shadow, animation, terrain, fluid_render
├── Debug: debug_draw (lines, shapes, grid)
├── Post: postprocess, hdr (bloom pipeline), ssao
├── Loading: gltf_loader, texture
├── Lights: lights (directional/point/spot)
├── Materials: material, pbr_material
├── Rendering: instancing, lod, compute
├── Shaders: sprite.wgsl, pbr.wgsl, pbr_skinned.wgsl, shadow.wgsl,
│ line.wgsl, postprocess.wgsl, bloom.wgsl, ssao.wgsl
└── Targets: render_target
Quick Start
use ;
use run;
Optional Features
| Feature | Crate | Provides |
|---|---|---|
optics |
prakash | Spectral color, PBR math, BRDF LUT |
ranga |
ranga | PixelBuffer texture loading |
physics-debug |
impetus | Collider shape wireframes |
fluids |
pravash | SPH particle + shallow water rendering |
full |
all above | Everything |
Building
Stats
251 tests, 29 benchmarks, 34 modules, 8 WGSL shaders.
License
GPL-3.0 — see LICENSE.