Write fragment and vertex shaders with instant visual feedback on a live 3D preview. Pick a preset to start, then tweak the code and uniforms.
uniform float u_time; uniform float u_scanSpeed; uniform float u_rainbowScale; varying vec2 vUv; varying vec3 vNormal; varying vec3 vPosition; varying vec3 vViewDir; vec3 hsv2rgb(vec3 c) { vec4 K = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0); vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } void main() { float fresnel = pow(1.0 - max(dot(vNormal, vViewDir), 0.0), 3.0); float hue = fract(vUv.y * u_rainbowScale + u_time * 0.2 + fresnel * 0.5); vec3 rainbow = hsv2rgb(vec3(hue, 0.8, 1.0)); float scanline = sin(vUv.y * 80.0 + u_time * u_scanSpeed) * 0.5 + 0.5; scanline = smoothstep(0.3, 0.7, scanline) * 0.15; vec3 color = mix(rainbow * 0.6, vec3(1.0), fresnel * 0.7) + scanline; gl_FragColor = vec4(color, 1.0); }
Want to apply shaders to physics objects, cloth, and custom meshes?
Open the Full Studio