Repository navigation
v0.1.0-beta.2
·
7 commits
to main
since this release
Closed beta build of @pixi/3d, from commit bdb9eb4.
Download pixi-3d-0.1.0-beta.2.tgz, then install it next to PixiJS:
npm install pixi.js
npm install ./pixi-3d-0.1.0-beta.2.tgzImports work exactly as they will from npm:
import { View3D } from '@pixi/3d';
import { OrbitCamera } from '@pixi/3d/extras';🚨 Behavior Change
- chore: bump pixi.js peer dependency to 8.22.0 by @Zyie
npm install pixi.js@^8.22.0
- breaking: read material rows from the data texture on WebGPU by @GoodBoyDigital
- This affects custom shader bits that declare
materialfields. - A material field must be
f32,u32,i32, avec2,vec3orvec4off32, ormat2x2<f32>. Creating a material with any other type throws, and the error names the bit and the field. A material struct larger than its 256-byte row also throws, where it used to spill into the next material's data. - In WGSL,
uMaterialStorageis a texture now, souMaterialStorage[i]no longer compiles. Read themateriallocal, which both stages have, or callgetMaterial(index)for another material's row.
// before let tint = uMaterialStorage[vMaterialIndex].tint; // after let tint = material.tint;
- In GLSL, the compiler emits
getMaterial()aftergl.header, so code in the header can't call it. Code in the stage slots still can.
- This affects custom shader bits that declare
- fix: WebGPU batch samplers take the implicit level of detail by @GoodBoyDigital
- The shader helpers
sampleBatchTextureand_unpackSlotare gone from the WGSL and GLSL headers, so a customShaderBitthat calls them fails to compile. Call the generatedsample<Name>(uv)andsample<Name>Direct(uv)getters instead, orsampleBatchSlotGrad(slot, uv, dx, dy)with the slot read from_textureSlotsin WGSL orvTextureSlotsin GLSL.
- The shader helpers
- feat: BatchedMesh3D cull option by @GoodBoyDigital
- A
BatchedMesh3Dno longer takes its culling mode from the view. Each batch has its owncull, and it defaults to'off', so every instance draws. In beta.1 a batch followed the view'scull, which defaults to'auto'. Turn culling back on for a large batch spread well beyond the view, such as scattered scenery:
const forest = new BatchedMesh3D({ size: treePositions.length, cull: 'auto' });
- A
- feat: OrbitCamera and FPSCamera keep the context menu from opening by @Zyie
- Once a View has an
OrbitCameraorFPSCamera, the browser's context menu stops opening over that View. PasspreventContextMenu: falseto get it back. The menu also opens while the controller'senabledisfalse.
import { OrbitCamera } from '@pixi/3d/extras'; new OrbitCamera({ view: view3d, preventContextMenu: false }); // or for every controller created after this line OrbitCamera.defaultOptions.preventContextMenu = false;
- Once a View has an
🎁 Added
- feat: View3D.background accepts a Hemisphere by @Zyie
View3D'sbackgroundtakes aHemisphereand draws its sky and ground gradient behind the scene, on WebGL and WebGPU. The gradient uses the same formula as a hemisphereenvironment, so one object passed to both gives a sky that matches the scene's light. The view's exposure and tone mapping apply, as they do to a cube map. A colour change shows on the next frame. The option also acceptsnull.
import { type Hemisphere, View3D } from '@pixi/3d'; const sky: Hemisphere = { skyColor: 0x88ccff, groundColor: 0x553311 }; const view3d = new View3D({ autoResize: true, environment: sky, background: sky }); sky.skyColor = 0xff8800; // sunset
- feat: OrbitCamera and FPSCamera keep the context menu from opening by @Zyie
OrbitCameraandFPSCameratake apreventContextMenuoption, also a property you can change at runtime. It defaults totrue, so a right-button pan or a drag to look around no longer opens the browser menu. Windows opens the menu on release, so there a right-button drag that ends outside the View still opens it.- 3D nodes receive
contextmenuevents like the other pointer events, withhit3Dset, and gain anoncontextmenuhandler property.preventDefault()keeps the browser menu closed.stopPropagation()lets it open and hides the event from the View's own listeners, such as a camera controller's.
mesh.on('contextmenu', (e) => { e.preventDefault(); openMenuFor(mesh, e.global); });
- feat: read material rows from the data texture on WebGPU by @GoodBoyDigital
⚡ Performance
- feat: upload only the changed texels of data textures by @GoodBoyDigital
- fix: cut per-frame garbage and wasted work on hot paths by @GoodBoyDigital
- fix: bound light-mask loops for mobile GPUs by @GoodBoyDigital
- fix: WebGPU batch samplers take the implicit level of detail by @GoodBoyDigital
- breaking: read material rows from the data texture on WebGPU by @GoodBoyDigital
🐛 Fixed
- fix: WebGL reads integer data through integer textures by @GoodBoyDigital
- fix: use the glTF default material for primitives without one by @Zyie
- fix: WebGL reads integer data through integer textures by @GoodBoyDigital
- chore: bump pixi.js peer dependency to 8.22.0 by @Zyie
- fix: shadow auto-fit reads live caster membership, not a stale sort by @Zyie
- fix: apply View3D visibility and transform changes by @Zyie
- fix: keep the WebGL bone texture aligned to whole rows when the bone pit grows by @Zyie
- fix: drop the GGX guard that flattened smooth highlights by @Zyie
- fix: copy atlas fast-path vertices as bytes and check the layout first by @GoodBoyDigital
- fix: copies read the target their camera drew, not whatever is bound by @GoodBoyDigital
- breaking: read material rows from the data texture on WebGPU by @GoodBoyDigital
- fix: a read-only-depth pass resolves to pixi's default target instead of reconfiguring the canvas by @Zyie
- fix: shadow passes let go of pipe stores when their renderer is destroyed by @Zyie
- fix: IBL prefilter and BRDF LUT release their one-shot bind groups by @Zyie