New advertisers: 50% off your first month with code FIRSTMONTHSee slots
enzed avatar

R3f Shaders

Custom GLSL and TSL materials for React Three Fiber, with uniform handling and vertex deformation guidance.

skills.sh installs
2.2K
GitHub stars
138
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers custom shader materials in React Three Fiber, from shaderMaterial and native ShaderMaterial to patching built-in materials with onBeforeCompile
  • Includes an animated WebGL example, uniform update patterns, and notes on color space, tone mapping, and normal-space consistency
  • Enforces that GLSL source avoids backticks and ${ inside template literals, and that uniform-only changes skip needsUpdate
  • Designed for developers writing shader code or debugging it in Fiber 9 projects, with WebGPU and TSL covered separately

Install

$ npx -y skills add enzed/r3f-skills --skill r3f-shaders -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

React Three Fiber shaders

Select the shader path

Inspect installed Fiber, Drei, Three.js, and renderer versions first. The example uses Fiber 9 / React 19 and WebGL. Preserve an existing project's versions.

  • Use built-in materials when their properties express the effect. For custom WebGL shading, use Drei shaderMaterial or a native <shaderMaterial>.
  • WebGPU uses node materials and TSL; GLSL ShaderMaterial and onBeforeCompile are not portable to it. Read WebGPU and TSL only when that renderer is relevant.
  • A shader is not automatically lit, shadowed, fogged, instanced, or skinned. Choose the required features before replacing a built-in material.

Animated WebGL material

Mount beneath Canvas. Keep the material class and extend call outside render; the local component avoids global JSX augmentation.

import { useRef } from 'react'
import { extend, useFrame } from '@react-three/fiber'
import { shaderMaterial } from '@react-three/drei'
import { Color } from 'three'

Details

Repository
github.com/enzed/r3f-skills
Categories
3D, CAD & Modeling, Frontend & UI Code, Animation & Motion
First seen
May 16, 2026

More from enzed/r3f-skills

All 11

Similar to R3f Shaders

More 3D, CAD & Modeling