3 KiB
HLSL Renderer
Aquarium now has a first shader-owned image path.
Current Path
D3D11RenderercompilesRender/Shaders/Aquarium.hlslat startup withVortice.D3DCompiler.- The renderer draws one fullscreen triangle.
- The pixel shader raymarches the Grid heightfield, Self sun, and orbiting planets.
- C# feeds only frame constants: resolution, time, Grid radius, and camera position.
- CultMath is referenced as the CPU-side math grammar. Vortice math stays at the graphics API membrane.
Current Limits
This is still a first image path, not the final renderer. The shader keeps planet broad-phase cheap by avoiding terrain samples inside every planet anchor. Terrain-hugging orbit cups should come back through a real object table or precomputed frame constants, not repeated procedural work inside every SDF sample. That was the tiny furnace. It has been told to sit down.
Bevy Feature Port
The first Bevy feature port brings across the pieces that fit a single HLSL raymarch pass:
- body-driven
powerPulseGrid wells - world-space Grid weather with domain warping and filament layers
- stable planet-local displaced SDFs
- material-specific normals so terrain and body shading do not re-evaluate the entire scene six times per visible pixel
The Bevy SH/froxel lighting, brick maps, HDR bloom graph, and debug terminal are not directly ported yet. Those need engine systems around the shader rather than more one-pass pixel shader stuffing. The machete remains on the wall, tastefully lit.
Deferred Grid Pass
The renderer now has a deferred Grid height target.
Current frame order:
- C# bins Self and planet bounds into a small Grid-space froxel table and uploads fixed primitive id slots as a structured buffer.
GridHeightPSrenders body/gravity height into a 128x128 Grid-spaceR32G32B32A32_Floatrender target.AquariumPSraymarches solids and terrain against that height texture.- Body SDF checks read only the primitive ids binned into the current froxel. Empty froxels skip body SDF work entirely.
- Displaced body SDFs report a noisy hit distance separately from a conservative envelope step distance, so high-frequency surface detail can shape the silhouette without letting rays skip over it. When a ray is inside the conservative envelope but outside the noisy surface, it takes a shell escape step instead of starving on the minimum stride.
- Terrain marching uses heightfield crossing and slope-aware steps instead of
pretending
z - height(xy)is a true Euclidean SDF. Body objects still use SDF distance steps. - Terrain normals sample adjacent Grid texels in world space instead of re-evaluating analytic height per normal tap.
- The Grid target is centered on the camera target; body anchors remain in world space.
The target currently stores height in .r only. The next useful expansion is to
store packed gradients in .g/.b during the Grid pass so the raymarcher can use
one texture fetch for height and a cheaper normal path when fidelity allows it.