Commit Graph
16 Commits
Author SHA1 Message Date
shinyobjectz cd03baf109 nobuild: its copied code folded into what it copies (dupes: 293 exact, 57 near)
- raea-sys-rt: one GPU timer for a traced pass (timer.rs), used by raea GI and the far sun; one reader for a pass's
  reach (RAEA_SUN_FAR, RAEA_TRACED_AO); one compute-pipeline queue (cache::pipeline) for GI and its cache.
- raea-io-trace: overrides(), the variables still set over a component's props, said once a run; <VolumetricFog> and
  <SolariLighting> both read through it.
- raea-render-raytrace takes raea-sys-post's Halton places (a facility crate) instead of its own copy; the settings'
  split, taa and one_pass are read where metalfx uses them.
- engine-shaders keeps its declared shaders in a map; fog reads RAEA_FOG_EPI's places in one match; smaller rewrites
  in plugins, look, stats, lod, compose and post.
- tools/dupes.max: exact=293, near=57.
2026-11-22 09:41:52 -08:00
shinyobjectz 1dee25c609 Steady's rates, motion blur's kind, the path tracer's samples and air, and Solari's dynamic are props, each checked against its variable
Eight more environment variables become props, each variable now only an override on every camera:
- <AntiAliasing steady={{ still, moving, px }}>: steady's rates (systems/post Steady's fields), over RAEA_STEADY_*.
  RAEA_STEADY stays the every-camera form of mode="steady".
- <MotionBlur kind="shutter"|"bevy">, over RAEA_MOTION_BLUR.
- <Pathtracer samples media>, over RAEA_LIGHT_SPP and RAEA_PT_MEDIA=0. They live in raea_sys_frame::pathtracer
  (PathtracerSettings), so the fog's volumes can read media. A render draws each frame as many times as the most any
  camera asks for.
- <SolariLighting dynamic>, over RAEA_SOLARI_DYNAMIC. This was read once when the plugin was built. It is now a
  SolariSettings field, and the skin-twin and hidden-part systems run while any traced camera asks for it.

tools/nobuild.sh props gains a column for the composition the variables go on (RAEA_STEADY needs a scene without
steady), and a "traced" light path for a scene that asks for Solari or the path tracer itself. Settings with no trace
record of their own are checked by pixels alone. Three fixtures join fog.tsx: steady.tsx, blur.tsx and traced.tsx
(Pathtracer and Solari, with a slab there on the first frame only). All 15 rows pass:
- steady, its rates and the blur's kind are pixel-identical to their variables;
- the path tracer is deterministic, so samples and media compare exactly too: 21 and 27 levels from the default's;
- dynamic is as near its variable as two runs are (0.013 against 0.014), and the hidden slab's shadow is gone (5.8
  levels).

docs/nobuild.feature NB1a.
2026-11-22 09:15:58 -08:00
shinyobjectz 177f74e376 Every shader constant in the inventory is set from TypeScript: arrays and vectors too, toon and lens embedded, Solari's inline numbers named
<ShaderConstants> takes a list for an array or a vector (array<f32, 6>, vec3<f32>, vec3). The list has as many values
as the constant holds, and each keeps the element type. An array of vectors, or a length that doesn't match, is
reported and left alone.

toon.wesl, toon_outline.wesl and lens.wesl move from load_internal_asset! to the embedded registry, so a project's
engine-shaders/ and <ShaderConstants> reach them too. The toon and lens scene is pixel-identical before and after
(max difference 0, three frames).

The four numbers written inline in raea's patches to Solari and in emit_taa are now named constants, with typed props:
- SPECULAR_MOTION_ROUGHNESS (0.0625) and REFLECTION_DEPTH_SHARE (0.5), as mirror.motionRoughness and mirror.depthShare;
- GLOSSY_NEE_FLOOR (0.25), as glossyLightFloor;
- emit_taa's STILL_LOW, STILL_HIGH, MOVING_GAIN and MOVING_FLOOR, as emissiveClamp.
The jitter cycle's 8 is SolariSettings.jitter_frames (<SolariLighting jitterFrames>). The trace's solari_settings
reads 8 by default and 16 from jitterFrames={16}.

tools/nobuild.sh consts is the per-row check. It writes one scene that sets every inventoried shader constant through
<ShaderConstants>, renders it with every pass on, and records each row as settable, refused or absent in
docs/nobuild/consts.tsv. Result: 87 of 88 are settable. The one refused is raea_sys_gi's SPOTS, an array of vec2 that
stays as it is.

docs/nobuild.feature NB1a.
2026-11-22 09:15:58 -08:00
shinyobjectz 2929ce6a04 Camera cuts: a camera that jumps drops its history, and motion blur skips the jump
A cut to another camera was marked (Shots, RR2), but one camera moved far
in one frame, as a game's respawn or teleport moves it, was not. Solari's
and MetalFX's history carried the last view into the new one for half a
second, steady's filter blended it in, and motion blur streaked every pixel
along the jump.

raea-sys-post cut.rs sets CameraCut on each 3D camera every frame. A jump is
a turn of more than half the field of view in one frame, a lens changed by
half or more, or a step ten times the camera's recent pace and longer than
ten near planes. A camera's first move after it appears or cuts opens a
shot and is no step cut, unless it was seen resting first (unmoved across
two consecutive film frames). So a shot that opens on a fast move keeps its
blur, and so does a frame drawn alone with --at: the engine loads that
frame's pose at frame 0, then steps from the frame before. On a cut,
Solari's reset is set (MetalFX's denoiser, its scaler and emit_taa follow
it), steady starts its history again, and the shutter draws nothing.

Measured (lightbench window.tsx at 736x981 under Solari, the live preset;
each frame after the cut against the new view settled; worst 1/8 tile):
- one camera jumping to a view it never saw: first three frames 0.50, 0.43,
  0.38 stops -> 0.17, 0.13, 0.12 (a reset by hand: 0.14, 0.13, 0.12)
- a 90-degree flick in 15 frames: unchanged (no cut), 0.11 stops at its end
- blur.tsx, a 3 m jump with blur on: the jump frame 70.8 levels off the
  sharp frame -> 0.0. A pan of 1.5 m a frame from frame 0 is still blurred
  from frame 1, and its --at frame matches the full render's
- the three shutter scores unchanged (0.002, 0.067/0.034, 0.044/0.044)

Steady's reset follows the same flag; no steady scene was cut here.
2026-11-22 09:15:58 -08:00
shinyobjectz 929c03d5e4 Motion blur: each pixel gathered along the longest motion near it, as a box shutter spreads light
Bevy's MotionBlur gathers each pixel along its own motion, so a still pixel
beside a moving one takes none of its light. A ball crossing a still frame
smeared inward only: 64 px where the shutter's streak is 86, with 8% of its
light lost. In a tracking shot, the bars behind the ball streaked inside their
outlines only, keeping 0.68 of their light.

raea's Shutter replaces it under raea/3d's MotionBlur (RAEA_MOTION_BLUR=bevy
keeps Bevy's, to compare). It finds the longest motion in each 20 px tile
(across the tile's rows, then down them), then in each 3x3 neighbourhood of
tiles, and gathers each pixel along that motion. A tap nearer the camera than
the pixel counts by its own motion; one as far or farther counts by the
pixel's. Each tap is worth 1/|v| per pixel of path, as a box shutter spreads a
moving pixel's light. The share of the open shutter that no tap reaches is the
pixel itself. This is McGuire et al. 2012's tiles and depth split, with its
cone weights replaced by the box shutter's. It takes 1.5 taps per pixel of
path, at most two per sample each way, and reads single- and multisampled
prepasses; under MSAA a pixel's own depth and motion are its nearest
sample's, so an edge pixel part-covered by a moving surface moves with it
(its first sample alone left a ring at the moving ball's outline).

A still surface's streak that slides out from behind a nearer still one
isn't in the frame, so it stops short at the nearer one's edge (the 0.034).

Tested against the shutter's own truth (32 sub-frames a frame, the open half
averaged; LightBench's blur scenes):
- a ball crossing a still frame: profile error 0.077 -> 0.002, light 0.924 -> 0.999
- a tracking shot: the bars' streak 0.369 -> 0.067, the bars beside the ball
  0.699 -> 0.034, the ball still sharp
- a pan with parallax: the bars' streak 0.188 -> 0.044, the bars beside the
  ball 0.866 -> 0.044
- under Solari (single-sampled): 0.026 -> 0.002

Cost at 1920x1080 with MSAA, measured by repeating its passes 40 and 80 times a
frame: 0.2-0.35 ms played live (a few pixels of motion a frame), and 0.6-1.1 ms
at 32 taps on long streaks. One pass reading 400 texels per tile had cost
1.1 ms on its own.
2026-11-22 09:15:58 -08:00
shinyobjectz 4946bf9c00 LT12: raea's own temporal filter, the levels' dither moving under it, and the light check pre-rolled
<AntiAliasing mode="steady"> (or RAEA_STEADY on every 3D camera) draws each frame from one of 16 Halton places
inside its pixels and blends it with the frames before (raea-sys-post steady.rs, steady.wesl): the past fetched by
the depth and motion prepasses at the nearest neighbour's motion, clipped to the 3x3 YCoCg spread, blended in linear
light at 1/n down to 1/32 still and 1/8 moving. MSAA goes off under it. Under a jittered view the levels' cross-fade
dither moves to another of its 16 places each frame, in the main pass and the prepass alike (vendored bevy_pbr), so
the filter averages it to its share: on Berlin's 1440p fly the dot bands are gone at full size, and the walk's
heroes leave no trail. The far city's roof slopes alias more without MSAA (prefiltered far levels, LT21).

raea light check now draws 16 frames before each still or shot that doesn't follow the one before, unmeasured, so
whatever keeps a past has its own; and it never steadies the path-traced reference, whose jitter read as the paths'
flicker (FLOOR3 0.478 stops of the reference's own).

LT14, LT1 raster without against with the filter (both pre-rolled):
  FLOOR3  mean 1.379/1.392, bias -0.801/-0.816, worst 3.370/3.392, flicker 0.101/0.111, live 12.6/14.5 ms
  glade   mean 1.758/1.750, bias 1.542/1.532, worst 3.000/2.953, flicker 0.817/0.788
  gambit-walk live 49.0/44.1 ms; kitchen live 53.8/55.6 ms
Live 2560x1440 work p50, median of 3, MSAA 4x against steady: walk 53.0/55.0, fly 47.3/42.5 ms.
Off by default, so LT1's numbers without it are unchanged.
2026-11-22 09:15:58 -08:00
shinyobjectz 8443ecf2e7 #159: PrepassRead lives in raea-sys-compose's passes.rs, beside RAEA_PASS's own reading of the prepasses, not in raea-sys-frame, which it took over the 2,000-line crate limit (2,008). raea-sys-post and raea-render already depend on raea-sys-compose; nothing else changes. 2026-11-16 16:32:45 -08:00
shinyobjectz 57e0737edd #159: --aov and RAEA_PASS keep the camera single-sampled on every frame. Both read the camera's prepasses (depth and motion vectors, depth and normals) through single-sampled bindings, so they put Msaa::Off on the camera once, with the prepasses. The camera row's post-processing then put multisampling back: raea-sys-post's sync, on the first frame whose post columns changed (a bloom ramp), restored the Msaa the camera was made with, and msaa_for_3d did it on every frame a live scene (a game) set rows. The prepasses became multisampled and the frame's bind group was refused ("Texture binding 0 expects multisampled = false, but given a view with samples = 4"), at frame 2 of a render with frames 0 and 1 written. A camera whose prepasses a pass reads now carries raea_sys_frame::camera::PrepassRead, put on with the prepasses by --aov (aov_prepasses) and RAEA_PASS (compose's mark). sync and msaa_for_3d leave such a camera's MSAA off, and sync no longer takes off a depth or normal prepass that AO brought when the AO goes. aov_prepasses finds its cameras by PrepassRead, not by the motion-vector prepass, which a motion-blurred camera already had, so that camera was never made single-sampled. The readback refuses a multisampled prepass with a message instead of handing it to the GPU, whose validation error stopped the render. Tests: raea-sys-post's a_camera_whose_prepasses_are_read_stays_single_sampled (before: Sample4 once the bloom changes); bench/aov-msaa/check.sh renders frames 0 to 5 of a bloom ramp and of a game with --aov, and the ramp with RAEA_PASS=depth (before: each refused at frame 2). 2026-11-16 16:32:45 -08:00
shinyobjectz 80d07fda07 R3F25 (part): three/webgpu's PostProcessing as raea's effects, an additive Bloom, a FramePass's frame() clamped to its Viewport
three/webgpu's PostProcessing (RenderPipeline) draws one QuadMesh whose fragmentNode is the whole chain. sdk/r3f's stand-in renderers (renderer.ts for R3F, program.ts for a plain program) hand that quad to src/input/tsl-post.ts. It walks the graph for the pass(scene, camera) the chain starts from, which raea draws as the frame, and for the nodes the frame goes through, in order. Bloom, GTAO, depth of field, FXAA, SMAA (TRAA and TAAU as SMAA), SSAA and pixelation become raea's own effects. film, dotScreen, rgbShift, chromaticAberration, lut3D, sepia and bleach become FramePasses doing what their setup() builds (effects-tsl.ts). The output's tone mapping and three's exposure become raea's tone mapping and Grade exposure. post.ts reads them as it reads a composer's effects. The other display nodes and an Fn of the app's own are named once. kinds.ts TSL_POST names every post node three ships, and a test holds it to three's own list.

Bloom gains `additive` (the bloom_additive column; Bevy's Additive composite). three's UnrealBloom adds its glow on top, where Bevy's natural bloom takes the light from around it and darkened the rest of the frame. A TSL bloom is raea's additive Bloom at 4 times its strength.

systems/framepass: frame() read past the edge takes the frame's edge pixel, as a clamped texture does, never the tag row under the Viewport (a chromatic aberration drew a teal line along the foot). depth() and normal() clamp the same way.

COMPONENTS.FramePass and COMPONENTS.Fragment move into parts.tsx's table now that R3F22 has landed.

Tests: test/tsl-post.test.ts (a program's pipeline: the pass's scene drawn, bloom, film and ACES with exposure; an effect after renderOutput() runs after the tone mapping, sepia() known; a node with no counterpart named; every node three ships covered), runtime/look's an_additive_bloom_says_so_and_a_natural_one_doesnt, framepass's prelude test. The parity cases in-tslpost (bloom, 0.9737) and in-tslpost2 (sepia and chromatic aberration, 0.9233) in test/parity/tslpost.tsx; the full parity list of 36 passes unchanged. The guide's Drawn paragraph lists TSL PostProcessing, docs/r3f.feature R3F25's status says what's done and left, and the manual reference has Bloom's additive.
2026-11-15 13:21:02 -08:00
shinyobjectz f5f7b72912 R3F25 (part): postprocessing's effects as raea FramePasses, a FramePass's uv over the camera's Viewport, three's tone exposure as a Grade exposure
sdk/r3f src/input/effects.ts and effects-sampled.ts: postprocessing's Noise, Scanline, Sepia, DotScreen, ColorAverage, ColorDepth, Grid, Glitch, ShockWave, LUT3D and @react-three/postprocessing's ASCII and TiltShift2 become <FramePass>es running the effect's own shader in WGSL, with its uniforms as the effect set them, its textures (a perturbation map, the ASCII characters drawn on raea's canvas, a 3D LUT as a strip of slices), blended as its EffectPass blends it (all 22 of the blend functions it has), before or after the tone mapping as the composer orders it; an sRGB-input effect reads and writes sRGB as its pass does. TiltShift (its Kawase blur as one Gaussian of the same spread) and GodRays (the sun's disc on screen against the depth prepass, the rays unblurred) are close and say so once. SKIP is BlendFunction 9 (was read as 0, ADD). kinds.ts rows follow.

systems/framepass: an inline pass draws in the camera's Viewport and frame(), depth() and normal() map its uv onto the texture (a new view vec4 in the pass's uniforms). The Engine's target is w x (h + 1), a tag row under the frame, and Bevy's frame textures are the target's size, so in.uv spanned h + 1 rows and any pattern by uv drifted a row by the frame's foot (scanlines 0.8914 -> 0.9927, grid 0.8668 -> 0.9984). A pass as written keeps the whole texture.

Grade exposure (systems/post camera/on.rs grade_exposure, runtime/look post.rs, sdk/render GradeProps): stops on every pixel just before the curve, Bevy's ColorGrading. three's toneMappingExposure and its ACES's 1/0.6 go there now (lights.ts toneParts, post.ts), not into <ToneMapping exposure>, the camera's, which lights only lit and emissive shading: under ACES every unlit R3F colour was 0.74 stops dark (found by lane r3f-gpu), and effects before a composer's ToneMapping saw lit pixels in one scale and the rest in another. The three host folds a Grade's exposure into toneMappingExposure, so a round trip keeps it.

Parity: in-post2 0.8407 -> 0.9879, in-post3 0.8333 -> 0.9767, the rest of the list unchanged (in-basic 0.9917, in-vanilla 0.9921, in-tsl-lit 0.9906). parity.sh hands Chrome its whole list (shoot.ts's own list lacked in-instanced and the later cases) and runs in-post2 and in-post3. Tests: post.test.ts 9/9 (glitch, LUT strip, TiltShift2 told apart by its taper, the Grade exposure), roundtrip; framepass unit test of the Viewport rect. Left in R3F25: Outline, Texture, Depth, LUT1D, three/webgpu's PostProcessing (in-tslpost).
2026-11-15 12:48:19 -08:00
shinyobjectz 4e252226a6 A deferred camera's MSAA is left off: msaa_for_3d turned it on again each frame, Bevy turned it off and warned, once a frame in every ray-traced render's log 2026-11-13 11:40:56 -08:00
shinyobjectz 2e5f9d7755 RR1: every look changes per frame. Each frame's post-processing is its own (runtime/look post.rs), and a set that changes goes in a per-frame table (frame_sets) laid onto the camera's row frame by frame; the camera takes a group off and puts it on again when its columns change (raea-sys-post camera.rs, moved out of raea-runtime-scene3d; volumetric fog's group is raea-sys-fog-half's, which raea-runtime-scene3d hands to it, as a system can't use another sideways). Each light's colour, shadows and shafts change the same way. A draw across a cut (a sky, AO, anti-aliasing, a tonemapper, shadows or volumetric fog coming or going) warms up 8 updates as a load does, so the sky's light is there on a cut's first frame; a ramp is no cut. Play builds its rows the same way: a row with a table is never still (a play's first frame has its sky), depth of field comes and goes with the frames that have one, the page background is keyed, and a seek back that makes a new engine sets play's rows on it again. bench/rerender/rr1.sh: the film as one composition equals its six shot renders 900/900; a 60-frame grade, bloom and fog ramp equals 60 stills 60/60 at SSIM 1.000000; play draws the looks as the render does at 12 seeks and 2 seeks back (the HTML caption over the 3D still differs by up to 2 levels at its edges, as before RR1). The supersample downsample moves to raea-runtime-gpuframe, and light_sig and pass_column to raea-runtime-look, keeping raea-render and raea-runtime-scene under 2,000 lines. 2026-11-10 14:03:56 -08:00
shinyobjectz 85adac1697 Ink outlines compile under FXC, DX12's shader compiler on Windows (#66): the wide line's 16 directions at three radii are one loop of 48, since FXC can't unroll two nested loops with a return inside them (X3511, 172 iterations) and every 3D scene builds this pipeline, so on DX12 its error stopped every 3D render (the blocks example drew its floor and one box). Checked with naga 30's HLSL as wgpu gives FXC (shader model 5.1, loops bounded) and Windows Kits 10.0.22621's fxc on cuda-box: the old shader fails as the issue says, the new one compiles; the filter passes, froxel min/max, traced AO and shadow-only compile too 2026-11-09 21:26:25 -08:00
shinyobjectz 53b0ce3fbb A 3D render draws the same pixels every time it runs (closes #48). Two renders of sdk/react/bench/games/room3d with one binary differed in 147 (RAEA_3D=program) to 369 (the live route) of their 7200 frames, by one pixel a frame: a single MSAA sample where a wall's foot meets the floor. There the two surfaces tie in depth, and the draw order decides the tie. Within a Bevy multidraw batch set, draws go in the order their bins were added, with removed bins swap-removed. await_models ran full updates while glTFs loaded, so the render world binned each mesh at the update its load landed on, and the trees' meshes joined at a different update each run. Bisected: without <Outside> (the glTF garden) 0 of 30 stills differ; with the trees alone they differ. Waiting for the GPU each frame (RAEA_SERIAL), the single-threaded executor and RGBA readback all still differ.
While models load, await_models now holds the active cameras off (raea-sys-post's views.rs). The render world still prepares meshes, textures and pipelines, but bins nothing. It turns them on before the first frame, so every view bins the whole scene into new phases in queue order. Turning views off after a draw was binned instead loses what Bevy extracts only on a change. And a morph mesh first seen by a view after loading would keep "no morph" for good: Bevy 0.20 gives it a descriptor only once its instance was collected, and collects an instance only when it changes. So views::on runs one update and then marks each morphed mesh's Mesh3d changed (bevy-ts morph drew its card unmorphed without that; the old loading updates collected it again by chance). An earlier try, updating only the main world while models load, broke the same case: messages the render world extracts by didn't reach it.

bench/room3d-repeat/check.sh renders room3d 8 times at frames where the seam ties and wants every run to match the first. The raea before this fails 5 of 7 runs; the raea with it passes. Five full renders (7200 frames each) hash the same. Frame 0 is pixel-identical to the raea before on room3d, bevy-parity many_foxes, bevy/model and bevy-ts morph. bench/live-3d is 13 of 13, and bevy-ts is 92 pass with 1 open (shader-character's body.glb, open before too).

fps, the full room3d render back to back, alternating: 124.3 and 109.7 fps before, 125.7 and 108.1 after. First-frame render, three each alternating: room3d 1.00, 0.66, 0.70 s before and 0.68, 0.68, 0.68 s after; many_foxes 1.26, 0.95, 0.95 s before and 0.96, 0.95, 0.94 s after.
2026-11-08 03:16:35 -08:00
shinyobjectz a6d7ab2c6b #38: a live scene's camera multisamples once a frame brings 3D (part of #38)
kept-mount and kept-unmount drew the cube with hard edges on the live route from frame 10, where it mounts: the live camera spawns before any 3D part, so spawn_camera's has_3d check left MSAA off, while the program route's camera sees every frame's rows at load and turns it on. Engine::set_rows now calls raea_sys_post::msaa_for_3d, which turns MSAA on for a 3D camera once its rows have 3D, under spawn_camera's own rule (not with ssao, aa, outline, frame_looks or passes, not in preview).

bench/live-3d/check.sh adds both cases: 11/11 pass, every frame equal between the routes (frames 10-19 differed before, program 158 vs live 216 at the cube's edge).

kept-mount, live route, ms a frame before vs after, back to back: 26.9/23.0/23.7 vs 24.5/21.6/22.6.
2026-11-07 23:53:02 -08:00
shinyobjectz f675b0ad2b raea dc579e418 2026-10-31 13:15:29 -07:00