All skills
enzed avatar

/r3f-shaders

@4a11805
by Nicolas Zulloenzed/r3f-skills122 stars
7

Implement custom GLSL or TSL materials in React Three Fiber, including uniforms and vertex deformation. Use for shader code and shader debugging, rather than ordinary PBR settings or composer effects.

Use this Skill: https://skilld.dev/gh/enzed/r3f-skills/r3f-shaders

This session only. Nothing lands on disk.

referenceswebgpu.md

≈409 tokens on demand. Your agent reads this file only when SKILL.md points to it.

TSL materials on WebGPU

Use with an already initialized WebGPURenderer. This example targets Fiber 9.7 / Three.js r185, not Fiber 10 alpha.

import { useMemo } from 'react'
import { extend } from '@react-three/fiber'
import { MeshBasicNodeMaterial } from 'three/webgpu'
import { color, mix, sin, time, uv } from 'three/tsl'

const BasicNode = extend(MeshBasicNodeMaterial)

export default function NodeGradient() {
  const colorNode = useMemo(() => {
    const factor = sin(uv().y.mul(6).add(time)).mul(0.5).add(0.5)
    return mix(color('navy'), color('coral'), factor)
  }, [])
  return (
    <mesh>
      <planeGeometry args={[3, 3]} />
      <BasicNode colorNode={colorNode} />
    </mesh>
  )
}
  • Build stable node graphs outside per-frame work. Update uniform node values rather than recreating the graph each frame.
  • Node materials handle their own output pipeline; do not paste GLSL output chunks into TSL.
  • Use positionGeometry for pre-transformed vertices and understand positionLocal semantics before combining deformation with skinning in r185.
  • Use the installed Three.js RenderPipeline and node passes for postprocessing. Older tutorials using PostProcessing, renamed helpers, or Fiber alpha hooks need version checks.
  • Type-checking does not prove GPU compatibility. Render on the requested backend; verify WebGPU separately from its WebGL2 fallback.

Sources: TSL guide, MeshBasicNodeMaterial, migration guide.

Source: SKILL.md on GitHub

1 warning17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill provides safe, high-quality development instructions and code snippets for implementing custom WebGL and WebGPU shader materials in React Three Fiber.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    1/1 file flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 4a11805. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated last month

README badge

README badge for enzed/r3f-skills/r3f-shaders