Noise Texture
5 / 15
📝 Exercise Goal
Learn to create pseudo-random noise textures and understand the important role of noise in procedural texture generation.
💡 💡 Tutorial Content
Learn to create pseudo-random noise textures and understand the important role of noise in procedural texture generation.
Overview
- Generate procedural noise and map it to color.
Learning Objectives
- Understand the basic concept of pseudo-random noise.
- Learn a simple noise generation algorithm.
- Master how to map noise values to colors or patterns.
- Understand the application of noise in texture generation and special effects.
Prerequisites
- uv-coordinates
- time-animation
Inputs
float u_time— Time in seconds.vec2 u_resolution— Canvas size in pixels.
Key Concepts
- Noise is built from random values on a grid plus smooth interpolation.
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f*f*(3.0-2.0*f);
float n = mix(mix(a,b,u.x), mix(c,d,u.x), u.y);
- Map noise to color with
mixor thresholds.
vec3 color = mix(colorA, colorB, n);
How To Implement (Step-by-step)
- Scale UV to control frequency (e.g.
p = vUv * 6.0). - Compute base noise (hash/valueNoise).
- Optionally sum octaves (FBM) for detail.
- Map noise to grayscale or color.
Self-check
- Does it compile without errors?
- Does the output match the goal?
- Are key values kept in
[0,1]?
Common Mistakes
- Clamp
tinto[0,1]when needed. - Don’t use raw pixels without normalization.
- Make sure
edge0 < edge1for smoothstep(). - Change frequency by scaling before fract().