quinepubField guide Nº 1 · Real-time 3D

The visual vocabulary of real‑time 3D

The words people use for WebGL, three.js and shaders, each shown rather than told: a live figure, a plain definition and a sentence showing how the word is used. Pick what you’re working on, open any figure to study it (← → to flip through), and use Practice to test yourself.

143 terms7 purposes · 15 chaptersevery figure drawn live
Tip: bold words inside a card link to their own card.
A–Z index

01Geometry: what a 3D model is made of

Everything you see is a surface built from points and triangles. These are the words for its parts.

Vertex plural: vertices

A corner point with a position (x, y, z). Vertices can carry more data too: a normal, UVs, a color.

“The model has 12k vertices, so it’s too heavy for mobile.”

Edge

A straight line between two vertices. A hard edge is a sharp crease. A soft edge is smoothed by shading.

“Bevel that edge so it catches the light.”

Face / Polygon

A flat surface bounded by edges. GPUs only draw triangles, so a quad (4 sides) is split into 2 triangles (see the dashed diagonal).

“That face is flipped, so it disappears from this side.”

Mesh

A connected surface of vertices and triangles. In three.js a Mesh is geometry (the shape) plus material (how it looks).

“Merge these meshes to cut the draw calls.”

Normal

A unit-length arrow that sticks straight out of the surface and shows which way it faces. Lighting is computed from normals.

“The normals are inverted, so it renders black.”

Wireframe & Topology

Wireframe draws only the edges. Topology is how the vertices are connected: the layout of the polygons, also called the edge flow.

“Turn on wireframe. The topology is a mess around the eyes.”

Poly count & LOD

Poly count is the number of triangles, so it measures detail and cost. LOD (Level of Detail) swaps in simpler meshes as objects get farther away.

“Add LODs. The background trees are 50k tris each.”

Bounding box AABB

The smallest Axis-Aligned Bounding Box that contains the object. It’s a cheap stand-in for culling, collisions and picking. There’s also the bounding sphere.

“The bounding box wasn’t recomputed, so it gets culled too early.”
012 ↺CCW → front 021 ↻CW → back

Winding order

The order of a triangle’s vertices decides which side is the front. In WebGL, counter-clockwise as seen by the camera means front-facing.

“The winding is reversed, so the model looks inside-out.”

Backface culling

Skipping triangles that face away from the camera. For closed objects that’s about half the work saved. Turn it off (side: DoubleSide) for thin things like leaves or paper.

“The plane is invisible from behind because of backface culling.”
v0v1v2v3 vertex buffer[v0, v1, v2, v3] index buffer0,1,2, 0,2,3 4 vertices, not 6

Index buffer indexed geometry

List each vertex once, then describe triangles by indices into that list. Shared corners aren’t duplicated.

“Use indexed geometry so neighbouring faces share vertices.”
POINTS LINES LINE_STRIP TRIANGLES TRI_STRIP TRI_FAN

Primitives / draw mode

How the GPU groups vertices: as points, lines or triangles, and whether consecutive shapes share vertices (strips and fans).

“Render the path as a line strip, not as triangles.”

02Space & transforms: where things are

A vertex passes through several coordinate systems on its way to the screen. Most 3D bugs come down to mixing these up.

(0,0,0)Local spaceobject as modeled
model
matrix
World spacethe whole scene
view
matrix
View spacerelative to camera
projection
matrix
−w … +wClip spacefrustum → box
÷ w
(divide)
-1+1NDC−1 … 1 cube
viewport
(0,0)(w,h) pxScreen spacepixels
gl_Position = projection × view × model × position

Coordinate spaces local · world · view · clip · NDC · screen

Each arrow is a transform. The model matrix places the object in the world. The view matrix moves the world so the camera sits at the origin. The projection matrix applies perspective. The GPU then divides by w and maps the result to pixels. Together these are called the MVP.

“You’re comparing a world-space position with a view-space normal, so the lighting is off.”
+X+Y+Z right-handedY is upcamera looks −Z+Z → toward youRGB = XYZ

Axes & handedness

WebGL and three.js use a right-handed, Y-up system. Blender is Z-up and Unity is left-handed, which is why imports can come in rotated. By convention, X/Y/Z axes are drawn red/green/blue.

“The model was exported Z-up, so it’s lying on its back.”

Transform TRS

Position, rotation and scale. Translate moves, rotate turns, scale resizes. Order matters: scale, then rotate, then translate.

“Apply the transform so the scale is baked into the vertices.”
pivot at centerpivot at corner

Pivot / Origin

The point an object rotates and scales around: its local (0,0,0). A wrong pivot makes things swing around a corner.

“Center the pivot, or wrap it in a Group and offset the child.”

Matrix 4×4

One grid of 16 numbers that holds a whole transform. Each column says where a local axis points, and the last column is the position. Multiplying matrices chains transforms.

“Multiply the parent’s world matrix by the child’s local matrix.”
(x, y, z, w) w = 1a point(gets moved) w = 0a direction(not moved)

Homogeneous coordinates the “w”

The 4th number makes translation and perspective work with matrix math. After projection the GPU divides by w (the perspective divide), and that’s what makes far things smaller.

“Normals use w = 0, so translation doesn’t affect them.”

Scene graph parent / child

A tree of objects in which children inherit their parent’s transform. The moon orbits the earth, and the earth orbits the sun. A child’s local position is relative to its parent, and its world position comes from the whole chain.

“Parent the wheels to the car body so they follow it.”
yaw (Y)pitch (X)roll (Z) gimbal lock:2 rings align,1 axis is lost

Euler angles & gimbal lock

A rotation stored as three angles (X, Y, Z), applied in a set order. They’re easy to read, but at some poses two axes line up and you lose one degree of freedom. That’s gimbal lock.

“The camera flips at the top because of gimbal lock. Use quaternions.”
θ q = (x,y,z,w)axis + angleno gimbal locksmooth “slerp”between tworotations

Quaternion

A 4-number way to store a rotation, built from an axis and an angle around it. It’s hard to read but robust, and slerp (spherical interpolation) blends two rotations smoothly.

“Slerp the quaternion so the turn doesn’t wobble.”

03Camera: how the scene is viewed

A camera is a transform (where it is and where it looks) plus a projection (how 3D gets flattened onto 2D).

Camera lab top-down view · frustum · culling · clipping

The shaded wedge is the view frustum. Objects fully outside it are frustum-culled (never sent to the GPU). Objects crossing the near or far plane get clipped (orange). The strip at the bottom is what the camera actually sees: with perspective, closer things are bigger. Switch to orthographic and every object keeps its size.

Perspective vs Orthographic

Perspective: far objects look smaller, like the eye sees. Orthographic: no shrinking, parallel lines stay parallel. It’s used for CAD, isometric games and shadow cameras.

“Use an orthographic camera for the isometric view.”
visibleculled nearfarFOV

Frustum near · far · FOV

The visible volume, shaped like a pyramid with its tip cut off. FOV (field of view) is the opening angle. Near and far planes limit the depth range. Keep near as large as you can, because depth precision depends on the far/near ratio.

“The near plane is cutting into the character. Lower camera.near.”
aspect = width / height 16 / 9 ✓ aspect not updated

Aspect ratio

Width ÷ height of the viewport. If you resize the canvas without updating the camera’s aspect, everything stretches.

“Set camera.aspect on resize and call updateProjectionMatrix().”
up (0,1,0) target camera.lookAt(target)

Look-at & up vector

Point the camera at a target. The up vector sets which way is “up” on screen so the camera doesn’t roll.

“Make it look at the player and keep +Y as up.”
orbit dolly pan zoom = narrow the FOV

Orbit · Pan · Dolly · Zoom

Standard camera moves. Orbit circles a target. Pan slides sideways. Dolly physically moves closer. Zoom changes the lens (FOV). OrbitControls handles the first three.

“That’s a dolly, not a zoom. The perspective changes.”

04The GPU pipeline: how triangles become pixels

Every frame, your data flows through these stages. You program two of them (the shaders) and configure the rest. Click a stage.

Rendering pipeline a.k.a. graphics pipeline

// vertex shader (GLSL)
attribute vec3 pos;  // per vertex
uniform   mat4 mvp;  // same for all
varying   vec2 vUv;  // → fragment
void main() {
 vUv = uv;
 gl_Position = mvp*vec4(pos,1.);
}

Shader GLSL · vertex shader

A small program that runs on the GPU, thousands of times in parallel. WebGL shaders are written in GLSL (WebGPU uses WGSL). The vertex shader positions each vertex.

“Displace the vertices in the vertex shader so the CPU doesn’t have to.”
// fragment shader (GLSL)
uniform sampler2D map;
varying vec2 vUv;  // interpolated
void main() {
 vec4 c = texture2D(map, vUv);
 gl_FragColor = c;
}

Fragment shader pixel shader

Runs once per covered pixel and decides its color: texture lookups, lighting, effects. It’s usually the most expensive part of the frame.

“The fragment shader is too heavy at 4K. Simplify the lighting.”
pos₀ uv₀ n₀pos₁ uv₁ n₁pos₂ uv₂ n₂ different valueper vertex

Attribute

Per-vertex input data read from a buffer, such as position, normal, uv or color. Each vertex gets its own value.

“Add a custom attribute with a random offset per vertex.”
uTime = 3.2 same value for every vertex & pixel

Uniform

A value set from JavaScript that stays the same for the whole draw call: time, color, matrices, light direction, a texture.

“Pass the mouse position into the shader as a uniform.”

Varying interpolation

A value the vertex shader passes on to the fragment shader. The GPU interpolates it across the triangle. Three vertex colors become a smooth gradient this way. In WebGL2 it’s written out/in.

“Pass the UV as a varying to the fragment shader.”

Rasterization

Turning a vector triangle into the grid of pixels it covers. Each covered pixel produces a fragment.

“Thin triangles rasterize badly and cause flickering.”
B 2 fragments compete → 1 pixel

Fragment vs Pixel

A fragment is a candidate pixel produced by one triangle. Several fragments can land on the same pixel. The depth test and blending decide what ends up there.

“We’re shading fragments that get thrown away. That’s overdraw.”

Buffer VBO · stride · offset

GPU memory holding vertex data. Interleaved buffers pack all attributes per vertex. Stride is the bytes per vertex. Offset is where an attribute starts. A VAO remembers this layout.

“The stride is wrong, so the normals are reading UV data.”
CPUGPU 1000 draw calls 🐢 CPUGPU 1 batched call 🚀

Draw call

One command from the CPU telling the GPU to “draw this mesh with this material”. Each call has overhead, so hundreds are fine and thousands hurt. You reduce them with merging, batching and instancing.

“We’re CPU-bound on draw calls. Batch the props.”

Instancing

Drawing the same mesh many times in one draw call, with a different transform or color per instance. It’s how you get forests, crowds and particles.

“Use an InstancedMesh for the 10k rocks.”

Depth buffer z-buffer

A hidden image that stores, per pixel, how far the closest surface is. New fragments that are farther away get discarded. This is the depth test, and it’s how objects hide each other correctly.

“Disable depth write on the glass so it doesn’t hide things behind it.”

Z-fighting

Two surfaces at almost the same depth fight over the pixels, which shows as flickering stripes. The cause is limited depth precision.

“The decal z-fights with the wall. Offset it or use polygonOffset.”
stencil only where = 1

Stencil buffer

A per-pixel mask you can write to and test against. It’s used for portals, outlines, mirrors and cut-outs.

“Render the portal’s world only where the stencil is set.”
out = src·α + dst·(1−α)

Blending & transparency alpha

Mixing a new color with what’s already in the framebuffer, weighted by alpha (opacity). Transparent objects must be drawn back-to-front, otherwise they look wrong.

“It’s a sorting problem: the transparent objects render in the wrong order.”
colordepthstencil = framebuffer→ canvas, or atexture (FBO)

Framebuffer / Render target

The set of images a draw call writes into: color, plus depth and stencil. The default one is the canvas. An offscreen one (an FBO or render target) lets you render into a texture.

“Render the scene to a render target, then post-process it.”
three.js · Babylon · R3F WebGL 2 · GLSLWebGPU · WGSL driver: Metal · D3D · Vulkan GPU

The API stack

WebGL is a low-level browser API (OpenGL ES in JavaScript). WebGPU is its modern successor. three.js is an engine on top that turns meshes and materials into those calls for you.

“three.js handles the WebGL boilerplate. We only write the custom shader.”

05Textures: images on surfaces

A texture is an image the GPU can sample very fast. UVs say which part of the image goes where on the mesh.

UV(0,0)(1,1) unwrappedcube

UV coordinates UV mapping · unwrap

Every vertex gets a 2D coordinate (u, v) from 0 to 1 that points into the texture. Unwrapping flattens the 3D surface out like a paper model. Edges where it was cut are seams.

“The UVs are stretched on the arm, so the texture smears.”

Texel & sampling

A texel is one pixel of a texture. Sampling means reading the texture at a (u,v) that usually falls between texels, so the GPU has to pick or blend.

“We sample the noise texture twice per fragment.”

Filtering nearest · linear

How a magnified texture is filled in. Nearest keeps hard pixels, which is right for pixel art. Linear (bilinear) blends them smooth.

“Set magFilter to Nearest to keep the pixel-art look.”

Wrapping repeat · mirror · clamp

What happens for UVs outside 0–1. Repeat tiles the image. Mirrored flips every other tile. Clamp-to-edge stretches the border pixels.

“Set wrapS/T to RepeatWrapping so the floor tiles.”

Mipmaps

Pre-shrunk copies of a texture (½, ¼, …). Distant surfaces sample a smaller copy. Without them, many texels squeeze into one pixel, which causes moiré and shimmering. Trilinear filtering blends between mip levels.

“The ground shimmers in the distance. Generate mipmaps.”

Mip chain

Level 0 is full size, and each next level is half the width and height, already blurred. A full chain adds only about 33% memory.

“Non-power-of-two textures can’t mipmap in WebGL 1.”
screen texture

Anisotropic filtering

At grazing angles one screen pixel covers a long, thin strip of texture. Regular mipmapping blurs that strip. Anisotropic filtering takes several samples along it so the texture stays sharp.

“Floor textures get blurry at an angle. Bump anisotropy to 8.”
Albedo / base color
Normal
Roughness
Metalness
Ambient occlusion
Height / displacement
= lit result

Texture maps a PBR material set

One material is often several textures that line up on the same UVs. Each texture controls one property. Color maps (albedo, emissive) are stored in sRGB. Data maps (normal, roughness, metalness, AO, height) are stored linear. The last tile combines them all under a moving light, on a perfectly flat square.

“The roughness map is tagged as sRGB, so the material looks too shiny.”

Normal map

A texture whose RGB values store normal directions (flat = that typical lavender (128,128,255)). It fakes bumps on flat geometry by changing the lighting only. The silhouette stays flat.

“Bake the high-poly detail into a normal map for the low-poly mesh.”
tree rockui leaffont one texture,many imagesrock uv:u 0.54–1.0v 0.73–1.0→ fewer binds

Texture atlas sprite sheet

Many small images packed into one big texture. Each object’s UVs point at its own rectangle, so many objects can share one material and one draw call.

“Pack the icons into an atlas and add padding to stop bleeding.”
+Y−X+Z+X−Z−Y 6 faces,looked upby a 3Ddirection→ skyboxes, reflections, IBL

Cubemap & skybox

Six square images forming a cube around the viewer. You sample it with a direction rather than a UV. It’s used for the skybox background and for environment reflections.

“Use the HDRI as both the skybox and the environment map.”
pass 1 → texture used on a mesh mirrors · portals · minimaps · post-FX

Render-to-texture RTT

Render a scene (or a different camera view) into a texture, then use that texture somewhere else. All post-processing is built on this.

“Render the security camera to a texture and show it on the monitor.”

06Light, shading & materials

Shading means computing how bright and what color each point is, from its normal, the lights, the viewer and the material.

Shader lab debug views · real GPU shader

The same sphere in the debug views you’ll find in every engine. This whole scene is one fragment shader that ray-traces it, so it’s also a demo of what a shader can do.

metalnon-metal (dielectric)roughness 0 → 1

PBR physically based rendering · metal / rough workflow

The modern standard material model (MeshStandardMaterial, glTF). A few physically meaningful inputs: base color (albedo), roughness (sharp mirror → blurry, matte highlight) and metalness. Metals tint their reflections with the base color. Non-metals (plastic, wood, skin) reflect about 4% white and show their color through diffuse light.

“Lower the roughness so it reads as polished chrome.”
directional point spot ambient / hemi

Light types

Directional: parallel rays, like the sun. Point: shines in all directions, like a bulb. Spot: a cone. Ambient/hemisphere: cheap, even fill light with no direction.

“Use a directional light for the sun, plus a hemisphere light for sky fill.”
++=ambientdiffusespecularresult

Ambient · Diffuse · Specular

The classic split of light. Diffuse (Lambert) is matte brightness from the angle to the light. Specular is the shiny highlight, which depends on where you look from (Phong/Blinn). Ambient is a constant fill.

“The specular highlight is too tight. Lower the shininess.”

Flat vs Smooth shading

Flat: one normal per face, so you see facets. Smooth: normals are averaged per vertex and interpolated, so curves look curved. Same geometry, different normals.

“Merge vertices and recompute normals to get smooth shading.”
bright rim look down:see throughgrazing:mirror

Fresnel

Surfaces reflect more when seen at a grazing angle. Think of a lake: transparent at your feet, a mirror toward the horizon. It also gives the glowing “rim light” look.

“Add a Fresnel rim so the hologram edges glow.”
shadow depth from light

Shadow map

Render the scene once from the light’s point of view and store depths. Later, a pixel is in shadow if it’s farther from the light than what the light “saw”. Common artifacts are acne, peter-panning and blocky edges. The fixes are bias, a higher map size and PCF soft filtering.

“Shadow acne. Increase the bias a little.”
corners & contacts get darker

Ambient occlusion AO · SSAO

Darkening in creases, corners and where objects touch, because less ambient light reaches there. It’s often baked into a texture, or approximated each frame in screen space (SSAO).

“Add SSAO. The furniture looks like it’s floating.”
emissivelit

Emissive

A color a surface gives off by itself, so it shows even in darkness. It doesn’t light other objects, though. Pair it with bloom for the glow.

“Make the screens emissive and let bloom do the glow.”

Environment map & IBL

A 360° image (often an HDRI) of the surroundings, used for reflections and soft ambient lighting. Lighting a scene from an image is IBL (Image-Based Lighting). It’s the quickest way to make PBR look real.

“Without an env map the metal looks black. There’s nothing to reflect.”
renderer.render(scene, camera) draws one frame
  • Scene the root of the scene graph
    • Mesh = Geometry + Material
      • BufferGeometry attributes: position · normal · uv · (index) → vertex buffers
      • MeshStandardMaterial color · map · roughness · metalness · normalMap → compiled into a shader program + uniforms + textures
    • Group / Object3D transform-only node; children follow it
    • DirectionalLight AmbientLight …
  • PerspectiveCamera(fov, aspect, near, far)

Mesh · Geometry · Material · Shader three.js anatomy

Geometry is the shape data. Material is the look, in high-level terms. A shader is the GPU program a material compiles into. A texture is an image a material uses. They’re easy to confuse, and this tree keeps them apart.

“Reuse the same material instance so three.js doesn’t compile another shader.”

07Image quality & post-processing

What happens to the finished image before it reaches the screen, and the artifacts you’ll want to name.

Aliasing & Anti-aliasing AA · MSAA · FXAA · TAA

Jagged “staircase” edges come from sampling once per pixel. MSAA takes several samples on edges. FXAA/SMAA blur edges as a post-process. TAA accumulates samples over frames.

“Turn on antialias: true. The edges are jaggy.”
Scene→RenderPass→Bloom→ToneMap + sRGB→FXAA→screen

Post-processing passes · effect composer

Render the scene to a texture, then run full-screen passes over it. Each pass is a shader that reads one image and writes the next.

“Add an OutputPass at the end of the composer.”
bloom offbloom on

Bloom

Very bright areas bleed a soft glow into their surroundings, like a camera lens. You extract the bright parts, blur them, and add them back. A threshold sets what counts as bright.

“Lower the bloom threshold so only the neon glows.”

HDR & Tone mapping

Lighting is computed in HDR (High Dynamic Range: values above 1.0). Tone mapping (ACES, AgX, Reinhard) squeezes that into what a screen can show without blowing out to white. Exposure scales it first.

“Highlights clip to white. Enable ACES tone mapping and lower the exposure.”

Gamma & color space linear · sRGB

Lighting math must happen in linear space. Screens expect sRGB (gamma-encoded). Skip the conversion and lighting looks too dark and harsh. Get it wrong the other way and everything looks washed out.

“Set the output color space to sRGB and mark color textures as sRGB.”
focus distance

Depth of field DOF · bokeh

Blurring things in front of and behind a focus distance, like a real camera lens. The out-of-focus blobs of light are called bokeh.

“Add a shallow depth of field to focus on the product.”
1×2×3×5×same pixel shaded many times

Overdraw & fill rate

Overdraw is shading the same pixel several times because layers sit on top of each other. Heavy particles and transparency make the GPU fill-rate bound, where the number of pixels is the bottleneck.

“It’s fill-rate bound. Lower the pixel ratio or shrink the particles.”
Forward objects shade × each lightscreen Deferred objects G-buffer lights

Forward vs Deferred rendering

Forward shades each object against every light as it’s drawn. That’s simple, it handles transparency, and it’s what three.js does. Deferred first writes albedo, normals and depth into a G-buffer, then lights the pixels, which is cheap even with hundreds of lights.

“With 200 lights we need deferred, or clustered forward.”
60 fps = 16.7 ms per frame 8.3 ms = 120 Hz JSdraw callsGPUspare animate with deltaTime, not frames

Frame budget & delta time

The time you have to produce one frame. Go over it and you drop frames (jank). Use delta time (the time since the last frame) so motion speed doesn’t depend on the refresh rate.

“We blow the frame budget on the GPU. Profile the shadow pass.”

08Motion, interaction & other techniques

Making things move, react to the mouse, and a few rendering techniques you’ll hear about.

Raycasting / Picking

Shoot an invisible ray from the camera through the mouse position and find the first triangle it hits. That’s how you click or hover 3D objects. Move your mouse over the sphere.

“Raycast against the bounding boxes first. Per-triangle is slow.”

Lerp & Easing

Lerp (linear interpolation) blends between a and b by t ∈ [0,1]. Easing curves reshape t so motion speeds up, slows down or overshoots, which makes it feel natural.

“Lerp the camera toward the target each frame for a smooth follow.”

Keyframes & Animation clip

You set values at a few moments (keyframes), and the engine interpolates between them. A named set of tracks (“walk”, “jump”) is a clip. A mixer plays and blends clips.

“Cross-fade from the idle clip to the run clip.”

Skinning skeleton · bones · weights

A hidden skeleton of bones deforms the mesh. Each vertex has weights that say how much each bone moves it. Smooth weights at a joint give a smooth bend.

“The elbow collapses. The skin weights need smoothing.”

Morph targets blend shapes · shape keys

Stored alternate positions for the same vertices, blended by a weight. They’re used for facial expressions, lip sync and shape transitions.

“Drive the ‘smile’ morph target influence from 0 to 1.”

Particles billboards · point sprites

Lots of tiny short-lived elements (sparks, smoke, rain), each with a position, velocity and lifetime. Each is usually a billboard: a flat quad that always faces the camera.

“Render the sparks as instanced billboards with additive blending.”

Raymarching & SDF

An SDF (Signed Distance Field) returns the distance to the nearest surface. Raymarching steps along a ray by that distance (the circles) until it hits. You get whole scenes from math in a fragment shader, no triangles needed.

“Do the clouds with raymarching. Meshes can’t do volumes.”
rasterize: triangles → pixelsray trace: pixels → rays → scene

Rasterization vs Ray tracing

Rasterization (what WebGL does) projects triangles onto pixels, which is fast. Ray tracing fires rays per pixel and bounces them for true reflections and shadows. That’s slower, but path tracing gives photoreal results.

“Use the path tracer for the marketing stills, the rasterizer for real time.”

16Phrasebook: what you see → what to call it

When something looks wrong, these are the words to search for, ask about, or put in a bug report.

You see…Call itUsual fix