Skip to content

chore: migrate examples from orbit-camera script to ESM CameraControls - #9234

Draft
kpal81xd wants to merge 1 commit into
mainfrom
chore/examples-camera-controls
Draft

chore: migrate examples from orbit-camera script to ESM CameraControls#9234
kpal81xd wants to merge 1 commit into
mainfrom
chore/examples-camera-controls

Conversation

@kpal81xd

@kpal81xd kpal81xd commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Migrates the remaining 79 examples from the legacy UMD orbit-camera.js script to the ESM CameraControls script (playcanvas/scripts/esm/camera-controls.mjs).

Standard swap = orbitCamera + ...InputMouse/Touch replaced by a single CameraControls (enableFly: false); distanceMin/distanceMaxzoomRange, pitchAngle*pitchRange, focusEntity/lookAtfocusPoint. Framing corrected = CameraControls has no frameOnStart auto-fit, so the camera position + focus point were set explicitly to reproduce the original view.

Each example was rendered headlessly (WebGL2) and compared side-by-side against its original orbit-camera version.

Example Change notes Tested in parity
compute/indirect-dispatch Standard swap ⚠️ WebGPU — lint/typecheck only
compute/particles Swap; runtime orbitCamera.focusEntity=s1cameraControls.focusPoint=s1.getPosition() ⚠️ WebGPU — lint/typecheck only
compute/vertex-update Standard swap ⚠️ WebGPU — lint/typecheck only
gaussian-splatting/simple reset(yaw,pitch,distance) → computed camera position around pivot ✅ matches
gaussian-splatting/simple-glb reset(yaw,pitch,distance) → computed camera position around pivot ✅ matches
gaussian-splatting/simple-on-demand reset(yaw,pitch,distance) → computed camera position around pivot ✅ matches
gaussian-splatting/simple-spz reset(yaw,pitch,distance) → computed camera position around pivot ✅ matches
gaussian-splatting/spherical-harmonics reset(yaw,pitch,distance) → computed camera position around pivot ✅ matches
gaussian-splatting/multi-splat reset(yaw,pitch,distance) → computed camera position around pivot ✅ matches
gaussian-splatting/multi-view Standard swap ✅ matches
gaussian-splatting/shadows Standard swap ✅ matches
gaussian-splatting/xr-views Standard swap ✅ matches
gaussian-splatting/flipbook Standard swap; focusPoint from lookAt ✅ matches
gaussian-splatting/viewer Swap; frameOnStart dropped, focusPoint = computed model centre ✅ matches
gaussian-splatting/global-sorting resetAndLookAtPoint(pos,target)reset(target,pos) ✅ matches
gaussian-splatting/shadow-soft resetAndLookAtPointreset ✅ matches
gaussian-splatting/picking resetAndLookAtPointreset; ortho toggle left intact ✅ matches
gaussian-splatting-legacy/picking resetAndLookAtPointreset; ortho toggle left intact ✅ matches
gaussian-splatting/paint resetAndLookAtPointreset; RMB-paint input gate via cameraControls.enabled ✅ matches
gaussian-splatting/editor resetAndLookAtPointreset; gizmo input gate via cameraControls.enabled ✅ matches
gaussian-splatting/crop Auto-rotate re-implemented (per-frame reset() azimuth advance) ✅ matches
gaussian-splatting/reveal Auto-rotate re-implemented ✅ matches
gaussian-splatting/shader-effects Auto-rotate re-implemented ✅ matches
gaussian-splatting/shader-dissolve Auto-rotate re-implemented ✅ matches
gaussian-splatting/shader-rings Auto-rotate re-implemented; initial reset(yaw,pitch,dist) → computed pose ✅ matches
gaussian-splatting/glass-refraction Auto-rotate re-implemented ⚠️ not comparable (blank in both here) — external Poly Haven HDRI blocked
gaussian-splatting/procedural-mesh Framing corrected: focus tree pivot + first-frame distance via reset ✅ matches (framing corrected)
graphics/clustered-area-lights Standard swap ✅ matches
graphics/clustered-light-cookies Standard swap ✅ matches
graphics/clustered-lighting Standard swap; focusPoint from lookAt ✅ matches
graphics/clustered-spot-shadows Standard swap ✅ matches
graphics/dithered-transparency Standard swap ✅ matches
graphics/instancing-glb Standard swap ✅ matches
graphics/light-physical-units Standard swap; zoomRange from distanceMin/Max ✅ matches
graphics/lights-baked-a-o Standard swap ✅ matches
graphics/particles-snow Standard swap ✅ matches
graphics/reflection-box Swap; cubemap-renderer script left intact ✅ matches
graphics/render-to-texture Swap; separate ortho texture-camera left intact ✅ matches
graphics/shadow-catcher Standard swap; focusPoint from lookAt ✅ matches
graphics/multi-view Swap; second ortho camera left intact ✅ matches
graphics/taa Swap; frameOnStart dropped, focusPoint = house ✅ matches
graphics/asset-viewer Swap; runtime focusEntity reassignment → focusPoint ✅ matches
graphics/particles-mesh orbitCamera.pivotPointfocusPoint ✅ matches
graphics/ambient-occlusion Framing corrected (distance); ssao post-effect script left intact ✅ matches (framing corrected)
graphics/outlines-colored Framing corrected (distance) ✅ matches (framing corrected)
graphics/post-processing Framing corrected (position + focus) ✅ matches (framing corrected)
graphics/depth-of-field Framing corrected (focus point) ✅ matches (framing corrected)
graphics/clustered-omni-shadows Framing corrected (focus point) ✅ matches (framing corrected)
graphics/custom-compose-shader Framing corrected (focus point) ✅ matches (framing corrected)
graphics/lights Framing corrected (focus point) ✅ matches (framing corrected)
graphics/lights-baked Framing corrected (distance + focus) ✅ matches (framing corrected)
graphics/sky Framing corrected (focus statue) ✅ matches (framing corrected)
graphics/shadow-cascades Framing corrected: focus tree pivot + first-frame distance ✅ matches (framing corrected)
graphics/shadow-soft Framing corrected: focus tree pivot + first-frame distance ✅ matches (framing corrected)
graphics/volumetric-fog Framing corrected: focus tree pivot + first-frame yaw/pitch/distance ✅ matches (framing corrected)
graphics/volumetric-fog-local-lights Framing corrected: focus tree pivot + first-frame yaw/pitch/distance ✅ matches (framing corrected)
materials/anisotropy-lamp yaw/distance → computed camera position ✅ matches
materials/normals-and-tangents yaw/distance → computed camera position ✅ matches
materials/transmission-roughness yaw/distance → computed camera position ✅ matches
materials/dispersion Standard swap; zoomRange from distanceMax ✅ matches
materials/lit-material Standard swap; zoomRange from distanceMin/Max ✅ matches
materials/anisotropy-disc Framing corrected (AABB-centre focus + position) ✅ matches (framing corrected)
materials/anisotropy-rotation Framing corrected (AABB-centre focus + position) ✅ matches (framing corrected)
materials/anisotropy-strength Framing corrected (AABB-centre focus + position) ✅ matches (framing corrected)
materials/clear-coat Framing corrected (AABB-centre focus + position) ✅ matches (framing corrected)
shaders/shader-material-shadows Standard swap ✅ matches
shaders/texture-array Framing corrected (focus + position) ✅ matches (framing corrected)
shaders/shader-hatch Framing corrected (distance) ✅ matches (framing corrected)
shaders/ground-fog Framing corrected: focus tree pivot + first-frame distance ✅ matches (framing corrected)
test/opacity Standard swap; zoomRange from distanceMin/Max ✅ matches
test/texture-ktx2-cubemap Standard swap ✅ matches
test/xr-views Standard swap ✅ matches
test/taa-alpha Swap; sole asset was orbit-camera → empty asset list ✅ matches
test/global-shader-properties Standard swap ✅ matches
test/primitive-mode yaw/distance → computed camera position ✅ matches
test/contact-hardening-shadows Focus occluder + first-frame distance via reset ✅ matches
test/specular Framing corrected (distance) ✅ matches (framing corrected)
test/attenuation yaw/distance → computed camera position ⚠️ not comparable (blank in both here) — model blank in both here
user-interface/world-ui Framing corrected (distance) ✅ matches (framing corrected)

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

@github-actions

Copy link
Copy Markdown

Build size report

This PR does not change the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2386.8 KB — 613.4 KB — 475.7 KB —
playcanvas.min.mjs 2384.1 KB — 612.1 KB — 475.4 KB —

@mvaligursky

Copy link
Copy Markdown
Contributor

Make sure those are manually tested, at least the paint and editor - both gaussian splatting examples, those were bit more tricky.

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.

2 participants