Viewer NRG Support#18495
Conversation
| // 5. The environment shadows are not yet in a ready state. | ||
| // 6. The SSAO pipeline is not yet in a ready state. | ||
| // 7. At least one model should render (playing animations). | ||
| // 8. A model (or other asset) load is in flight. |
There was a problem hiding this comment.
Condition 8 prevents a subtle snapshot timing bug: when the camera stops moving while a model is still loading, scene.isReady() returns true (the model is not yet in the scene, so there are no pending effects to check). The "render ready frame" logic would then fire onRenderingSuspended() before addAllToScene() has been called, and the resulting snapshot would capture only the background. Keeping _shouldRender true for the duration of any in-flight load ensures that effects are compiled (via rendered frames) before the snapshot helper is allowed to record a new snapshot.
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Reviewer - this PR has made changes to one or more package.json files. |
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18495/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18495/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/18495/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
🟢 Memory Leak Test Results13 passed, 0 leaked out of 13 scenarios 🟢 All memory leak tests passed — no leaks detected. Passed Scenarios (13)
|
|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
This is a Draft PR. I'm looking for feedback before continuing.
I want to be able to load a custom NRG in the viewer. To do this, I've made some changes to
viewer.ts:_setActiveFrameGraphand_bindObjectList, give derived classes the hooks they need to activate a custom FrameGraph and keep its mesh lists in sync with the scene as models load and unload. An SSAO guard ensures the standard SSAO pipeline isn't created when a frame graph is active, since the two rendering paths are incompatible.onAfterRenderObservablewas previously wired toscene.onAfterRenderCameraObservable, which is part of the per-camera render loop. That loop is bypassed when a frame graph is active. Switching toscene.onAfterRenderObservable(which fires at the end of everyscene.render()regardless of rendering path) ensures thatviewerrenderevents — and therefore hotspot annotation position updates — continue to fire correctly in all rendering modes._shouldRendernow stays true for the duration of any in-flight model load, preventing the snapshot helper from capturing a background-only frame before the new model has been added to the scene.I also made some changes to
TransmissionHelper.tsto support unbinding things when needed. In my test viewer, I was loading a frame graph after already potentially loading a scene with transmission and needed these fixes.