Skip to content

Complete scene realization and rendering support for interactive demos - #296

Merged
bdero merged 14 commits into
masterfrom
bdero/tps-demo-port-support
Aug 4, 2026
Merged

Complete scene realization and rendering support for interactive demos#296
bdero merged 14 commits into
masterfrom
bdero/tps-demo-port-support

Conversation

@bdero

@bdero bdero commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Adds linked FScene realization, authored material loading, filtered physics queries, safe graph mutation, and imported mesh variant handling. Improves ambient occlusion, tone mapping, post-processing stage application, networking, and native asset compatibility for large interactive scenes.

@bdero bdero added importer Pertains to the importer rendering Behavior when preparing or drawing geometry to the screen. bug Something isn't working. performance Frame rate, memory, or runtime cost regressions. labels Aug 4, 2026
@argos-ci

argos-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
android_gles (Inspect) ⚠️ Changes detected (Review) 1 added Aug 4, 2026, 12:07 PM
android_vulkan (Inspect) ⚠️ Changes detected (Review) 1 added Aug 4, 2026, 12:06 PM
linux (Inspect) 👍 Approved by bdero 1 added Aug 4, 2026, 12:00 PM
web (Inspect) 👍 Approved by bdero 1 added Aug 4, 2026, 12:00 PM
windows (Inspect) 👍 Approved by bdero 1 added Aug 4, 2026, 12:03 PM

@bdero bdero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

dart analyze is clean and all 1121 flutter_scene tests pass locally. The mesh-variant fix, the nested override grammar, and the layer-mask query coverage are all solid.

Three things look like blockers.

  1. The rapier ABI change ships without the release that makes it safe. wasm_release.dart still pins the 0.4.0 module, and the web path has no ABI gate, so every query passes layerMask where the old export expects the out pointer. native_binaries.json still declares abi_version: 1 against the hook's new 2, so native consumers fall through to a source build that is currently broken on Android. The package is still 0.4.0 with no CHANGELOG entry. This wants to be its own PR with its own release cycle.
  2. glTF punctual light intensity is imported raw. The extension specifies candela and lux, while PointLight.intensity is an artistic radiance-at-unit-distance scalar, so authored lights land orders of magnitude too bright. It also turns on for every existing buildScenes user with no opt-out, and the runtime importer does not do it, so the two import paths now disagree about what a .glb contains.
  3. Most of the new public API is missing from the CHANGELOG. dart_apitool will list all of it, worth running now rather than at release.

On the API design, Material.depthBias is the one I would most want to change before it is public. It is a raw NDC offset, so its meaning varies with the backend's clip depth convention, the depth attachment precision, and the scene's world scale. It also goes into .fscene documents as an authored property, so the unit is expensive to change later. A view-space offset converted per draw, or a normalized count of depth-buffer units, would stay meaningful across all three.

The rest is inline. Most of it is small.

Comment thread packages/flutter_scene_rapier/lib/src/ffi/wasm_rapier_bindings.dart Outdated
Comment thread packages/flutter_scene_rapier/native_binaries.json Outdated
Comment thread packages/flutter_scene_rapier/hook/build.dart Outdated
Comment thread .github/workflows/rapier_native_binaries.yml Outdated
Comment thread packages/flutter_scene/lib/src/importer/src/fscene_emitter/fscene_emitter.dart Outdated
Comment thread packages/flutter_scene/lib/src/material/environment.dart Outdated
Comment thread packages/flutter_scene/shaders/material_lighting.glsl
Comment thread packages/flutter_scene/CHANGELOG.md
Comment thread packages/flutter_scene/lib/fscene.dart
Comment thread examples/smoke_render/lib/smoke_scenes.dart

@bdero bdero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Re-reviewed at 85256be. dart analyze is clean across all four packages and 1124 tests pass.

The three blockers are properly resolved. Backing the rapier layer-mask change out entirely was the right call, and the revert is complete, including restoring the TODO(query-layer-mask) so the docs no longer overstate what the parameter does. The photometric conversion through one shared helper used by both import paths is exactly right. The CHANGELOG audit looks thorough, and flagging the Geometry.bind signature as breaking is the correct read, since Dart requires overrides to accept the supertype's named parameters.

Moving depthBias to a world-space offset is a real improvement. It is now projection, depth-format, and clip-convention independent, lighting still uses the unbiased position, and the shadow pass binds zero. Making bias a bind parameter instead of geometry state closed the stale-state hazard properly.

One new issue, in _visitMutable. It is correct, but it is quadratic and allocates per node per frame, in the traversal that runs for every node every frame and every fixed substep. Measured on this machine, one 1024-element list costs 784us per pass and 4096 costs 12.1ms, against 6.9us and 23.8us for the same guarantees with a fast-path identity check. That is a scene-killing regression for exactly the wide-sibling case the engine is meant to scale to, so I would not land it as written. Details inline.

The rest is follow-ups and two things worth eyeballing on the smoke lane.

Comment thread packages/flutter_scene/lib/src/node.dart
Comment thread packages/flutter_scene/lib/src/node.dart Outdated
Comment thread packages/flutter_scene/lib/src/components/component.dart
Comment thread packages/flutter_scene/lib/src/material/material.dart
Comment thread packages/flutter_scene/shaders/flutter_scene_unskinned_body.glsl Outdated
Comment thread packages/flutter_scene/shaders/flutter_scene_ssao.frag Outdated
Comment thread packages/flutter_scene/shaders/flutter_scene_ssao.frag
Comment thread packages/flutter_scene/lib/src/importer/gltf_light_units.dart
Comment thread packages/flutter_scene/lib/src/environment_settings.dart
Comment thread packages/flutter_scene/CHANGELOG.md Outdated

@bdero bdero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Re-reviewed at 33b6b72. This looks good to merge on substance.

dart analyze is clean across flutter_scene, scene, flutter_scene_rapier, and flutter_scene_editor_core, and 1124 tests pass.

The traversal fix works. Measured again on the same bench, an unmutated 4096-child list went from 12.1ms to 25us, and 16384 children now cost 98us. The fast path allocates nothing, and seeding the tracking set from the current prefix is sound for each of the documented mutation shapes, including the insert-before case where the newly inserted node is correctly held back to the next frame. Reordering is the one case that still skips siblings, and documenting it as unsupported is the right call given the cost of handling it.

Fading subpixel taps with smoothstep while leaving weight_sum complete is a better fix than dropping them, since the denominator stays stable and distant support ramps to zero instead of stepping. The shared depth_bias.glsl and interleaved_gradient_noise.glsl includes match how pbr.glsl and material_lighting.glsl already work, so they need no manifest entry.

The rapier change is now just normalizing the cached prebuilt's filename through targetOS.dylibFileName, with a test. No ABI change, no manifest change, no release coupling. That is the right place to have landed.

One performance follow-up inline, worth an issue rather than another round. Three mechanical gates before merging are in the summary below.

Merge gates, none of them about the code:

  1. The branch is CONFLICTING against master. The conflict is only CHANGELOG.md, where master's a28bd88 added a bullet to the same 0.21.0 section. A rebase resolves it.
  2. CI's last green run is 85256be, not 33b6b72. Worth letting Flutter CI and smoke render finish on the final commit.
  3. flutter_scene_net now requires dashwire_replication ^0.2.0 while its published 0.1.0 pins ^0.1.0, which overlaps what stage B in #288 is scoped to do. Worth deciding which PR carries the bump so the two do not fight, and remembering flutter_scene_net needs a release either way.

Comment thread packages/flutter_scene/lib/src/node.dart
@bdero
bdero force-pushed the bdero/tps-demo-port-support branch from 33b6b72 to 7a89a1a Compare August 4, 2026 11:56
@bdero

bdero commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto current master. This PR carries the dependency constraint bump required by the demo, while the networking PR can inherit it and the package can release with its next version.

@bdero
bdero merged commit eab57a2 into master Aug 4, 2026
11 of 14 checks passed
@bdero
bdero deleted the bdero/tps-demo-port-support branch August 4, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. importer Pertains to the importer performance Frame rate, memory, or runtime cost regressions. rendering Behavior when preparing or drawing geometry to the screen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant