Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
Solari leaves additive and multiplying surfaces out of its traced scene (engine/render/raytrace solari.rs): traced, an Add sprite was an opaque card, and a wind's dust and air streaks cut a sunlit wall's light by a quarter. They still draw, forward. A mesh whose material isn't made yet is decided on a later frame. Test: an_additive_or_multiplying_surface_is_not_traced
shinyobjectza81a8a1e1e69
diff --git a/engine/render/raytrace/src/solari.rs b/engine/render/raytrace/src/solari.rsindex 6ec2db0b..127e7b3a 100644--- a/engine/render/raytrace/src/solari.rs+++ b/engine/render/raytrace/src/solari.rs@@ -42,7 +42,8 @@ type Pending = (With<MeshMaterial3d<StandardMaterial>>, Without<RaytracingMesh3dfn meshes(mut cmd: Commands,on: Query<(), Or<(With<SolariLighting>, With<Pathtracer>)>>,- q: Query<(Entity, &Mesh3d, Has<bevy::mesh::skinning::SkinnedMesh>, Has<bevy::mesh::morph::MeshMorphWeights>), Pending>,+ q: Query<(Entity, &Mesh3d, &MeshMaterial3d<StandardMaterial>, Has<bevy::mesh::skinning::SkinnedMesh>, Has<bevy::mesh::morph::MeshMorphWeights>), Pending>,+ mats: Res<Assets<StandardMaterial>>,mut assets: ResMut<Assets<Mesh>>,mut copies: Local<HashMap<AssetId<Mesh>, Option<Handle<Mesh>>>>,mut said: Local<bool>,@@ -50,7 +51,18 @@ fn meshes(if on.is_empty() {return;}- for (e, m, skinned, morphed) in &q {+ for (e, m, mat, skinned, morphed) in &q {+ // what it adds to or tints is all it does: traced, Solari took it as an opaque card (a wind's dust and air+ // streaks, additive sprites, cut a sunlit wall's light by a quarter). Left untraced it still draws, forward+ match mats.get(&mat.0).map(|m| traced_alpha(m.alpha_mode)) {+ Some(false) => {+ cmd.entity(e).insert(Done);+ continue;+ }+ // its material not made yet: decided on a later frame+ None => continue,+ Some(true) => {}+ }if skinned || morphed {if !*said {*said = true;@@ -81,6 +93,12 @@ fn meshes(}}+/// Whether a surface of this alpha mode is in the traced scene: not one that only adds light to what is behind it or+/// multiplies it (a glow, a spark, dust, a tint), which has nothing of its own to block or bounce.+fn traced_alpha(mode: AlphaMode) -> bool {+ !matches!(mode, AlphaMode::Add | AlphaMode::Multiply)+}+enum Traceable {Same,Copy(Mesh),@@ -133,6 +151,13 @@ mod tests {m}+ #[test]+ fn an_additive_or_multiplying_surface_is_not_traced() {+ // additive dust cards traced as opaque shaded a sunlit wall; opaque, masked and blended surfaces stay traced+ assert!(!traced_alpha(AlphaMode::Add) && !traced_alpha(AlphaMode::Multiply));+ assert!(traced_alpha(AlphaMode::Opaque) && traced_alpha(AlphaMode::Blend) && traced_alpha(AlphaMode::Mask(0.5)));+ }+#[test]fn a_mesh_on_the_gpu_alone_is_left_untraced_not_a_panic() {// raea-sys-grass's blades: RENDER_WORLD only, their data taken when Bevy extracts them (RR0's film panicked on them)