Skip to content
Back to skills

Threejs Knowledge Patch

ASecurity

three.js

  • 25 stars
  • 0 votes
  • 0 copies
  • 11 views
  • Added September 5, 2026
developmentgonodeexpressdebuggingapibackend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill threejs-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Threejs Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Threejs Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-threejs-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-threejs-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: threejs-knowledge-patch
description: three.js
version: "r187"
license: MIT
metadata:
  author: Nevaberry
---


# three.js Compatibility and API Guidance

Use this skill when migrating three.js code or working with renderer backends,
TSL shaders, node materials, lighting, textures, asset loading, or addons.
Read the relevant topic reference for detailed conditions, examples, and
version-specific behavior.

## Reference index

| Reference | Topics |
| --- | --- |
| [Renderers, GPU, and XR](references/renderers-gpu-and-xr.md) | Initialization, output buffers, blending, render targets, depth, compute, WebXR, Inspector |
| [TSL and node APIs](references/tsl-and-node-apis.md) | Renames, types, control flow, sampling, storage, coordinates, compute, transpilers |
| [Materials, lighting, and textures](references/materials-lighting-and-textures.md) | Material changes, PMREM, probes, shadows, texture formats, mipmaps |
| [Loaders, exporters, and assets](references/loaders-exporters-and-assets.md) | Requests, dependencies, glTF, Draco, KTX2, USD, MaterialX, other formats |
| [Core, animation, and geometry](references/core-animation-and-geometry.md) | Timing, animation, geometry utilities, transforms, JSON, bounds, instances |
| [Addons, controls, and post-processing](references/addons-controls-and-post-processing.md) | Pass setup, reflections, AO, upscaling, controls, physics, generators, editor |

## Breaking changes and deprecations

| Existing code or behavior | Migration |
| --- | --- |
| `PostProcessing` | Use `RenderPipeline` from `three/webgpu`. |
| `WebGPURenderer` option `colorBufferType` | Replace with `outputBufferType`; replace `getColorBufferType()` with `getOutputBufferType()`. |
| `renderAsync()`, `computeAsync()`, `waitForGPU()` | The first two are deprecated and the last was removed. Initialize once, then use `render()` or `compute()`. |
| `Clock` | Use `Timer`; call `timer.update()` once per frame before `timer.getDelta()`. |
| `InstancedPointsNodeMaterial` | Use `PointsNodeMaterial` for WebGPU code. |
| `MeshGouraudMaterial` | Deprecated; use `MeshLambertMaterial`. |
| `Line2NodeMaterial` option `useColor` | Use `vertexColors`; remove references to its unused `lineWidth` property. |
| `MeshPostProcessingMaterial` | Removed; update materials that import or extend it. |
| `LuminanceFormat`, `LuminanceAlphaFormat` | Removed; update texture creation and shader reads that depend on the legacy channel layout. |
| `Source` | Replace imports and instantiations with `TextureSource`. |
| `CapsuleGeometry` parameter `length` | Use `height`; `heightSegments` subdivides the straight section. |
| `LightProbe.fromJSON()` | Use `ObjectLoader.parse()`. |
| `Matrix3.scale()`, `.rotate()`, `.translate()` | Deprecated; a translation can use `matrix.premultiply(new Matrix3().makeTranslation(x, y))`. |
| `RGBELoader` | Use `HDRLoader`. |
| `RGBMLoader` | Removed; use a separate RGBM decoding path or convert assets to a supported format. |
| `USDZLoader` | Deprecated; migrate `.usdz` loads to `USDLoader`. |
| `SVGLoader.createShapes(path)` | Call `path.toShapes()` on each loaded `ShapePath`. |
| `DRACOExporter.parse()` | Use `await exporter.parseAsync(object, options)`. |
| `FileLoader.load()`, `ImageBitmapLoader.load()` return values | Both return `undefined`; read results through `onLoad`. |
| `AnamorphicNode` | Removed; use `BloomNode` with the migration example's setup. |
| `TRAAPassNode` | Use `TRAANode` and the updated temporal antialiasing example. |
| `TiledLighting` | Removed; update code to use `ClusteredLighting`. |

`AnimationClip.parseAnimation()`, `VTKLoader`, and `LWOLoader` are deprecated.
`LottieLoader` is deprecated; use the Lottie library directly for new integrations.
Set minimum and maximum iridescence thickness separately on
`MeshPhysicalMaterial`; `iridescenceThicknessRange` is deprecated.

## Renderer initialization and output

Initialize once before using the synchronous rendering and compute methods:

```js
await renderer.init();
renderer.render(scene, camera);
```

- `await renderer.init()` evaluates to the initialized renderer.
- After initialization, replace `clearAsync()`, `initTextureAsync()`, and
  `hasFeatureAsync()` with `clear()`, `initTexture()`, and `hasFeature()`.
  `renderer.setAnimationLoop()` initializes before running its callback.
- Await initialization before WebGPU PMREM generation or
  `loader.detectSupport(renderer)`; replace `KTX2Loader.detectSupportAsync()`.
- `renderer.setOutputRenderTarget(target)` includes output color conversion
  and tone mapping. The output pass disables `autoClear`; clear explicitly
  when the destination must start empty.
- `WebGLRenderer` accepts `outputBufferType` and `renderer.setEffects()`.
  An output effect can request scene depth with `needsDepthTexture`.
- Use `CanvasTarget` for another canvas with the same `WebGPURenderer`.
  Dispose a target to release its cached renderer resources.
- Start `WebGPURenderer.compileAsync()` ahead of rendering and await its promise
  before relying on compiled pipelines.

## Depth, blending, and GPU resources

- Use `reversedDepthBuffer` in `WebGLRenderer` from r179 onward. From r180,
  custom GLSL uses `USE_REVERSED_DEPTH_BUFFER` and `USE_LOGARITHMIC_DEPTH_BUFFER`.
- When both depth modes are enabled, the renderers use reversed depth and
  ignore logarithmic depth. WebGPU reversed depth uses `depth32float` by default.
- Set `renderer.shadowMap.type = PCFShadowMap` to keep soft PCF shadows.
  `PCFSoftShadowMap` was deprecated for WebGL and removed for WebGPU.
- Set `material.premultipliedAlpha = true` for `MultiplyBlending` or
  `SubtractiveBlending`. Corrected blending formulas can change composited colors.
- If WebGPU compositing changes after upgrading, use an opaque background or
  `renderer.setClearColor(0x000000, 1)`. Use a transparent background or clear
  alpha when the canvas needs to composite with surrounding HTML.
- WebGPU supports separate blend modes per MRT attachment; configure secondary
  attachments when they need to composite their outputs.
- Use `CubeRenderTarget` in WebGPU cube passes; support for
  `WebGLCubeRenderTarget` in those passes was removed.
- WebGPU can render depth-only targets with zero color attachments.
  Choose either `count` or `dispatchSize` for compute; supplying both throws.
- Call `attribute.dispose()` to release WebGPU buffer attribute resources,
  including both storage and ordinary attributes.
- Set target dimensions before entering XR; resizing while XR is active is disallowed.

## TSL migration quick reference

| Old API | Supported change |
| --- | --- |
| `builder.monitor` | `builder.observer` |
| `node.varying()`, `node.vertexStage()` | `node.toVarying()`, `node.toVertexStage()` |
| `node.label('name')` | `node.setName('name')` for affected calls |
| `premult(color)` | `premultiplyAlpha(color)` |
| `directionToColor()`, `colorToDirection()` | `packNormalToRGB()`, `unpackRGBToNormal()` |
| `directionToFaceDirection` | `negateOnBackSide` |
| `getProjectionDepth()` | `projectionDepth()` |
| `PI2` | `TWO_PI` |
| `DFGApprox` | `DFGLUT` |
| `nodeObject()` wrappers around `Node` instances | Use the instances directly. |
| `storageObject()` | `storage(attribute, type, count).setPBO(true)` |
| `string`, `arrayBuffer`, `modInt` exports | Remove uses; these exports were removed. |

- In chained `step`, the value is the receiver: `value.step(edge)` matches
  `step(edge, value)`.
- TSL no longer creates missing tangents automatically. Supply `tangent`, or
  call `geometry.computeTangents()` on indexed geometry with positions, normals, and UVs.
- Use `positionGeometry` in `material.positionNode` for original vertices before
  internal transforms such as skinning. Set `material.shadowPositionNode`
  explicitly when custom vertex positioning needs to apply in the shadow pass.
- `DebugNode` callbacks receive raw debug data; update callbacks expecting a
  plain shader-code string. The detailed reference retains the callback changes.

## TSL construction, sampling, and compute

- Use `array()` for shader arrays and `struct()` for named, typed members.
  `Const(node)` or `node.toConst()` creates a read-only value; `Var(node)` is mutable.
- A boolean-node `Loop()` repeats while its condition is true. TSL also supports
  switch/case, expression-valued loop updates, `increment()`, and `decrement()`.
- Pass a `Fn` to another `Fn`; explicit layouts support member parameter types.
  Use `isolate()` to build separately from cached nodes in a conditional branch.
- Use `uniformFlow()` for operations requiring uniform control flow.
  Mixed numeric types can promote where supported by the operator.
- `.load()` on a `texture()` node reads integer texel coordinates.
  Use `texture3DLoad()` for unfiltered 3D reads and `texture3DLevel()` for an explicit mip level.
- `textureGather` reads one component from four neighboring texels;
  `textureGatherCompare` returns four depth comparison results.
- Use `storageTexture3D` for writable volume textures and `StorageTextureNode.store()`
  for writes. Storage coordinates bypass the UV matrix; supply intended coordinates.
- `atomicLoad()` reads an atomic value. Read-modify-write nodes such as
  `atomicAdd()` can return the pre-update value to another expression.
- `computeKernel()` separates a kernel from dispatch size. WebGPU compute supports
  reductions across subgroup invocations and indirect workgroup counts from a GPU buffer.

## Materials, lighting, and textures

- Set `material.allowOverride = false` to retain it under `scene.overrideMaterial`.
  `Material.copy()` preserves this flag. `material.maskNode` discards fragments
  where its boolean expression is false.
- `SpriteNodeMaterial.transparent` defaults to `true`; set `transparent: false`
  for opaque rendering. Size attenuation applies only with perspective cameras.
- PBR lighting and material shading changes can alter the appearance of existing assets.
  `MeshLambertMaterial` and `MeshPhongMaterial` respond to `scene.environment`,
  which can change their appearance.
- `LightProbeGrid` provides spatially varying diffuse indirect lighting. Its bake
  supports indirect bounces; probes sit at cell centers and the last matching grid is sampled.
- `ClusteredLighting` supports spot lights and the WebGL2 fallback. Shadow-casting
  point lights continue through the material lighting path.
- WebGPU PMREM results use cube render targets; update sampling code expecting CubeUV.
- Use `updateRanges` for partial texture uploads and `layerUpdates` for changed
  array layers. Set `texture.mipmapsAutoUpdate = false` when managing mipmap updates yourself.
- `Texture.generateMipmaps = true` generates mipmaps regardless of filters;
  set `generateMipmaps = false` when mipmap generation should be skipped.

## Assets and geometry

- Serve application fonts separately; the npm package omits `examples/fonts`.
  Draco and KTX2 decoder/transcoder assets use relative file URLs by default.
- `Loader.abort()` cancellation depends on the loader implementation. Cache keys
  are scoped by loader type; `Cache` skips `Blob` values, so retain needed blobs in application code.
- Register meshopt decoding with `loader.setMeshoptDecoder(MeshoptDecoder)` for
  glTF assets requiring `KHR_meshopt_compression`.
- Convert PLY `float64` or `double` attributes to `Float32BufferAttribute` for rendering;
  use `Uint8Array` colors when exports need `uchar` vertex colors.
- `BufferGeometryUtils.toTrianglesDrawMode()` changes the input index in place;
  clone first when the original index is needed. `SimplifyModifier.modify()` is asynchronous.
- Camera view matrices exclude scale; use zoom or projection settings for framing.
  Call `super.dispose()` inside disposal overrides in custom `Object3D` subclasses.
- `Controls.connect()` requires the input DOM element. Use `controls.lock(true)`
  with `PointerLockControls` to request unadjusted movement.

## Post-processing and diagnostic entry points

- `RenderPipeline` follows later changes to renderer tone mapping and output color space.
- Add `SSRNode` reflections to the scene pass with additive blending; the revised
  setup offers an optional denoiser. `SSRNode` defaults to sampling the full GGX lobe.
- Composite GTAO from `.r` while preserving scene alpha. External `GTAOPass` buffers
  require separate depth and normal textures; packed depth and normals are unsupported.
- `SSGINode` adds visible-scene indirect lighting and supports resolution scaling.
  `SSSNode` adds shadows computed from the current view.
- `FSR1Node` provides spatial upscaling; `TAAUNode` combines temporal antialiasing
  and upsampling. `TRAANode` accepts a velocity node and supports orthographic cameras.
- Use Inspector for WebGPU debugging: Timeline records and exports commands,
  Memory exposes memory information, and Settings can enable stack trace capture.

Files in this skill

  • SKILL.md9.9 KB
  • coverage.json1.6 KB
  • references/addons-controls-and-post-processing.md8.7 KB
  • references/core-animation-and-geometry.md6.3 KB
  • references/loaders-exporters-and-assets.md7.4 KB
  • references/materials-lighting-and-textures.md6.1 KB
  • references/renderers-gpu-and-xr.md10.8 KB
  • references/tsl-and-node-apis.md11.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.