Repository navigation
Conversation
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 #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>
fix(sprite): 修复 BillboardY 垂直视角下左右甩动 (fix #504)
…rder-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 (#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 (#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 (#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>
…#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 (#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>
- 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>
- 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 (#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>
#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>
…#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 (#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>
…tMaterial + glTF extension (#521) - Anisotropy_frag: derivative-based tangent frame rotated by the grain angle; the direct specular lobe is multiplied by the anisotropic/isotropic GGX ratio (D and height-correlated Smith V; exactly 1 at strength 0), and the environment lookup uses the bent reflection vector - MaterialUniform.anisotropy (strength, rotation) with StandShader default - LitMaterial.anisotropy / anisotropyRotation; clone copies them - KHR_materials_anisotropy.apply (strength, rotation; texture not sampled yet) - AnisotropyUtil: CPU mirror of the ratio - samples/material/Sample_Anisotropy: strength sweep, rotation sweep, GUI sphere - test/components/Material_Anisotropy.test: ratio limits, API + extension, GPU highlight is round at 0, stretched at 0.9, axis swaps at 90 degrees, strength 0 restores the isotropic image - test/util: readRegionRGBA16F Co-authored-by: shabai517 <shabai517@163.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…re GPU readbacks (#524) 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, Anisotropy, 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: Orillusion <admin@orillusion.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…uration, ASC-CDL and strip LUTs (#522) * feat(post): ColorGradingPost — exposure, white balance, contrast, saturation, ASC-CDL and strip LUTs - ColorGradingPost: final pass after the tonemap on display-referred color; properties proxy setting.render.postProcessing.colorGrading; lut / setLUTFromFunction for size²×size strip LUTs (clamped, no mips) - ColorGradingShader: parametric grade + manual trilinear LUT lookup (texel-centred per slice so slices never bleed) - ColorGradingUtil: CPU mirror (apply / applyWithLUT), LUT authoring (createLUTData) and lookup (sampleLUT) - ColorGradingSetting + engine defaults - samples/post/Sample_ColorGrading: colour-chart wall, GUI for every control and generated looks - test/components/PostEffects_ColorGrading.test: 12 cases — control semantics, LUT layout, GPU == CPU for seven setting combinations, neutral / channel-rotating LUT, intensity blend, removal Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * ci: raise the Electron test step limit to 15 minutes; frames() waits one frame by default The same tree has taken 405-613 s in "Test in Electron" depending on the runner, so the 10-minute limit times out on slow runners (dev f90b4d5). One whole frame begun after a setting change is enough for a readback to see it, so the default extra frame in test/util.ts frames() is dropped to shorten the GPU tests on slow software rendering. 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>
Diffuse uses Lambert's polygon form factor with an analytic sphere-proxy horizon clip; specular uses a most-representative-point GGX lobe. No lookup textures and no shadows. Adds RectLightUtil (CPU mirror), a demo, a 7-case test (brute-force integration reference + GPU readback). Co-authored-by: shabai517 <shabai517@163.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… and anisotropy maps (#526) * feat(material): KHR extension textures — sheen, iridescence, specular and anisotropy maps LitMaterial gains sheenColorMap / sheenRoughnessMap / iridescenceMap / iridescenceThicknessMap (+ iridescenceThicknessMinimum) / specularMap / specularColorMap / anisotropyMap, sampled per texel in the existing chunks; the glTF loader resolves and binds the matching KHR_* textures. Demo with Canvas2D-painted maps and an in-memory GLB, 6-case test. Engine fixes uncovered on the way: - Texture bind group is now regenerated whenever the layouts are rebuilt. - Bind group entries only get the shader stages that can reach them (ShaderStageUsage), and the device asks for the adapter's sampled-texture limit; extension maps share baseMapSampler (Metal caps samplers at 16). - Test runner window disables background throttling so an occluded window no longer stalls frame-based waits. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(shader): expand every reachable function in ShaderStageUsage; light the extension-texture test without the atmospheric sky reachableIdentifiers() marked a callee as seen when it was first referenced, so it was skipped when popped and its body was never scanned: a binding read two or more calls deep was missing from its stage, got no visibility for it, and the pipeline was invalid. Track expanded functions separately and add a unit test for nested calls, unused bindings and call cycles. Material_ExtensionTextures lit its quad with AtmosphericComponent, whose scattering shader runs so long on SwiftShader (CI) that the GPU watchdog kills the GPU process. It now uses an analytic equirectangular gradient (SkyRenderer + LDRTextureCube) that still varies by direction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: fail the running test on GPU device loss or uncaptured GPU errors test/util.ts wraps GPUAdapter.requestDevice so every device a test page creates is watched: - device lost (e.g. the GPU process killed by its watchdog) fails the running test at once, instead of it hanging on frame waits or failing a later readback with an unrelated error; - uncaptured validation errors fail the test they occur in. An invalid pipeline only logs and skips its draws, so tests that read no pixels used to stay green. Also exports gpuAdapterInfo() / isSoftwareAdapter() for scenes that are too heavy for a software rasterizer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(light): the first DirectLight in a scene enables CSM by default When a DirectLight starts and it is the first enabled DirectLight registered in its scene (usually the sun), it turns on cascaded shadow maps. Assigning `enableCSM` before or after that is kept as an explicit choice, so a light can still opt out with `enableCSM = false`. CSM only takes effect for a light that casts shadows. Sample_ExtensionTextures sets it explicitly as well. 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>
New render setting objectMotionVectors. MatrixBindGroup keeps a GPU copy of the previous frame's model matrices; every opaque material gets a VELOCITY sub-pass (VelocityPass_shader / VelocityMaterialPass) that MotionVectorPass rasterises over its camera-only compute fill, writing (uv - prevUv) into _MotionVector. MotionBlurPost samples that texture (USE_VELOCITY_TEX) so moving objects streak with a static camera. Skinned / morphed meshes carry their rigid motion only. Also: MotionVectorPass now depends on _ColorBuffer (it used to run before ColorPass and reproject last frame's depth), PostPass reads _MotionVector. Demo Sample_ObjectMotionBlur, 4-case test with CPU-predicted velocities. Co-authored-by: shabai517 <shabai517@163.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…esetHistory resets object motion vectors (#528) - SphereGeometry / TorusGeometry / CylinderGeometry / StripeGeometry stored indices in a Uint16Array unconditionally, so meshes past 65535 vertices wrapped (SphereGeometry(10, 400, 400) drew and picked the wrong triangles). They now switch to Uint32Array by vertex count. PlaneGeometry compared against Uint16Array.length (the constructor arity, 3) and always chose Uint32; it now uses the same vertex-count test. - Raycaster skips sky spheres (SkyRenderer, AtmosphericComponent, EarthSkyRenderer) unless the new `includeSky` is set; intersectObject(scene) used to hit the inside of the sky sphere ~65k units away on every miss. - MotionVectorPass gets resetHistory(): the next frame uses the current view-projection as previous and skips the object-velocity draw, so the whole texture is zero. MotionBlurPost.resetHistory() forwards to it — with objectMotionVectors the blur reads _MotionVector and its own previous matrix was ignored, so camera cuts still smeared. The first frame was also reprojected with an identity previous matrix; it now writes zero motion. Tests: sky filtering, 32-bit indices + south-pole pick on a 400x400 sphere, zero velocity on the reset frame with camera and object both moving. Co-authored-by: Orillusion <admin@orillusion.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Codeboy-cn
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0.9.5 (2026-11-06)
Features
WaterRendererwith Gerstner / FFT ocean waves, interactive ripples, sunlight caustics and an underwater view (opt-in viasetting.render.water); pool, lake and ocean samples (#511) (69ae653)FluidRendererandFluidPassscreen-space fluid rendering (opt-in viasetting.render.fluid) — depth smoothing, optional anisotropic particles, thickness, refraction and absorption; FLIP and CPU particle samples (#512) (1cffd8a)RectLight— analytic rectangular area light (Lambert polygon form factor diffuse + representative-point GGX specular) (#525) (d5b3e12)DirectLightin a scene enables CSM by default; an explicitenableCSMassignment still wins (#526) (b2d5e6e)KHR_materials_sheen— sheen lobe onLitMaterial+ glTF extension (#513) (671bbd1)KHR_materials_iridescence— thin-film interference onLitMaterial+ glTF extension (#520) (9659cdd)KHR_materials_anisotropy— anisotropic specular onLitMaterial+ glTF extension (#521) (bdb6c0c)LitMaterial, bound by the glTF loader (#526) (b2d5e6e)KHR_mesh_quantization,KHR_materials_specularandKHR_materials_variants(newMaterialVariantscomponent withselectVariant) (#516) (76dc157)TonemapSetting.mode,whitePoint) with a CPU mirrorTonemapUtil(#510) (01128b0)LensPost— vignette, chromatic aberration, film grain (#514) (c44cd00)MotionBlurPost— camera motion blur withresetHistory()(#517) (fa46b16)ColorGradingPost— exposure, white balance, contrast, saturation, ASC-CDL and strip LUTs, with CPU mirrorColorGradingUtil(#522) (bef7b47)objectMotionVectorsrender setting, velocity sub-pass written into_MotionVector) (#527) (2f44234)LODGroupcomponent with screen-relative-height / distance metrics, bias, hysteresis andforceLevel(#519) (f5bda99)MeshBVHtriangle BVH for CPU raycasts (closest / all / any-hit queries, sub-geometries,compose_bingeometry, auto refit) (#509) (2e4be97)Raycaster— CPU ray picking against mesh triangles without a collider (#501)PickFireevent data with face / uv / all hits and collider filters; auto mesh collider geometryBoundingBox.intersectsRayandBoundingSphere.updateBoundimplementedSpherical,Cylindrical,Box2,CatmullRomCurve3(#515) (f2d4944)@orillusion/atmospherepackage (#444) (18cd142), ported to the multi-instance engine API with a limb-darkened sun disc anduseAsEnvMaptoggle (37e55d8)Bug Fixes
SphereGeometry/TorusGeometry/CylinderGeometry/StripeGeometryswitch to 32-bit indices past 65535 vertices;PlaneGeometryindex type check fixed (#528) (643632b)Raycasterskips sky spheres unlessincludeSkyis set (#528) (643632b)MeshColliderShape, inverse-transpose normals, andscreenPointToRaycanvas-offset fix (#509) (2e4be97)MotionBlurPost.resetHistory()also resets object motion vectors; first frame writes zero motion (#528) (643632b)Uint8Arrayfallback index buffer (meshes over 85 triangles were scrambled) (#516) (76dc157)ShaderStageUsage, nested calls included); texture bind group regenerated when layouts rebuild (#526) (b2d5e6e)Time.delta;GPUBufferBase.mapAsyncWritestaging-buffer pool leak (#519) (f5bda99)BillboardYat vertical view angles (#503) (c477ae0)Plane.intersectsRayhit for parallel rays (#507) (1172ba1)Vector2.lerpendpoint order (#508) (5cdec3c)