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
FC0a: ui/widgets/viewport_node ports at 0.99987: a second camera with a Viewport over the node's border box. A camera with a Viewport keeps its own shape: the engine no longer gives it the whole frame's SubCameraView, which sized its projection to 16:9. 92 of 96 ported examples pass
shinyobjectzfb35f5d9083a
diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.listindex 6b2af971..ae67896b 100644--- a/bench/bevy-parity/examples.list+++ b/bench/bevy-parity/examples.list@@ -95,3 +95,4 @@ ui/navigation/directional_navigationui/navigation/directional_navigation_overridesui/widgets/headless_tabsui/widgets/tab_navigation+ui/widgets/viewport_nodediff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsvindex a780a87f..e39eee62 100644--- a/bench/bevy-parity/runs.tsv+++ b/bench/bevy-parity/runs.tsv@@ -94,3 +94,4 @@ ui/navigation/directional_navigation - 10ui/navigation/directional_navigation_overrides - 10ui/widgets/headless_tabs - 10ui/widgets/tab_navigation - 10+ui/widgets/viewport_node - 10diff --git a/docs/bevy-parity.md b/docs/bevy-parity.mdindex 466dffb0..3cb7c993 100644--- a/docs/bevy-parity.md+++ b/docs/bevy-parity.md@@ -4,7 +4,7 @@ Bevy v0.20.0's examples against their raea TSX ports (docs/control.feature FC0a)don't edit. An example passes when every probed frame passes pixels (SSIM 0.98 and no 32 px tile off by more than 24 of 255) and cost (batch keys andframe time at most 1.25x the example's). Wall time is one machine's, measured in the same run.-Examples: **438**, ported **95**, passing **91**, excluded **16** (docs/bevy-parity/excluded.tsv), left **331**.+Examples: **438**, ported **96**, passing **92**, excluded **16** (docs/bevy-parity/excluded.tsv), left **330**.raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the exampledoesn't pay.@@ -151,6 +151,7 @@ doesn't pay.| ui/navigation/directional_navigation_overrides | 10 | 0.996122 | 11 | 0 / 0 | 564 / 493 | 5 / 7 | 1 / 1 | 38.217 / 1.757 = 1.757 + 0 | yes | || ui/widgets/headless_tabs | 10 | 0.992999 | 11 | 0 / 0 | 478 / 493 | 5 / 7 | 1 / 1 | 44.815 / 1.798 = 1.798 + 0 | yes | || ui/widgets/tab_navigation | 10 | 0.998035 | 4 | 0 / 0 | 500 / 493 | 5 / 7 | 1 / 1 | 36.809 / 1.624 = 1.624 + 0 | yes | |+| ui/widgets/viewport_node | 10 | 0.999871 | 0 | 1 / 1 | 446 / 498 | 6 / 8 | 2 / 2 | 37.591 / 1.925 = 1.925 + 0 | yes | |## Excludeddiff --git a/engine/render/src/engine/target.rs b/engine/render/src/engine/target.rsindex 4927fa67..824f2a8f 100644--- a/engine/render/src/engine/target.rs+++ b/engine/render/src/engine/target.rs@@ -40,6 +40,7 @@ pub(crate) fn tag_row_view(t: Res<TagRowTarget>, images: Res<Assets<Image>>, vieNone => bevy::camera::SubCameraView { full_size: UVec2::new(s.x, s.y - 1), offset: Vec2::ZERO, size: s },};for (mut c, rt) in &mut q {+ if c.viewport.is_some() { if c.sub_camera_view.is_some() { c.sub_camera_view = None; } continue; } // a camera with its own Viewport (a ViewportNode's) sees its viewport's shape, as Bevy sizes it, never the tag rowif matches!(rt, RenderTarget::Image(i) if i.handle == t.0) && c.sub_camera_view != Some(view) {c.sub_camera_view = Some(view);}diff --git a/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx b/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsxnew file mode 100644index 00000000..4b5e9719--- /dev/null+++ b/sdk/raea/bench/bevy-parity/ui/widgets/viewport_node.tsx@@ -0,0 +1,38 @@+// Bevy v0.20.0 examples/ui/widgets/viewport_node.rs in raea's TSX (docs/control.feature FC0a): a 5 m white cube at+// z -10, unlit but for the default ambient light, seen by two default Camera3ds at the origin: the window's, and one+// (order -1) drawing into an image a ViewportNode shows, an absolute 200 x 200 node at (50, 50) with a 5 px white+// border. The ViewportNode sizes the image to the node (computed_node.size(): its border box, 200 x 200) and the+// camera's aspect with it, and the border is drawn over the image. Here that camera draws into its own viewport+// of the frame, over the window camera's picture (order 1, its own+// clear, as the image clears), and the bordered node is drawn over both. Dragging the cube or the node (and the+// intersection arrows MeshPickingPlugin draws) needs a pointer, which no render has. In Bevy's default 1280 x 720+// window.+import { AbsoluteFill, Composition, registerRoot } from "raea";+import { BevyComponent, Canvas3D, Entity } from "raea/3d";+import { Camera3d } from "raea/camera";+import { Cuboid, Mesh3d } from "raea/mesh";+import { StandardMaterial } from "raea/pbr";+import { Transform } from "raea/transform";+import { Node, UiRect, px } from "raea/ui";+import { Srgba } from "raea/color";++function Shot() {+ return (+ <AbsoluteFill>+ <Canvas3D layered clearColor="rgb(43, 44, 47)">+ <Camera3d transform={Transform.IDENTITY} />+ <Entity name="viewport-camera" position={[0, 0, 0]}>+ <BevyComponent type="bevy_camera::components::Camera3d" value={{}} />+ <BevyComponent type="bevy_camera::camera::Camera" value={{ order: 1, viewport: { physical_position: [50, 50], physical_size: [200, 200], depth: { start: 0, end: 1 } } }} />+ </Entity>+ <Mesh3d transform={Transform.fromXyz(0, 0, -10)}>+ <Cuboid half_size={[2.5, 2.5, 2.5]} />+ <StandardMaterial base_color="#ffffff" />+ </Mesh3d>+ </Canvas3D>+ <Node position_type="Absolute" top={px(50)} left={px(50)} width={px(200)} height={px(200)} border={UiRect.all(px(5))} border_color={new Srgba(1, 1, 1)} />+ </AbsoluteFill>+ );+}++registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);