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
#38: a mesh's alpha mode follows its opacity each frame, on both routes (part of #38)
shinyobjectzd7982d95e5b4
diff --git a/bench/live-3d/check.sh b/bench/live-3d/check.shindex e089cdd2..dfef7d8e 100755--- a/bench/live-3d/check.sh+++ b/bench/live-3d/check.sh@@ -19,7 +19,8 @@ status=0for f in bench/at-3d/scene.tsx sdk/raea/bench/bevy-parity/3d/spotlight.tsx sdk/raea/bench/bevy-parity/3d/spherical_area_lights.tsx \sdk/raea/bench/bevy-parity/3d/atmospheric_fog.tsx examples/games/screenshake.tsx examples/games/shapes.tsx examples/games/lighting.tsx \sdk/raea/bench/bevy/environment/edit.tsx sdk/raea/bench/bevy-ts/cases/material-field-0.tsx \- sdk/raea/bench/bevy-ts/cases/kept-mount.tsx sdk/raea/bench/bevy-ts/cases/kept-unmount.tsx sdk/raea/bench/bevy/text3d/edit.tsx; do+ sdk/raea/bench/bevy-ts/cases/kept-mount.tsx sdk/raea/bench/bevy-ts/cases/kept-unmount.tsx sdk/raea/bench/bevy/text3d/edit.tsx \+ sdk/raea/bench/bevy/volumetric-glass/edit.tsx; don=$(basename "$f" .tsx)RAEA_3D=program "$BIN" render "$f" -o "$OUT/$n.program.txt" > "$OUT/$n.program.log" 2>&1 || { echo "FAIL $f: the programmed render failed"; tail -3 "$OUT/$n.program.log"; status=1; continue; }RAEA_3D=live RAEA_LIVE3D_CHECK=1 "$BIN" render "$f" -o "$OUT/$n.live.txt" > "$OUT/$n.live.log" 2>&1 || { echo "FAIL $f: the live render failed: $(grep -o 'RAEA_LIVE3D_CHECK.\{0,160\}' "$OUT/$n.live.log" | head -1)"; status=1; continue; }diff --git a/runtime/scene3d/src/sync.rs b/runtime/scene3d/src/sync.rsindex 60d6830e..eedbeba1 100644--- a/runtime/scene3d/src/sync.rs+++ b/runtime/scene3d/src/sync.rs@@ -137,9 +137,10 @@ pub fn sync_meshes(} else {cur.emissive};- // a mesh made see-through after it was spawned (a live scene's row gains opacity mid-play) blends from then on,- // as a render's, which knew from its load (material: an opacity column is a blended surface)- let blend = v.contains_key("opacity") && cur.alpha_mode == AlphaMode::Opaque;+ // a mesh with an opacity column blends below 1 and is opaque at 1 (writing depth), each frame, render and live alike+ // (#38); one whose alpha mode is given, or a blended picture (a glyph: its see-through parts), stays as it is at 1+ let want = if base.alpha() < 1.0 || cur.base_color_texture.is_some() && cur.alpha_mode == AlphaMode::Blend { AlphaMode::Blend } else { AlphaMode::Opaque };+ let blend = v.contains_key("opacity") && !v.contains_key("alpha") && matches!(cur.alpha_mode, AlphaMode::Opaque | AlphaMode::Blend) && cur.alpha_mode != want;if cur.base_color != base || cur.perceptual_roughness != rough || cur.metallic != metal || cur.emissive != emissive || blend {// a material other parts hold too (share.rs): this part's change goes on a copy of its own, put where its// handle is kept; a fog copy follows the new handle a frame later (froxel_glass.rs)@@ -150,7 +151,7 @@ pub fn sync_meshes(own.metallic = metal;own.emissive = emissive;if blend {- own.alpha_mode = AlphaMode::Blend;+ own.alpha_mode = want;}let nh = mats.add(own);if let Some(m) = mat.as_mut() {@@ -169,7 +170,7 @@ pub fn sync_meshes(m.metallic = metal;m.emissive = emissive;if blend {- m.alpha_mode = AlphaMode::Blend;+ m.alpha_mode = want;}// and its fog copy, this frame (froxel_glass.rs's own follow is a frame behind)if let Some(mut g) = fogged.as_ref().and_then(|(_, g)| glasses.get_mut(&g.0)) {diff --git a/systems/material/src/maps.rs b/systems/material/src/maps.rsindex 8b813167..61c7c42b 100644--- a/systems/material/src/maps.rs+++ b/systems/material/src/maps.rs@@ -179,8 +179,8 @@ pub fn material(world: &mut World, t: &Tup, inserted: &[Tup], dir: &Path) -> Resclearcoat: g("clearcoat", 0.0),clearcoat_perceptual_roughness: g("clearcoat_rough", 0.5),reflectance: g("reflectance", 0.5),- // see-through only when asked (an opacity column, even at 1, may animate to less)- alpha_mode: if vals.contains_key("opacity") { AlphaMode::Blend } else { AlphaMode::Opaque },+ // see-through below opacity 1, at 1 opaque and writing depth (sync_meshes switches it, #38); a fading picture blends+ alpha_mode: if opacity < 1.0 || vals.contains_key("opacity") && vals.contains_key("map") { AlphaMode::Blend } else { AlphaMode::Opaque },..default()};// texture maps (Poly Haven's diff, nor_gl, rough, arm, ao), all tiled by repeat_u/repeat_vdiff --git a/systems/material/src/toon.rs b/systems/material/src/toon.rsindex eb36661d..2890314a 100644--- a/systems/material/src/toon.rs+++ b/systems/material/src/toon.rs@@ -344,14 +344,15 @@ pub fn sync_toon(cur.base.emissive};let p = params(&toon.0, Some(v));- let blend = v.contains_key("opacity") && cur.base.alpha_mode == AlphaMode::Opaque;+ let want = if opacity < 1.0 || cur.base.base_color_texture.is_some() && cur.base.alpha_mode == AlphaMode::Blend { AlphaMode::Blend } else { AlphaMode::Opaque };+ let blend = v.contains_key("opacity") && !v.contains_key("alpha") && matches!(cur.base.alpha_mode, AlphaMode::Opaque | AlphaMode::Blend) && cur.base.alpha_mode != want;if cur.base.base_color != base || cur.base.emissive != emissive || cur.extension.params != p || blend {if let Some(mut m) = mats.get_mut(&h.0) {m.base.base_color = base;m.base.emissive = emissive;m.extension.params = p;if blend {- m.base.alpha_mode = AlphaMode::Blend;+ m.base.alpha_mode = want;}}}