Skip to content

feat(id-native-shell): Bevy scene renderer for scene/1 surfaces (#12657 step 2a) - #13214

Merged
dezren39 merged 1 commit into
mainfrom
lane-qd-12657
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-qd-12657

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Step 2a of #12657 (rich presentation surfaces): the Bevy scene renderer for the native shell. Step 1 of the contract is complete (scene 1a, audio 1b, widget 1c); this is the first of the three step-2 renderers. #12657 stays open on 2b (audio) and 2c (widget).

What lands

  • scene::SceneModel — the pure render model, mirroring render::ScreenGrid's separation: a host-validated SceneSurface becomes node models (shape, position, size carried through) plus the renderer's derived visuals, all in one testable place. The contract carries no visual fields beyond shape/position/size, so the derivation is defined here: a fixed hue family per shape, lightness stepped deterministically by the node id's FNV-1a hash, and a camera framing computed from the scene's bounds (centroid target, bounding-sphere standoff along a fixed direction).
  • scene::SceneRenderPlugin — reads the existing PresentedView resource (world input stays on the same contract frames; no new frame kinds): on each view-sequence change it despawns the old scene's nodes, reframes the camera, and spawns one entity per node — Mesh3d (cuboid / unit sphere scaled to extents / ground plane), MeshMaterial3d<StandardMaterial> in the derived color, Transform at the contract position. A non-scene view, or no view, clears the scene. The binary registers the plugin beside ShellRenderPlugin.
  • scene::example_scene — the deterministic example world for this surface: a small Harbor scene (water plane, dock box, buoy sphere, beacon point) exercising the whole closed shape set; the tests present exactly this document through the session-frame seam.
  • bevy gains the bevy_pbr feature (standard 3D materials) on the existing step-2 render wiring; no new system libraries (the crate compiles and tests in the stock pkgs/id dev shell).

Shells without the scene plugin are unchanged: ScreenGrid still presents a scene surface as its deterministic text projection, and a parity test in the new module pins that fallback.

Verification


Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

… step 2a)

Step 2a of the rich-presentation follow-on: the native shell gains a
real 3D renderer for validated scene/1 surfaces, beside the text grid.

- scene::SceneModel: pure render model — node shape, position and
  size carried through from the host-validated contract types;
  colors derived deterministically (hue family per shape, lightness
  stepped by the node id's FNV-1a hash); camera framing computed
  from the scene's bounds.
- scene::SceneRenderPlugin: one mesh entity per node with
  bevy_pbr standard materials, camera reframed per view; a
  non-scene view (or no view) clears the scene entities. Shells
  without the plugin keep presenting the scene's text projection —
  a parity test pins that fallback.
- scene::example_scene: the deterministic example world's Harbor
  scene, exercising all four shapes in the closed set.
- bevy gains the bevy_pbr feature on the existing step-2 render
  wiring (no new system libraries).

Verification: cargo nextest run -p id-native-shell — 81/81 pass
(8 new scene tests); cargo fmt clean; clippy clean in the new
module. The full clippy-native-shell gate is currently red on
main for an unrelated id-store reason (filed as #13207).
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 92465a56-88b3-4582-b7e3-002521d0aa23
Commits

Reviewing files that changed from the base of the PR and between 095714b and 8bbb7f4.

Files ignored due to path filters: 1

  • pkgs/id/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 4

  • pkgs/id/crates/id-native-shell/Cargo.toml
  • pkgs/id/crates/id-native-shell/src/lib.rs
  • pkgs/id/crates/id-native-shell/src/main.rs
  • pkgs/id/crates/id-native-shell/src/scene.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T11:05:19.484795Z 8bbb7f4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 082f0e3 into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the lane-qd-12657 branch November 23, 2026 11:01

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8bbb7f479d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Self {
title: scene.title.clone(),
nodes,
camera_position: centroid + direction * (radius * 2.5),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Frame scene bounds using the viewport's aspect ratio

In sufficiently narrow portrait windows, valid scenes with horizontally separated nodes are clipped because the fixed radius * 2.5 camera distance never accounts for the viewport's narrower horizontal field of view. rebuild_scene only updates the camera transform, so resizing the window cannot correct the framing either. Derive the distance from the actual projection and viewport, and update it on resize. The existing camera test merely repeats the distance formula; a projection/frustum containment oracle across viewport ratios would catch this regression.

AGENTS.md reference: AGENTS.md:L37-L39

Useful? React with 👍 / 👎.

fn spawn_stage(mut commands: Commands<'_, '_>) {
commands.spawn((
SceneCamera,
bevy::prelude::Camera3d::default(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enable tonemapping LUTs or select a LUT-free tonemapper

In the shipped binary, Bevy's Core3d plugin automatically adds the default TonyMcMapface tonemapper to this camera, but the crate disables default features and never enables tonemapping_luts. Bevy 0.19.1 substitutes a single magenta texel for the missing LUT, so scene meshes render magenta instead of retaining their derived colors and lighting differences. Enable the feature or explicitly attach a LUT-free tonemapper such as Tonemapping::Reinhard. The headless tests do not exercise this rendering path. See Bevy's camera registration and tonemapping implementation.

Useful? React with 👍 / 👎.

Comment on lines +287 to +289
let sequence = presented.0.as_ref().map(|view| view.sequence);
if sequence == *last_sequence {
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Rebuild scenes when views change without advancing the world sequence

For worlds whose scenes change on host events such as time.tick or presence updates, this guard discards subsequent presentations because those events do not advance the durable world sequence. world/handle.rs:563-564 explicitly documents that behavior, and world_session/mod.rs:1422-1426 schedules fresh views from those notifications using the unchanged sequence. Consequently, animated scenes freeze after their first frame until a durable participant event occurs; a host-driven transition away from a scene also leaves its old entities visible. Track changes to the presented view or preserve and compare the host's view_revision instead of using only sequence.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant