Logo de Threejs Impl Webgpu

Threejs Impl Webgpu

Organização
Impertio-Studio
threejs-impl-webgpu

Use when using the Three.js WebGPU renderer, node-based materials, TSL (Three Shading Language), or compute shaders. Prevents the common mistake of not checking browser support, missing async init, or using GLSL with WebGPU. Covers WebGPURenderer, node materials, TSL, compute shaders, WebGL fallback, migration guide. Keywords: WebGPU, WebGPURenderer, TSL, Three Shading Language, node material, compute shader, WGSL, MeshStandardNodeMaterial, next-gen rendering, modern GPU, WebGPU setup.

Visão geral

Publicado porImpertio-Studio
RepositórioThree.js-Claude-Skill-Package
Nome da habilidadethreejs-impl-webgpu
Estrelas
29
Forks
3
Arquivos incluídos
3
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    Habilidades de IA são Markdown simples, não código específico de um provedor, por isso funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • 3 arquivos incluídos

    Scripts, modelos de documentos e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente leitura e nunca são executados.

  • Código aberto

    Publicada por Impertio-Studio no GitHub. Leia o conteúdo-fonte antes de instalar.

Instalação

Instale a habilidade de IA Threejs Impl Webgpu no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL da pasta da habilidade exibida abaixo e confirme.
    https://github.com/Impertio-Studio/Three.js-Claude-Skill-Package/tree/master/skills/source/threejs-impl/threejs-impl-webgpu
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Nova habilidade → Via URL GitHub, depois cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Impertio-Studio/Three.js-Claude-Skill-Package.git /tmp/Three.js-Claude-Skill-Package
mkdir -p .claude/skills
cp -r /tmp/Three.js-Claude-Skill-Package/skills/source/threejs-impl/threejs-impl-webgpu .claude/skills/threejs-impl-webgpu
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Threejs Impl Webgpu em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Threejs Impl Webgpu automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Threejs Impl Webgpu não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

threejs-impl-webgpu

EXPERIMENTAL — The WebGPU renderer and TSL are under active development. API surfaces may change between Three.js releases. Pin your Three.js version.

Quick Reference

WebGPURenderer Setup

javascript
import * as THREE from 'three/webgpu';

const renderer = new THREE.WebGPURenderer({ antialias: true });
await renderer.init(); // MUST await before first render
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setAnimationLoop(animate);
document.body.appendChild(renderer.domElement);

ALWAYS call await renderer.init() before the first renderer.render() call. ALWAYS use renderer.setAnimationLoop(callback) instead of requestAnimationFrame. NEVER call renderer.render() before init() resolves — this throws a runtime error.

Browser Support

BrowserVersionStatus
Chrome113+Full support
Edge113+Full support
Safari18+Supported
FirefoxExperimentalBehind flag (dom.webgpu.enabled)

Feature Detection and Fallback

javascript
import { WebGPU } from 'three/webgpu';

if (WebGPU.isAvailable()) {
  const renderer = new THREE.WebGPURenderer({ antialias: true });
  await renderer.init();
} else {
  const renderer = new THREE.WebGLRenderer({ antialias: true });
}

ALWAYS check WebGPU.isAvailable() before creating a WebGPURenderer. ALWAYS provide a WebGLRenderer fallback for unsupported browsers.

Critical Warnings

NEVER write raw GLSL or WGSL strings — ALWAYS use TSL functions. WebGPU compiles TSL to WGSL automatically. GLSL is NOT supported by the WebGPU backend.

NEVER use ShaderMaterial with WebGPURenderer — use NodeMaterial with TSL instead.

NEVER use requestAnimationFrame with WebGPURenderer — ALWAYS use renderer.setAnimationLoop().

NEVER use EffectComposer (three/examples) with WebGPURenderer — use the PostProcessing class with TSL nodes instead.


Node Materials

Every classic Three.js material has a node-based equivalent. Classic materials auto-convert when used with WebGPURenderer, but node materials provide full TSL customization.

Material Mapping

Classic MaterialNode Material
MeshBasicMaterialMeshBasicNodeMaterial
MeshStandardMaterialMeshStandardNodeMaterial
MeshPhysicalMaterialMeshPhysicalNodeMaterial
MeshPhongMaterialMeshPhongNodeMaterial
MeshLambertMaterialMeshLambertNodeMaterial
LineBasicMaterialLineBasicNodeMaterial
LineDashedMaterialLineDashedNodeMaterial
PointsMaterialPointsNodeMaterial
SpriteMaterialSpriteNodeMaterial

ALWAYS import node materials from 'three/webgpu', not from 'three'.

NodeMaterial Input Properties

All properties accept TSL node values. All are optional and override defaults.

Common inputs (all node materials):

PropertyTSL TypePurpose
.colorNodevec4Base color
.opacityNodefloatOpacity
.normalNodevec3Normal map replacement
.emissiveNodecolorEmissive output
.positionNodevec3Vertex displacement
.fragmentNodevec4Full fragment shader replacement
.vertexNodevec4Full vertex shader replacement
.outputNodevec4Final output override
.aoNodefloatAmbient occlusion
.alphaTestNodefloatAlpha test threshold
.depthNodefloatCustom depth
.castShadowNodevec4Shadow casting override

Standard/Physical inputs:

PropertyTSL TypePurpose
.metalnessNodefloatMetalness
.roughnessNodefloatRoughness
.envNodecolorEnvironment map
.lightsNode—Lighting model override

Physical-only inputs: .clearcoatNode, .clearcoatRoughnessNode, .clearcoatNormalNode, .sheenNode, .iridescenceNode, .iridescenceIORNode, .iridescenceThicknessNode, .specularIntensityNode, .specularColorNode, .iorNode, .transmissionNode, .thicknessNode, .attenuationDistanceNode, .attenuationColorNode, .dispersionNode, .anisotropyNode.


TSL (Three Shading Language)

TSL is a JavaScript-based node graph system that compiles to GLSL (WebGL2) and WGSL (WebGPU). It replaces raw shader strings entirely.

Type System

CategoryFunctions
Scalarsfloat(), int(), uint(), bool()
Vectorsvec2(), vec3(), vec4(), ivec2(), ivec3(), ivec4(), uvec2(), uvec3(), uvec4()
Matricesmat2(), mat3(), mat4()
Colorcolor()
Conversion.toFloat(), .toVec3(), .toColor()

Variables and Uniforms

FunctionPurpose
uniform(value)GPU-side dynamic value
toVar(node)Reusable shader variable
toConst(node)Inline constant
varying(node)Vertex-to-fragment interpolation
vertexStage(node)Force computation in vertex shader
attribute(name, type)Access buffer attributes

Uniforms support callbacks: .onRenderUpdate(fn), .onFrameUpdate(fn), .onObjectUpdate(fn).

Operators

All operators are chainable on TSL nodes:

  • Arithmetic: .add(), .sub(), .mul(), .div(), .mod()
  • Comparison: .equal(), .notEqual(), .lessThan(), .greaterThan(), .lessThanEqual(), .greaterThanEqual()
  • Logical: .and(), .or(), .not(), .xor()
  • Assignment: .assign(), .addAssign(), .subAssign(), .mulAssign(), .divAssign()
  • Bitwise: .bitAnd(), .bitOr(), .bitXor(), .shiftLeft(), .shiftRight()

Geometry Nodes

CategoryNodes
PositionpositionGeometry, positionLocal, positionWorld, positionView, positionWorldDirection, positionViewDirection
NormalnormalGeometry, normalLocal, normalView, normalWorld
TangenttangentGeometry, tangentLocal, tangentView, tangentWorld
UVuv(index)
ScreenscreenUV, screenCoordinate, screenSize
ViewportviewportUV, viewportCoordinate, viewportSize

Camera and Model Nodes

  • Camera: cameraNear, cameraFar, cameraPosition, cameraProjectionMatrix, cameraViewMatrix, cameraWorldMatrix, cameraNormalMatrix
  • Model: modelViewMatrix, modelNormalMatrix, modelWorldMatrix, modelPosition, modelScale, modelDirection

Animation Nodes

NodePurpose
timeElapsed seconds since start
deltaTimeFrame delta in seconds
oscSine(timer)Sine oscillator (0-1)
oscSquare(timer)Square wave oscillator
oscTriangle(timer)Triangle wave oscillator
oscSawtooth(timer)Sawtooth oscillator

Texture Operations

FunctionPurpose
texture(tex, uv, level)Sample with interpolation
textureLoad(tex, uv, level)Sample without interpolation
textureStore(tex, uv, value)Write to storage texture
textureSize(tex, level)Get texture dimensions
cubeTexture(tex, uvw, level)Sample cube map
triplanarTexture(texX, texY, texZ, scale, position, normal)Triplanar mapping

Control Flow

ALWAYS use capital If — lowercase if is JavaScript, not TSL.

javascript
If(condition, () => {
  // true branch
}).ElseIf(otherCondition, () => {
  // else-if branch
}).Else(() => {
  // false branch
});
  • select(condition, trueVal, falseVal) — ternary operator
  • Loop(count, ({ i }) => { }) — GPU loop, supports Break(), Continue()
  • Switch(value).Case(val, fn).Default(fn) — no fallthrough
  • Discard() — discard fragment
  • Return() — early return

Function Definition

javascript
const myFn = Fn(([param1, param2]) => {
  return param1.add(param2);
});
// Call: myFn(nodeA, nodeB)

Compute Shaders

WebGPU enables general-purpose GPU compute via TSL. Compute shaders are NOT available in WebGL fallback mode.

Setup

javascript
import { compute, storage } from 'three/webgpu';

const computeNode = compute(shaderFn, count, workgroupSize);
await renderer.computeAsync(computeNode);

ALWAYS use await renderer.computeAsync() — compute dispatch is asynchronous.

Storage and Atomics

  • Storage: storage(attribute, type, count), storageTexture(texture)
  • Atomics: atomicAdd(), atomicSub(), atomicMax(), atomicMin(), atomicAnd(), atomicOr(), atomicXor(), atomicStore(), atomicLoad()
  • Barriers: workgroupBarrier(), storageBarrier(), textureBarrier()
  • Built-in IDs: workgroupId, localId, globalId, numWorkgroups, subgroupSize

WebGPU Post-Processing

NEVER use the WebGL EffectComposer with WebGPURenderer. Use the PostProcessing class instead.

javascript
import { PostProcessing } from 'three/webgpu';
import { bloom, renderOutput } from 'three/tsl';

const postProcessing = new PostProcessing(renderer);
const scenePass = renderOutput(scene, camera);
postProcessing.outputNode = bloom(scenePass);

Available Post-Processing Nodes

bloom(), dof(), fxaa(), smaa(), gaussianBlur(), ssr(), ssgi(), ao(), chromaticAberration(), film(), dotScreen(), sobel(), afterImage(), anamorphic(), denoise(), lut3D(), motionBlur(), outline(), rgbShift(), transition(), traa(), renderOutput()

Color Operations

luminance(), saturation(), vibrance(), hue(), posterize(), grayscale(), sepia()

Blend Modes

blendBurn(), blendDodge(), blendOverlay(), blendScreen(), blendColor()


WebGL to WebGPU Migration

StepAction
1Replace import * as THREE from 'three' with import * as THREE from 'three/webgpu'
2Replace new WebGLRenderer() with new WebGPURenderer() and add await renderer.init()
3Replace classic materials with NodeMaterial equivalents (or keep classic — they auto-convert)
4Replace EffectComposer with PostProcessing class and TSL post-processing nodes
5Replace raw GLSL ShaderMaterial with TSL-based NodeMaterial
6Replace requestAnimationFrame with renderer.setAnimationLoop()

ALWAYS make the entry point async when using WebGPURenderer — renderer.init() returns a Promise.


Reference Links

Official Sources

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Threejs Impl Webgpu faz?

Use when using the Three.js WebGPU renderer, node-based materials, TSL (Three Shading Language), or compute shaders. Prevents the common mistake of not checking browser support, missing async init, or using GLSL with WebGPU. Covers WebGPURenderer, node materials, TSL, compute shaders, WebGL fallback, migration guide. Keywords: WebGPU, WebGPURenderer, TSL, Three Shading Language, node material, compute shader, WGSL, MeshStandardNodeMaterial, next-gen rendering, modern GPU, WebGPU setup.

Por que usar Threejs Impl Webgpu no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. Threejs Impl Webgpu é escrito em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. O TypingMind usa suas próprias chaves de API, então o pagamento é feito diretamente aos provedores, em vez de uma assinatura por licença de usuário, e suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Threejs Impl Webgpu no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/Impertio-Studio/Three.js-Claude-Skill-Package/tree/master/skills/source/threejs-impl/threejs-impl-webgpu. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Threejs Impl Webgpu?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Threejs Impl Webgpu?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Threejs Impl Webgpu com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Threejs Impl Webgpu é gratuita?

Sim. A habilidade é publicada no GitHub por Impertio-Studio sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, modelos de documento ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas para chamar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA fornece conhecimento e um processo ao modelo: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇