← ClaudeAtlas

threejs-shaderslisted

Custom GLSL vertex and fragment shaders: uniforms, varyings, shader chunks, extending built-in materials, instanced attributes, plus the same effects as node materials with TSL on WebGPU. Use when writing a shader, a custom material or effect, moving vertices in a shader, or porting GLSL to TSL.
ahmedamin20/hmcv-ui-studio-public · ★ 0 · Web & Frontend · score 62
Install: claude install-skill ahmedamin20/hmcv-ui-studio-public
# Three.js Shaders Targets three.js r186. Examples use WebGLRenderer; the WebGPU and TSL section uses WebGPURenderer. ## Quick Start ```javascript import * as THREE from "three"; const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setPixelRatio(window.devicePixelRatio); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); camera.position.set(0, 0, 2); const material = new THREE.ShaderMaterial({ uniforms: { time: { value: 0 }, color: { value: new THREE.Color(0x0066ff) }, // hex converted to the linear working space }, vertexShader: /* glsl */ ` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); } `, fragmentShader: /* glsl */ ` uniform float time; uniform vec3 color; varying vec2 vUv; void main() { float wave = sin(vUv.x * 10.0 + time * 2.0) * 0.5 + 0.5; gl_FragColor = vec4(color * wave, 1.0); #include <tonemapping_fragment> #include <colorspace_fragment> } `, }); const mesh = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), material); scene.add(mesh); const timer = new THREE.Timer(); timer.connect(document); renderer.setAnimationLoop(animate); function animate() { timer.update(); material.uniforms.time.value = timer