Skip to content

fix(test): wait for rendered frames instead of wall-clock delays before GPU readbacks - #523

Closed
Codeboy-cn wants to merge 23 commits into
Orillusion:mainfrom
Codeboy-cn:fix/ci-frame-waits
Closed

Codeboy-cn wants to merge 23 commits into
Orillusion:mainfrom
Codeboy-cn:fix/ci-frame-waits

Conversation

@Codeboy-cn

Copy link
Copy Markdown
Collaborator
  • test wait for rendered frames instead of wall-clock delays before GPU readbacks

lslzl3000 and others added 23 commits July 31, 2026 23:34
Keep the last valid yaw when the camera direction has no usable XZ projection. Use the world Y axis so camera roll does not affect BillboardY orientation.
PR Orillusion#444 was written against the 0.8 static-singleton API and does not run
on the current engine. Rebuild it on the per-Context3D API, and implement
the sun disc the PR left as a known gap.

Multi-instance port:
- thread Context3D through the whole LUT chain: VirtualTexture(..., ctx),
  HDRTextureCube.createFromTexture(size, tex, ctx), Engine3D.res ->
  Engine3D.resFor(ctx), static GPUContext -> this._boundCtx.gpuContext
- AtmosphericComponent builds the GPU sky lazily through _ensureSky(ctx)
  off a CPU-side pending setting, mirroring the core component, and gains
  a useAsEnvMap toggle
- renderer/SkyRenderer re-exports core's renderer instead of keeping the
  forked 0.8 copy, whose EntityCollect.instance.sky and Engine3D.setting
  no longer exist
- register the WGSL chunks at module scope: ComputeShader expands the
  includes in its constructor, so registering them from component init()
  was too late
- package.json / tsconfig.json / vite.config.js aligned with the other
  packages (peerDependencies >=0.9.0, module:dev, docs script), and the
  package wired into build:packages / docs

Bugs found while porting:
- RenderSkyRayMarching never read displaySun, so the LUT path drew no sun
  at all and only the legacy showV1 sky had one. Add a limb-darkened disc
  attenuated by the view ray's accumulated transmittance, parameterised
  like V1 so sunRadius / sunBrightness behave the same on both paths.
- the multi-scattering kernel dispatched 64 workgroups in z, where its 64
  z-threads are a per-workgroup reduction: 64x redundant work
- the sky-view LUT dispatched a truncated 13.5 workgroups in y, silently
  dropping 4 of its 108 rows
- pad the 13 uniform scalars out to 16 floats: WGSL starts skyColor's
  vec4 on a 16-byte boundary, the CPU-side allocator only aligns to 4
- LUT subclasses no longer re-run initCompute, which leaked a
  ComputeShader and a UniformGPUBuffer each

samples/ext/Sample_AtmosphericSky.ts is replaced by
samples/atmosphere/Sample_AtmosphericSky.ts. The old one calls
createExampleScene() with no engine and the static Engine3D.startRenderView,
so it no longer type-checks; the new one uses the instance API and also
fixes its camera fov slider, which never rebuilt the projection matrix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…d-y-sway

fix(sprite): 修复 BillboardY 垂直视角下左右甩动 (fix Orillusion#504)
…endpoint-order-s22

fix(math): correct Vector2 lerp endpoint order
* feat(pick): MeshBVH triangle BVH for CPU raycasts; closest-hit MeshColliderShape; implement BoundingBox.intersectsRay / BoundingSphere.updateBound

- core/tree/bvh/MeshBVH: flat typed-array BVH per GeometryBase (WeakMap cache),
  mean/median centroid split, allocation-free near-first traversal with
  best-t pruning, Möller–Trumbore, backface culling, maxT, face normal,
  raycastBruteForce reference; 320k tris build in ~140 ms, ~13 µs/ray vs
  ~4.4 ms brute force (×300)
- MeshColliderShape.rayPick: uses the BVH, returns the NEAREST hit instead of
  the first triangle in index order, world-space distance/point under scale,
  barycentric-interpolated vertex normal (face normal fallback), backfaceCulling
- BoundingBox.intersectsRay and BoundingSphere.updateBound no longer throw
  'Method not implemented'; setFromCenterAndSize keeps min/max/extents in sync
- samples/pick/Sample_MeshBVHPick: 320k-tri sphere + torus + scaled boxes,
  hover marker with normal indicator, BVH stats and BVH-vs-brute benchmark
- test/system/MeshBVH.test: 7 cases (build stats, 500 random rays == brute
  force, closest/culling/inside/maxT, cube, world-space collider pick, bounds,
  ≥5× speedup)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(pick): world-space collider hits, inverse-transpose normals, screen ray canvas offset

- ColliderShape.rayPick results are now world space for every shape:
  Box/Sphere used to return a local-space point and distance, so PickFire
  sorted them against MeshColliderShape's world distances and could pick
  the wrong object under scale. The local point is kept in HitInfo.localPoint.
- SphereColliderShape measured distance to a stale shared scratch vector
  instead of its own hit point, and returned the shared Vector3.HELP_3;
  it now solves the quadratic itself (exit point when the ray starts inside,
  like Box) and returns an outward normal.
- BoxColliderShape returns the hit face normal.
- MeshColliderShape transformed normals with the model matrix; use the
  inverse transpose (ColliderShape.transformNormal) so normals stay
  perpendicular under non-uniform scale. Results are fresh objects.
- RotationControlComponents' ring-radius test now reads localPoint.
- CameraUtil.UnProjection subtracted the canvas offset from coordinates that
  InputSystem had already made canvas-relative, so screenPointToRay was off
  whenever the canvas was not at the page origin.
- test/system/RayPick.test: 5 cases, all failing before this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(bvh): all-hits / any-hit / tree-less queries, sub-geometries, compose_bin, auto refit

MeshBVH
- Queries take an options object { cull: 'none'|'back'|'front'|boolean,
  near, far } and return a fresh hit (or write into an optional target)
  instead of one static object shared by every tree.
- raycastAll(): every crossing, sorted by distance.
- intersectsRay(): real any-hit early-out instead of a closest-hit query.
- Static raycastGeometry() / raycastGeometryAll(): the same queries without
  building a tree, so a brute-force fallback no longer requires one.
- Hits report frontFace and subGeometryIndex; only LOD 0 index ranges of
  each SubGeometry are indexed (previously every index, including other
  LODs). getSubGeometryIndex().
- Positions/attributes are read through getAttributeView(), which also
  understands the interleaved `all` buffer of compose_bin (prefab)
  geometry; the BVH used to throw "no position attribute" on those.
- build() forces a (re)build with a given leaf size; get() ignored
  maxLeafTris once cached.
- refit(): recompute node bounds after moving vertices in place.
- get() follows the new GeometryBase.version: a position re-upload refits,
  replaced vertex/index arrays rebuild.
- Traversal stack is sized from the tree depth; the fixed 128-entry stack
  overflowed on deep trees and the traversal then spun forever.
- Doc: splits are at the centroid-bounds midpoint, not the mean.

GeometryBase.version / GeometryVertexBuffer.positionVersion: change
counter bumped by setIndices/setVertexs/setAttribute and position uploads.
GeometryVertexBuffer.composeBinLayout getter.

test/system/MeshBVH.test: 12 cases (adds cull/near/far, raycastAll,
tree-less parity, true non-indexed geometry, compose_bin, sub-geometry/LOD
ranges, version refit/rebuild, depth > 128).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(pick): Raycaster — CPU ray picking against mesh triangles (Orillusion#501)

New src/io/raycast:
- Raycaster (three.js-style): setFromCamera (canvas pixels),
  setFromCameraNDC, set(origin, dir); intersectObject / intersectObjects
  (recursive, sorted by distance), intersectFirst (closest hit with
  best-distance pruning across meshes). Works on any MeshRenderer, no
  ColliderComponent needed. Options: near/far, layerMask (against
  visibleLayer), filter(renderer), side ('material' follows each sub-mesh
  material's cullMode; 'front'/'back'/'double'), firstHitOnly, useBVH
  ('auto' uses a tree if one was built and otherwise scans triangles,
  'always', 'never'). Skips disabled objects/renderers, disabled materials
  and non-triangle-list topologies per sub-mesh; renderers batched by an
  InstanceDrawComponent stay pickable.
- RaycastHit: distance, point, localPoint, normal (interpolated, world,
  inverse transpose), faceNormal, faceIndex, barycentric, frontFace, uv,
  uv1, subGeometryIndex, object3D, renderer. Fresh objects per hit.
- MeshRaycast: the shared world-space geometry query; handles mirrored
  transforms (winding flips, as the rasterizer sees it).

MeshColliderShape now runs on MeshRaycast; HitInfo gains optional
faceNormal / faceIndex / barycentric / uv / uv1 / subGeometryIndex /
frontFace. New useBVH and maxDistance options.

MeshBVH.raycastAll reports a crossing through a shared edge/vertex once.
CameraUtil.UnProjectionNDC.

test/system/Raycaster.test: 8 cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(pick): PickFire event data with face/uv/all hits, collider filters, auto mesh collider geometry

- PickFire `bound` mode: event `data` now also carries localPos, faceNormal,
  faceIndex, barycentric, uv, uv1, subGeometryIndex, frontFace (mesh
  colliders) and `hits` — every collider hit, nearest first. The objects
  are created per pick, so a later pick no longer rewrites data handed out
  earlier (pickResult type extended accordingly).
- PickFire.layerMask (against the collider's visibleLayer) and
  PickFire.filter(collider) to exclude colliders from picking.
- ColliderComponent: a MeshColliderShape with no `mesh` picks the geometry
  of the MeshRenderer on the same object.
- RayPick.test: PickFire end-to-end case (nearest of a scaled box and a
  mesh sphere, hit data, all hits, data stability, filter, layerMask).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(samples): MeshBVH pick sample shows face/uv/all hits and a scene-wide Raycaster

- Hover (PickFire bound mode): face index, uv, sub-mesh and how many
  colliders the ray crosses, from the extended event data.
- Click: Raycaster over the whole scene, listing every hit (object, face,
  distance, back-face flag); GUI switches for useBVH / side / firstHitOnly.
- Mesh colliders no longer set `shape.mesh` (taken from the MeshRenderer);
  the big sphere's tree is prebuilt with MeshBVH.build.
- RayPick.test: the rotation gizmo picks each ring by its own axis under a
  scaled container (fails if the ring test reads the world-space point).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(pick): pick skinned and morph-target meshes as drawn (CPU deformation)

The GPU deforms these meshes in the vertex shader, so ray picks against
the static geometry hit the bind pose (for skinned glTF the skinning
matrix replaces the node transform, so hits could be off entirely).

- MeshDeformer replays the shader on the CPU: morph targets first
  (position * baseInfluence + Σ w_i * a_morphPositions_i, via vIndex),
  then skinning — each bone's world matrix read from the same global
  matrix slot the shader reads (Matrix4.dynamicGlobalMatrixRef), times the
  skin's inverse bind matrix, blended by joints0/weights0 (+joints1/
  weights1). Works for SkinnedMeshRenderer2 + AnimatorComponent (glTF) and
  SkinnedMeshRenderer + SkeletonAnimationComponent (prefab). Output is a
  CPU-only geometry (no GPU buffers), cached per renderer and recomputed
  only when bone matrices or morph weights change; queries use a refit BVH.
- MeshRaycast.intersectRenderer: renderer-aware query used by Raycaster
  and MeshColliderShape. Raycaster.deformation / MeshColliderShape
  .deformation: 'cpu' (default) | 'bindPose' | 'skip'. ColliderComponent
  fills MeshColliderShape.renderer so PickFire follows animation too.
- AnimatorComponent.jointMatrixIndexTable (CPU copy of the GPU table);
  MorphTargetData.influences / morphTargetCount / baseInfluence.
- MeshBVH.getAttributeView: 4-wide joints/weights, 1-wide vIndex, 3-wide
  morph attributes.
- test/system/SkinnedRaycast: CPU hits vs the GPU pixel picker's G-buffer
  position on an animated Soldier (10/10 within 0.3 on a ~36-unit model;
  bind pose 0/10) and the lion's blend shapes (9/9); morph math for
  relative/absolute targets, modes and caching; mesh collider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(samples): Sample_SkinnedMeshPick — picking animated soldiers and a blend-shape lion

Picks every frame under the mouse: red marker on the surface as drawn
(CPU deformation), yellow along the normal, blue where a bind-pose pick
would land. GUI: pause/clip, lion blend-shape sliders, deformation mode,
hit info and pick time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: update comment

* test(pick): load the skinned and morph test models from the CDN

CI checks out without the public/ assets submodule, so Soldier.glb and
lion.glb were missing there and both glTF tests failed to parse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(pick): build the skinned and morph test meshes in code

Replace the CDN-loaded Soldier.glb and lion.glb with a procedural
two-bone skinned strip and a morph-target bump grid, so the test needs
no network and runs in about half the time. Sample triangle centroids
spread over the whole mesh instead of vertices, keeping GPU picks off
silhouette edges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci: raise the Electron test timeout to 10 minutes

The suite already takes about 4 minutes on GitHub runners, so the
5-minute limit fails any branch that adds a few test files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Orillusion <admin@orillusion.com>
…utral (Orillusion#510)

- TonemapSetting.mode: 'None' | 'ACES' | 'Reinhard' | 'Uncharted2' | 'AgX' | 'Neutral', plus whitePoint (Reinhard)
- TonemapShader: WGSL curves selected by an integer mode; negative HDR input clamped once
- TonemapUtil: CPU mirror of the shader (mode selector table + apply()), for tooling and GPU-vs-CPU validation
- TonemapPost: uploads mode index, whitePoint and the alignment pad (every MaterialUniform field must be set before bind-group generation)
- samples/post/Sample_Tonemap: emissive intensity ramps in six hues + lit strip, GUI for mode / exposure / whitePoint with a CPU probe readout
- test/components/PostEffects_Tonemap.test: curve properties on CPU, and a half-float readback of the tonemap target compared against TonemapUtil for every mode at two exposures

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…F extension (Orillusion#513)

* test(post): poll for the asserted texture size instead of racing the first frame / resize

TAA used a fixed 500 ms delay at 2 fps; GTAO and SSR sampled the texture width
between the canvas ResizeObserver and the post's onResize. All three flaked
under full-suite load. They now waitUntil the width matches, then assert.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(material): KHR_materials_sheen — sheen lobe on LitMaterial + glTF extension

- Sheen_frag: Charlie distribution + Neubelt visibility for direct / point / spot lights (with shadows), analytic DG fit for the environment term, base layer energy compensation 1 - 0.157·max(sheenColor)
- MaterialUniform.sheenColor (rgb tint, a = roughness) with StandShader default; BxDF applies the layer under USE_SHEEN
- LitMaterial.sheenColor / sheenRoughness (non-black color toggles the define), clone copies it
- KHR_materials_sheen.apply: sheenColorFactor / sheenRoughnessFactor (textures not sampled yet), wired into the glTF converter
- samples/material/Sample_Sheen: roughness sweep, tinted vs no-sheen rows, GUI-driven torus
- test/components/Material_Sheen.test: API + extension parsing, and a GPU readback proving output = base·(1-0.157·m) + sheen·S, tint selectivity and roughness dependence

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(sample): enable csm

---------

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Orillusion <admin@orillusion.com>
…Orillusion#512)

* feat(fluid): FluidRenderer and FluidPass screen-space fluid rendering

- FluidRenderer: renders a particle set as a continuous liquid surface.
  Positions in the owner's local space come from a CPU Float32Array
  (setDataBuffer) or an existing storage buffer (setDataBufferGPU, e.g.
  a simulation compute shader), with a configurable stride / offset.
- FluidPass, opt-in via `setting.render.fluid`: added by
  ForwardRendererJob after the opaque/transmission half (after decals)
  and before sorted transparents.
  - Sphere-impostor depth clipped by opaque scene depth (z-prepass or
    G-buffer, stencil and log depth aware).
  - Depth smoothing with a bilateral or narrow-range filter that keeps
    surfaces flat at walls, behind geometry and at grazing angles.
  - Optional anisotropic ellipsoid particles from a GPU neighbor search.
  - Thickness accumulated per particle or measured geometrically
    (near-to-far distance) for even absorption.
  - Shading: normals from the smoothed depth, refraction to the scene
    behind, Beer-Lambert absorption, fresnel environment reflection,
    specular highlight, and edgeSoftness to fade thin free edges.
  - Debug views of the intermediate depth, thickness and normal maps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(fluid): FluidPass placement, rendering paths and FluidRenderer options

- FluidPass is absent unless setting.render.fluid is on, and runs after
  the opaque half and before transparents.
- CPU particles; fixed thickness, no environment, stencil and log depth;
  anisotropic ellipsoids with the narrow-range filter.
- Two engines rendering fluid at once.
- Particle data layout and debug feature GUI values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(fluid): FLIP and CPU particle fluid samples in a pool scene

- Sample_FluidFLIP: the GPU FLIP solver from samples/compute/fluid handed
  to FluidRenderer with setDataBufferGPU; stir the water with the mouse.
- Sample_FluidRenderer: CPU particles dropping into a box with a pillar
  that clips the fluid.
- Both samples have a GUI for the fluid shading, depth filter, thickness
  mode, anisotropy and pool visibility.
- _PoolScene: shared tiled swimming pool around the fluid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Orillusion <admin@orillusion.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…nd caustics (Orillusion#511)

* feat(water): WaterRenderer with Gerstner/FFT waves, underwater view and caustics

- WaterRenderer (MeshRenderer): a grid (or custom surface mesh of any
  outline) displaced in world space by up to eight Gerstner waves, or by an
  FFT ocean (WaterFFT + WaterSpectrum) with texture foam. Waves fade with
  distance; a rasterized footprint mask (WaterFootprint) bounds the surface.
  getHeight(x, z) evaluates the same surface on the CPU, FFT included.
- Interactive ripples (WaterRipples) with addRipple() and a ripple area for
  water larger than one ripple grid; ripples spread as rings and cast caustics.
- WaterMaterial / WaterShader: drawn by the transmission pass. Refraction of
  the wave distortion only, faded toward objects above the water; Beer-Lambert
  absorption over the real depth; fresnel-weighted reflection and sun
  highlight; scattered water color, fine surface detail, whitecaps and crest
  glow.
- Render passes, opt-in via `setting.render.water`:
  - WaterSimulationPass: steps FFT waves and ripples.
  - CausticsPass: sunlight caustics under the surface (on/off switch).
  - SceneLinearDepthPass: scene depth for water depth and leak-free refraction.
  - UnderwaterPass: underwater view with waterline band, absorption, Snell's
    window and underside reflection; rotated/scaled and multiple surfaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(water): WaterRenderer surfaces, ripples, FFT ocean and underwater pass

- Rendering and animation; setting.render.water pass order.
- getHeight against the Gerstner surface; isUnderwater against the footprint.
- Custom surface outlines, underwater and with caustics.
- addRipple and ripple rendering on rectangle and custom surfaces.
- WaterSpectrum FFT cascade height statistics and wind direction.
- Underwater/FFT rendering under MSAA, log depth and without a z-prepass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(water): pool, lake and ocean samples

- Sample_Pool: tiled pool with floating balls (click to push them under)
  and a rubber duck, ripples, caustics and a clear underwater view.
- Sample_Lake: custom-outline lake surface.
- Sample_Ocean: FFT sea with sea controls.
- WaterSampleUtil: shared scene setup and a short GUI with both water colors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(shader): pooled reflection overwritten when a pass changes variant

genReflection() cleared and refilled the pass's current reflection on a
pool miss. After a pool hit that object is the pooled reflection of the
previous variant, so other passes of that variant then built their bind
group layouts from the new variant's bindings ("Binding type in the
shader (texture) doesn't match the type in the layout (sampler)").
Start from a fresh reflection instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(water): caustics shader hung software rendering

Each ripple sample switched over the four ripple maps, and with nine
samples per slope and four slope evaluations the inlined shader grew to
over a thousand texture reads. SwiftShader never finished compiling it,
so the GPU process was killed (CI). Read the 4x4 texels once per slope
and interpolate the nine samples from them; the result is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(water): wait for frames instead of fixed delays

Under software rendering a frame takes up to seconds (the FFT ones
longest), so fixed delays could pass without a frame. Poll with
waitUntil for ripples and FFT heights, and step the FFT test by whole
frames, paused while reading back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Orillusion <admin@orillusion.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…illusion#514)

- LensPost: one fullscreen pass in scene-linear HDR (before tonemap); properties proxy setting.render.postProcessing.lens
- LensShader: radial R/B split (intensity 1 ≈ 5 % UV at the screen edge), multiplicative hash grain with optional frozen seed, Unity-style vignette with smoothness / roundness / color
- LensUtil: CPU mirror of the vignette and aberration math
- LensSetting + engine defaults
- test/util: readRowRGBA16F readback helper
- samples/post/Sample_Lens: high-contrast pillar field, GUI for every parameter and attach/detach
- test/components/PostEffects_Lens.test: passthrough at zero, vignette GPU == CPU at five screen points + tint, R/B fringe at an off-axis edge, grain variance / static / animated / off, removePost

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…n#515)

- Spherical: promoted from OrbitController's private class to a public math type (same fields and methods; adds copy/clone/toVector3 and the three.js setFromCartesianCoords alias); OrbitController now imports it
- Cylindrical: radius / theta / y with cartesian round trip
- Box2: 2D AABB (expand, contains, intersects, clamp, distance, intersect/union, translate, parameter)
- CatmullRomCurve3: centripetal / chordal / uniform (tension) spline through control points, open or closed, arc-length reparameterization (getPointAt / getSpacedPoints / getTangentAt / getLength) with a cache keyed on the control points
- samples/base/Sample_CatmullRomPath: spline with equal-arc vs equal-parameter markers, constant-speed follower, Spherical and Cylindrical satellites
- test/math: Spherical (+Cylindrical), Box2, CatmullRomCurve3 — 12 cases

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…als_variants; fix non-indexed index overflow (Orillusion#516)

- KHR_mesh_quantization: integer POSITION / NORMAL / TANGENT / TEXCOORD accessors are expanded to Float32 at load with the glTF normalization rules
- KHR_materials_specular: specularFactor / specularColorFactor → PBR specularColor uniform (rgb F0 tint, a strength)
- KHR_materials_variants: mappings parsed per primitive; new MaterialVariants component on the asset root (variantNames, selectVariant by name / index / null); skinned renderers get their own clones
- converter: material creation extracted into getOrCreateMaterial so variant materials share the cache
- fix: non-indexed primitives built their fallback index buffer as Uint8Array, wrapping every index above 255 (any non-indexed mesh over 85 triangles was scrambled); now Uint16 / Uint32
- samples/utils/GLBBuilder: in-memory GLB writer + generated asset (quantized sphere, 3 variants, specular, sheen, 100-triangle non-indexed ribbon)
- samples/loader/Sample_GLTFVariants, test/components/GLTF_Extensions.test (7 cases)

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* feat(post): MotionBlurPost — camera motion blur

- MotionBlur_cs: reconstructs world position from G-buffer depth, reprojects with the previous view-projection, averages the upstream color along the screen-space velocity (2–32 samples, pixel clamp); sky pixels untouched
- MotionBlurPost: compute post chained through bindUpstream; intensity (shutter), samples, maxBlurPixels, frameRateIndependent, resetHistory(); first frame and resize use zero velocity
- MotionBlurUtil: CPU mirror (projectToUV, velocityPixels, shutterScale)
- MotionBlurSetting + engine defaults
- samples/post/Sample_MotionBlur: auto-orbiting camera over a pillar field with GUI
- test/components/PostEffects_MotionBlur.test: sharp when static, smear ≈ per-frame displacement when dollying, intensity scaling / off, pixel clamp, recovery after stop, removePost

Limitation: camera-driven motion only (no per-object velocity in the G-buffer).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test(post): wait for rendered frames in MotionBlur test

Software WebGPU in CI (SwiftShader) renders at ~2 fps, so the fixed
millisecond delays after changing intensity or stopping the camera were
shorter than one frame and the first readback still showed the previous
setting. Wait on Time.frame instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Orillusion <admin@orillusion.com>
Orillusion#518)

BitmapTexture2D.load decoded data URIs with <img>.decode() on a detached
element. Chrome defers that decode while the document is hidden, so
loadTexture('data:image/...;base64,...') never resolved in a background tab
or in an iframe of one, and everything awaiting it stalled (Sample_PhysicsCar
never started rendering). Decode through fetch → Blob → createImageBitmap,
the same path URL textures use; size / flip / format handling is unchanged.

Adds a base64 case to Texture.test.

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…Orillusion#519)

* fix: Rapier 0.19 API drift, first-frame Time.delta, staging-buffer pool leak; add audit docs

- physics-rapier: replace removed World.updateSceneQueries with propagateModifiedBodyPositionsToColliders, drop removed numAdditionalFrictionIterations, gate CharacterController.move until first world.step (Physics.stepCount), bump dependency to ^0.19.3
- Engine3D: first frame and post-resume frame use a nominal 1/60 s delta instead of the whole page-load / pause duration
- GPUBufferBase.mapAsyncWrite: track real in-flight count, cap idle staging pool, release pool on destroy, warn once per backlog
- Sample_Label: camera at the 10 m distanceInvariant reference depth
- docs: BUG_AUDIT / ENGINE_COMPARISON / STATUS 2026-09 (force-added; /docs is gitignored for typedoc output)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(lod): add LODGroup component with screen-size / distance metrics, demo and tests

- LODGroup: N levels of Object3D sets toggled via transform.enable, finest-first
  sorting, Unity-style screen-relative-height metric (perspective + ortho) or
  three.js-style distance metric, bias, hysteresis dead-band, cullBeyondLast,
  forceLevel (null = auto, CULLED forces hidden), auto bounding radius from
  level AABBs, onLevelChange, cloneTo, setThresholds for mode switches
- samples/render/Sample_LOD: 576-group field with three colored levels, live
  per-level counts and triangle total, GUI for mode / bias / hysteresis / force
- test/components/LODGroup.test: 8 cases (metric math, auto radius, level
  switching + culling, hysteresis, distance mode, mode-switch mapping,
  forceLevel, events / removeLevel)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… LitMaterial + glTF extension (Orillusion#520)

- Iridescence_frag: Belcour & Barla thin-film Fresnel (same model as the Khronos viewer / three.js); the film Fresnel is converted back to a Schlick F0 and blended in by the factor, so direct and IBL specular both pick up the hue under USE_IRIDESCENCE
- MaterialUniform.iridescence (factor, film IOR, thickness nm) with StandShader default
- LitMaterial.iridescence / iridescenceIOR / iridescenceThickness; clone copies them
- KHR_materials_iridescence.apply (factor, ior, thicknessMaximum; textures not sampled yet)
- IridescenceUtil: CPU mirror of the shader
- samples/material/Sample_Iridescence: thickness sweep, IOR sweep, no-film row, GUI torus
- test/components/Material_Iridescence.test: model limits, API + extension, GPU hue ordering vs the CPU model across six thicknesses, factor blend, IOR dependence, exact restore when switched off

Co-authored-by: shabai517 <shabai517@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…re GPU readbacks

CI runs WebGPU on SwiftShader at ~2 fps or slower, so a 300-500 ms delay after
changing a setting often covers no frame at all and the readback sees the
previous image (Material_Sheen failed this way on CI). Add a shared
`frames(n)` helper to test/util.ts and use it in the Sheen, Iridescence,
Tonemap, Lens and Water tests wherever an assertion depends on a new frame.
Lens now also waits a frame between the two grainStatic reads so they really
compare two frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Codeboy-cn Codeboy-cn closed this Nov 5, 2026
@Codeboy-cn Codeboy-cn reopened this Nov 5, 2026
@Codeboy-cn Codeboy-cn closed this Nov 5, 2026
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.

5 participants