# Making blocks look good enough to eat

> 2026-11-07 · Graphics · rendering, shaders, lighting, voxels, textures, WebGL
> https://hyna.dev/en/posts/blocks-that-look-like-candy

Let me start again from the island that opened the previous two posts in this series. It is a small floating island built from blocks, and you can drag it or use the arrow keys to turn it.

> Interactive demo: A small floating block island rendered with WebGL2: a cottage, a pond, three trees, flowers and one big-headed villager. Block edges are shaded round, shadows are tinted blue-violet, each block gets a candy-like pattern and a soft glaze, and the top and bottom of the frame are blurred so it reads as a tabletop miniature. Drag or use the arrow keys to turn the island. — https://hyna.dev/en/posts/blocks-that-look-like-candy

This time we look at the surface of the blocks. The sides of the grass blocks have marks like green icing running down, and the roofs carry a scale pattern like piped cream. The clumps of leaves let light through like jelly when the sun is behind them, and the water sparkles like soda. Yet the dirt still reads as dirt and the stone as stone. This post is about how I made these blocks look like candy.

## The sentence it started from

Like the two posts before it, [Why square blocks look soft](/en/posts/why-blocks-look-soft) and [Why game shadows aren't black](/en/posts/why-game-shadows-arent-black), this series takes its starting point from the impression the screens of the game ぽこ あ ポケモン (Pokémon Pokopia) left on me. As far as I could find, there is no official technical talk or article explaining how this game renders. So I quote only the art direction comments that are public, and show the implementation with a WebGL2 renderer that I wrote after reading those comments, and a block diorama I built myself. I can't know what the game actually does, and this post doesn't claim to.

This time the starting point is something Koei Tecmo's art director 綾野万里奈 (Marina Ayano) said in a [developer interview with Famitsu](https://www.famitsu.com/article/202602/66124).

*また、造形や表現を大きくデフォルメしているからこそ、地形やオブジェクトの質感に関しては、現実とリンクする素材感を軸にしつつどこかお菓子のようなおいしそうな質感や色や模様を意識して、誰もが馴染みを持てる納得できるルックを目指しました。*

In English, roughly: *Because we heavily stylised the shapes and expression, for the textures of the terrain and objects we kept a sense of material that links to reality as the core, while being mindful of somehow candy-like, delicious-looking textures, colours and patterns, aiming for a look anyone can feel at home with and accept.*

There is an odd tension in this. The shapes have been pushed far from reality, but the materials are to stay anchored to it. The way I read it, it splits into two demands.

- **Cues that tell you the material.** However round and large a block is, dirt has to read as dirt and wood as wood at a glance. The pattern does most of this work.
- **A finish that looks good enough to eat.** On top of that goes the surface of a sweet: a sugar-glaze sheen, light seeping in a little as in jelly, warm saturated colour. The lighting maths does most of this work.

## Patterns that tell you the material

Say 'materials in a block game' and most people picture a small pixel-art texture stuck on each block face. This renderer uses no texture images at all. Every pattern is computed from coordinates inside the fragment shader. This is called a procedural texture.

I did it this way for two reasons. First, a pattern controlled by a few numbers makes it easy to experiment with how far to lean towards candy. Second, it isn't tied to a resolution, so the pixels don't break up when the camera gets close. In a diorama where blocks fill a lot of the screen, that matters quite a bit.

Almost every pattern is made by mixing two kinds of noise.

One is value noise. You put a random value on each corner of an integer grid and interpolate smoothly between them. The interpolation factor follows a cubic curve rather than a straight line, so no creases show along the grid lines.

$$
u = 3f^2 - 2f^3, \qquad n(\mathbf{p}) = \operatorname{mix}\big(\operatorname{mix}(a, b, u_x),\; \operatorname{mix}(c, d, u_x),\; u_y\big)
$$

Here f is the position inside the grid cell (0–1), and a to d are the random values at the four corners. Add a few layers of this noise, each at half the size of the last (this is called fBm), and you get irregular variation like the blotches in dirt or the colour drift in grass.

The other is cellular noise. You scatter random points (feature points) through space and, at each position, use the distance to the nearest one as the value.

$$
F_1(\mathbf{x}) = \min_i \lVert \mathbf{x} - \mathbf{p}_i \rVert, \qquad F_2(\mathbf{x}) = \text{distance to the second-nearest point}
$$

F1 alone gives round patterns spreading out from each point. Subtract F1 from F2 and the result is 0 on the boundary between two points, which gives lines like cell walls or the mortar between stones. If the function also returns the index of the nearest point, each cell can get a slightly different colour. That index is why every pebble is a subtly different shade.

The figure below shows, step by step, how these ingredients become the dirt pattern. I ported the shader's functions as they are and computed the same region.

![Five panels joined by arrows. The first is a mosaic with one random grey per grid cell; the second joins the same values smoothly with a cubic curve into soft blotches (value noise); the third adds three layers of noise at different sizes for finer, rippling blotches (fBm). The fourth is cellular noise F1, black dots scattered on white, each pixel showing the distance to the nearest feature point. The last is the dirt pattern: round brown grains, picked with cellular noise, set into the fBm blotches.](/images/posts/blocks-that-look-like-candy/noise-steps-en.svg)

Here is a cellular noise function, simplified for explanation. The real shader narrows the range a little so feature points don't sit right on the cell edges.

```glsl
// x: distance to the nearest point, y: second-nearest distance, z: index of the nearest cell
vec3 cellular(vec2 p) {
  vec2 i = floor(p), f = fract(p);
  float d1 = 8.0, d2 = 8.0, id = 0.0;
  for (int y = -1; y <= 1; y++)
    for (int x = -1; x <= 1; x++) {
      vec2 g = vec2(x, y);
      vec2 o = hash22(i + g);          // feature point position in the neighbouring cell (0–1)
      float d = length(g + o - f);
      if (d < d1) { d2 = d1; d1 = d; id = hash12(i + g); }
      else if (d < d2) d2 = d;
    }
  return vec3(d1, d2, id);
}
```

To put a procedural pattern on a surface, you need 2D coordinates on that surface. On a curved character, unwrapping the UVs is a big job in itself, but in a block world the problem nearly disappears. Every face points along one of the x, y and z axes.

So this renderer picks two components of the world position, depending on which way the face points, and uses them as pattern coordinates. (x, z) for a top face, (z, y) for a side facing the x axis, (x, y) for a side facing the z axis. Simplified for explanation, it looks like this.

```glsl
vec3 aG = abs(geomNormal);
bool top = aG.y > max(aG.x, aG.z);
vec2 q = top ? worldPos.xz
       : (aG.x > aG.z ? worldPos.zy : worldPos.xy);
vec3 albedo = patternFor(material, q);
```

This comes with a bonus. Because the coordinates carry straight on from one block to its neighbour, ten dirt blocks in a row don't repeat the same pattern block after block; they join up like one wide stretch of ground. The checkerboard repetition and seams you get from putting the same texture on every block never appear in the first place. The other way round, patterns where one block is the unit, like growth rings or boards, use the position inside the block (the fractional part of the world position) to break deliberately at each block.

The UVs (0–1) that the mesh stores on each face are used for the edge rounding covered in the [first post](/en/posts/why-blocks-look-soft). Block faces are square, so these UVs are always even, and since the patterns and the rounding use different coordinates, they don't interfere.

From these two ingredients, value noise and cellular noise, I built a separate pattern for each material. There was one rule: pick the one feature that makes the real material recognisable, and make it big, round and clean like candy.

- **Dirt**: fBm lays down blotches, and cellular noise sets small grains into them. A few cells are picked and darkened slightly so it looks like cookie dough with crumbs in it.
- **Grass top**: two layers of large fBm spread blotches of yellowish and bluish green, and cellular noise dots bright specks here and there. Without drawing a single blade, the specks and blotches alone read as grass.
- **Grass side**: a sine wave and noise make the edge where green runs down over the dirt. This is the part that looks like icing melting down from the green on top, and darkening just below the edge gives it some thickness.
- **Log**: the top draws growth rings with a sine of the distance from the centre, with noise wobbling the circles a little. The sides get grain from value noise stretched long and vertical.
- **Plank**: one block is split into three boards, each a slightly different brightness, with the seams darkened as if pressed in.
- **Stone and path (cobbles)**: one cellular noise cell is one stone. The boundary (where F2 − F1 is small) becomes the mortar, the cell index changes the colour of each stone, and brightening towards the centre of each cell makes the stones look domed.
- **Sand**: only very fine value noise and a slightly different brightness per small cell, leaving just a fine grain.
- **Roof**: half-circle scales stacked in staggered rows. I had cream piped from a piping bag in mind when I made it.
- **Water**: cellular noise boundary lines drift slowly over time to float bright, soda-like lines, and a sine wave makes the normal on the top ripple slightly.
- **Leaves**: random points are scattered as in cellular noise, but instead of picking only the single nearest point, the distances to neighbouring points are blended with larger weights for closer ones. That way no sharp boundary forms between cells, and the surface becomes round peaks flowing smoothly into each other. Each peak is treated as a small dome, and the normal is bent slightly along its slope. So on every peak the side facing the sun is bright and the far side dark. The colour, too, is warm at the top of each peak and bluish in the hollows. The idea is to make the leaves look not like leaves drawn one by one but like a lump of jelly sweets pressed together.

The leaf peaks show up better in the normals than in the colour. Put the same tree side by side as the final image and as the normal debug output, and you can see the normals curving round each peak even within a single block face.

![Two close-up shots of the big tree on the opening island. In the final image on the left, every face of the leaf blocks has bright, yellowish peaks and bluish hollows running into each other in soft bumps. In the normal output on the right the same spots are round, blurred patches of green, blue and pink, showing that the direction changes from peak to peak even on a flat block face. The edges are widely rounded, so the colour turns softly.](/images/posts/blocks-that-look-like-candy/leaf-puffs-en.webp)

*The leaf clump of the big tree, final (left) and normals (right). Rendered by me.*

Below, each block from the material sample scene in the lab further down is cropped close up. Every finish is on.

![A two-row grid of ten blocks, each enlarged. Top row, from the left: grass with green icing running down its side and round brown specks below; dirt with dark round specks like a cookie; stone, lilac stones split by dark mortar; smooth, fine yellow sand; and path, cream cobbles split by mortar. Bottom row: a log with an orange ring disc on top and vertical grain on its sides; a plank split horizontally into three boards; a red roof with half-circle scales overlapping on its sides; leaves that seem lit by bright green from inside; and water with a sky-blue top and deep blue sides. A slightly brighter square floats in the middle of the plank and roof tops.](/images/posts/blocks-that-look-like-candy/material-closeups-en.webp)

*The ten material sample blocks, every finish on, afternoon sun. Rendered by me.*

The patterns are far simpler than reality. The dirt has no pebbles or roots, the wood no knots. I think the materials still read because each one keeps a single defining feature, clearly. It also suits the stylised shapes: the shapes were simplified, so the patterns were simplified at the same rate. Turn off only the patterns and leave everything else, and the dirt, sand and path become flat-coloured lumps told apart only by colour.

![Two shots of the same tray side by side. On the left, with patterns off, all ten blocks are flat colours, so dirt and log, and sand and path, look like lumps of similar colour. On the right, with patterns on, the grass icing, the dirt grains, the stone mortar, the plank seams and the log rings appear.](/images/posts/blocks-that-look-like-candy/pattern-off-on-en.webp)

*Patterns off (left) and on (right). Every other finish on. Rendered by me.*

## Three things that make it look like candy

Now that the patterns make the materials readable, it is time to turn the surface into candy. Think of sweets and a few traits come to mind. In jelly or hard candy, light doesn't bounce straight off the surface; it goes in a little and comes back out. A sugar-glazed cookie shines, but not with the hard glare of plastic; the shine spreads softly. And the edges of a round sweet glow faintly in the light from behind and around it. This renderer turns these into a translucency approximation, a broad sheen and a rim light.

### Light seeping in

In translucent things like skin, marble or jelly, light goes under the surface, scatters a few times, and comes out again near where it went in. This is called subsurface scattering. Doing it properly is expensive, but cheap tricks that fake only the noticeable effect have been in use for a long time.

The first method in [GPU Gems, chapter 16, Real-Time Approximations to Subsurface Scattering](https://developer.nvidia.com/gpugems/gpugems/part-iii-materials/chapter-16-real-time-approximations-subsurface-scattering) is wrap lighting. The range the light reaches is wrapped a little way round into the shadow side, so light spreads past the boundary between light and shade (the terminator), where it would otherwise cut off to black.

$$
d_{\text{wrap}} = \max\!\left(0,\; \frac{\mathbf{n} \cdot \mathbf{l} + w}{1 + w}\right)
$$

With w at 0 this is ordinary Lambert diffuse; the larger it is, the further the light wraps round the back. It is the same family of formula that came up when softening shade in the [previous post](/en/posts/why-game-shadows-arent-black) in this series. The same chapter has a trick that goes one step further: add a reddish tint (`scatterColor`) only in a narrow band near the terminator, imitating the way the edge of shadow on skin turns slightly red.

This renderer follows the same idea. It adds colour only in the difference between the wrapped diffuse (w = 0.55) and the original diffuse, that is, in the band past the terminator. That colour is the material colour multiplied by itself once more for extra saturation. The shadow edge on grass becomes a deeper green, on a petal a deeper pink. It is like holding jelly up to the light: where it turns into shade, it goes not grey but a deeper shade of its own colour.

![A figure in two parts. The top shows two surface cross-sections side by side. On the opaque surface on the left, light bounces straight back where it enters; in the translucent candy on the right, a pink path bends several times under the surface, scattering, and comes out a little way off. The bottom shows the same ball twice, lit from the right. The left ball cuts off sharply at the terminator with black shade; on the right ball the boundary bleeds into the shade and the area near it is tinged pink.](/images/posts/blocks-that-look-like-candy/sss-sketch-en.svg)

One more thing: thin things like leaves and petals glow with light from behind when they stand against the sun. I added a term that switches on only when the view direction and the light direction nearly face each other. Finally, I let a little more light gather on the edges facing the sun. In thin, soft things, light that grazes them seeps in at the edges and scatters back out, so the outline on the sun side seems to glow faintly. This term grows the more you look at the surface edge-on (the larger 1 − n·v) and the more that face points towards the sun, and it turns off in shadow. Here is the code, simplified for explanation.

```glsl
float NdL = dot(N, L);
float lambert = max(NdL, 0.0);
// band past the terminator: wrapped diffuse - original diffuse (weaker in shadow)
float band = max((NdL + 0.55) / 1.55 - lambert, 0.0) * mix(0.35, 1.0, shadow);
// thin things against the sun: brighter the more the view faces the light
float through = pow(clamp(dot(V, -L), 0.0, 1.0), 3.0) * (0.35 + 0.65 * shadow);
// glow on edges facing the sun: more at grazing angles, more towards the sun
float glow = pow(1.0 - max(dot(N, V), 0.0), 2.0) * smoothstep(-0.1, 0.7, NdL) * shadow;
vec3 sssColor = albedo * normalize(albedo + 0.05) * 1.6;   // a deeper shade of its own colour
color += sssColor * sunColor * sss
       * (band * 0.55 + through * 0.35 + glow * 0.5 * sss) * ao;
```

`sss` is a per-material value. Leaves, petals and skin are high at 0.9, grass is 0.55, and dirt, stone and log are low at 0.08–0.15. The edge glow is multiplied by `sss` a second time, so on low-value materials that term all but disappears. If even the dirt glowed like jelly, the sense of material would fall apart. This is where the first demand (the material has to read) sets a limit on the second (it has to look like candy).

Switch only this term off and on in the material samples, and the leaf block changes the most.

![Two shots of a roof block and a leaf block from the same angle. On the left, with translucency off, the leaf block is a dull teal lump with its sides sunk in shadow. On the right, with translucency on, the top and upper sides of the leaf block glow a bright light green, like jelly with light shining out from inside. The roof block looks nearly the same in both.](/images/posts/blocks-that-look-like-candy/sss-off-on-en.webp)

*Translucency off (left) and on (right). The roof, with `sss` at 0.3, hardly changes; the leaves, at 0.9, change a lot. Rendered by me.*

### A sugar-glaze sheen

Shine, that is, the specular highlight, is most commonly computed with the Blinn-Phong model. You find the vector h halfway between the light direction and the view direction, and the closer the normal is to h, the brighter.

$$
\mathbf{h} = \frac{\mathbf{l} + \mathbf{v}}{\lVert \mathbf{l} + \mathbf{v} \rVert}, \qquad I_s = k_s\,(\mathbf{n} \cdot \mathbf{h})^{s}
$$

The larger the exponent s, the smaller and sharper the highlight. Give it a large exponent and a high strength, and you get a plastic toy with a small, hard white dot on it. Sweets don't shine like that. A sugar-glazed or syrup-coated surface isn't perfectly smooth, so the highlight spreads wide, with a slightly brighter part in the middle.

So this renderer layers the highlight twice: a broad layer with a small exponent (strength 0.3), and a narrow layer with the exponent raised 2.5 times (strength 0.5). On top of that, each material gets its own `glaze` (strength of the sheen) and `shine` (exponent). Places that should look like candy, such as the roofs and mushroom caps, have `glaze` 1.0 and `shine` 34–36; dirt is low and broad, with `glaze` 0.45 and `shine` 10.

![Two highlight shapes drawn in polar coordinates. Hard plastic on the left (exponent 128) is a thin, elongated blue petal along the reflection direction; sugar glaze on the right (exponent 8) is a round, wide pink blob spread around the same direction. In both, the light comes in 40 degrees from the normal.](/images/posts/blocks-that-look-like-candy/specular-lobes-en.svg)

```glsl
// simplified for explanation
vec3 H = normalize(L + V);
float nh = max(dot(N, H), 0.0);
float spec = 0.3 * pow(nh, shine)           // broad layer
           + 0.5 * pow(nh, shine * 2.5);    // narrow layer
color += sunColor * glaze * spec * fresnel * lambert * shadow;
```

The `fresnel` in the last line is explained right after this. Don't forget to multiply the highlight by the shadow (`shadow`), either. A sweet that sparkles in the shade quickly looks wrong.

To be honest, this sheen doesn't jump out. Flat top faces mostly look at the sky, so they rarely line up with the half vector h, and the highlights land mainly on the rounded edges and on round props like flowers and mushrooms. Even when one falls on a bright pastel top, the tone mapping curve gently compresses the bright end, so instead of blowing out to white it just brightens a little. That is what I wanted, but when you toggle it in the lab below, you need to know where to look to find the difference. The starting angle of the material samples deliberately faces the sun so that the tops fall in the highlight direction, and the place it shows best then is the tops of the plank and the roof.

![Two shots of a plank block and a roof block from the same angle. On the left, with the highlight off, the tops of both blocks are evenly matte. On the right, with the highlight on, a slightly brighter, whiter square floats in the middle of the plank top and the roof top, just inside the rounded edges.](/images/posts/blocks-that-look-like-candy/glaze-off-on-en.webp)

*Sugar-glaze highlight off (left) and on (right). Rendered by me.*

### Light on the edges

Look at a window head-on and you can see outside clearly, but look at it at an angle and the reflection grows stronger until it acts like a mirror. This rise in reflectance the more edge-on you look at a surface is called the Fresnel effect. The exact Fresnel equations are fairly involved, so real-time rendering almost always uses the approximation from [Christophe Schlick's An Inexpensive BRDF Model for Physically-based Rendering](https://diglib.eg.org/handle/10.2312/6905) (1994).

$$
F(\theta) = F_0 + (1 - F_0)\,(1 - \cos\theta)^5, \qquad \cos\theta = \mathbf{n} \cdot \mathbf{v}
$$

F0 is the reflectance seen head-on. Looking straight at the surface (cos θ = 1) gives F0; looking at it edge-on (cos θ = 0) gives 1. Things like glass and plastic have an F0 of around 0.04, so they reflect almost nothing head-on, and the reflection shoots up only at very steep angles.

This renderer uses this shape in two places. One is the `fresnel` multiplied into the sheen above. I set F0 fairly high, at 0.6, so the sheen stays alive head-on and gets a little brighter towards the edges. It is a value that looks good rather than one that is physically right.

The other is a separately added rim light. It raises the same `1 - n·v` form to the power 3.5 and adds it mixed with sky colour. The figure below plots, with the actual constants, how the two values change with viewing angle.

![A graph with the angle between view and normal from 0 to 90 degrees on the horizontal axis and 0 to 1 on the vertical, holding three curves. The solid pink curve, the value used for the sheen, runs flat at 0.6, starts rising around 60 degrees and reaches 1 at 90. The solid orange curve, the rim light, is nearly flat at 0, climbs steeply past 50 degrees and reaches 1 at 90. The dashed blue curve, an F0 0.04 curve for reference, is similar to the orange one but rises a little later.](/images/posts/blocks-that-look-like-candy/fresnel-curves-en.svg)

Put a round sweet by a window and its edges catch the sky light and seem to lift off brightly. This term is aiming for that feeling. I should say plainly that it only borrows the Schlick approximation; it is a term for look, not a physical model.

```glsl
// simplified for explanation
float fresnel = 0.6 + 0.4 * pow(1.0 - max(dot(N, V), 0.0), 5.0);  // F0 = 0.6
float rimF = pow(1.0 - max(dot(N, V), 0.0), 3.5);
color += (skyColor * 0.55 + sunColor * 0.25 * shadow) * rim * rimF * 0.45 * ao;
```

In a block world, this rim light matters more than you might think. On a flat-faced block, n·v is the same across the whole face, so a rim light hardly forms. Because the [first post](/en/posts/why-blocks-look-soft) tilted the edge normals into a curve, a thin bright rim appears along the edges. Work done in an earlier post gets reused here. The effect is small, though. In the material samples it shows best along the edges of the dark sides of the leaf block.

![Two shots of a leaf block and a water block from the same angle. On the left, with the rim off, the left side of the leaf block is sunk in dark teal. On the right, with the rim on, the same side lightens slightly towards grey, and thin bright lines appear along the vertical edges of the leaf and water blocks.](/images/posts/blocks-that-look-like-candy/rim-off-on-en.webp)

*Rim off (left) and on (right). Rendered by me.*

Last, I touched the colour itself. Rather than draining the colour of shaded areas towards grey, I raise their saturation a little, and more so for materials with higher translucency. When colour turns muddy in the shade, things look less like candy and more like a dusty model. Tinting shade a blue-violet is covered in detail in the [second post](/en/posts/why-game-shadows-arent-black).

### Toggle it yourself

In the lab below you can switch each of the steps so far on and off and compare.

> Interactive demo: One block each of grass, dirt, stone, log, plank, roof, leaf, path, sand and water on a tray. Switch the block-face patterns, the translucency that lets light bleed through, the broad soft sugar-glaze highlight and the rim on and off one at a time. On the whole island, tilt-shift and the colour grade can be switched too, and the frame can be split into albedo, normal, depth, AO and shadow. Move the sun or drag to turn the scene and watch the highlights move. — https://hyna.dev/en/posts/blocks-that-look-like-candy

It opens on the 'Material samples' scene. The blocks are set apart one by one on a tray, so all twelve edges of each block are rounded and the patterns and highlights fill the screen. The front row, from the left, is grass, dirt, stone, sand and path; the back row is log, plank, roof, leaf and water. In the 'Finish' row you can switch Pattern, Translucency, Sugar-glaze highlight and Rim on and off one at a time. Move the sun with the 'Sun' slider or drag the scene round, and the highlights and translucency follow.

Switch 'Scene' to 'Whole island' and the opening island appears, along with Tilt-shift and Colour grade in the 'Post' row. On the whole island, so that switching them shows, the tilt-shift is turned up to 2.6 times and the colour grade to 2.5 times what the opening island uses. Light bleed (bloom) is on, as on the opening island, but very weak, and there is no switch for it. 'Frame breakdown' splits the screen into albedo, normal, depth, AO and shadow.

As you switch them off one by one, you may notice that no single one is decisive; it is the small differences adding up that make it look good enough to eat.

## The last layer of the miniature

Even with the materials on, the screen can still look like a large world seen from far away. The last layer that makes it look like a small diorama sitting on a table is post-processing.

Blur the top and bottom of a photo of a full-size street taken from high up, and it looks like a toy town. It is an effect made either with a tilt-shift lens or by adding blur afterwards. Why it looks that way was studied experimentally in [Held, Cooper, O'Brien and Banks, Using Blur to Affect Perceived Distance and Size](https://pmc.ncbi.nlm.nih.gov/articles/PMC3088122).

The principle goes like this. When you photograph a small object up close, the range of depth in focus (the depth of field) is very shallow, so moving even a little forward or back goes out of focus. Our eyes know this relationship from experience, so when blur in a scene changes quickly with depth, we take the scene to be something small and close. The paper explains that we judge size by looking at the pattern of blur together with relative depth cues.

There is another interesting result. Simply blurring the top and bottom of the frame, as photo apps do (a vertical gradient), also works, but only when that gradient lines up with the way depth changes in the scene, and even then it gave less consistent results than blur matched to depth.

So this renderer mixes the two. The base is blur derived from the depth buffer. The depth of the centre of the island the camera is looking at is the focus, and the further from it, the larger the blur radius (the circle of confusion). On top of that, a little blur in bands at the top and bottom of the screen adds the feel of a lens. In a diorama seen from above, the bottom of the screen is generally near and the top generally far, so these bands line up with the change in depth.

As formulas: z is the pixel's view depth, z_f the focus depth, R the radius of the sphere enclosing the whole island, and y the vertical screen position (0–1).

$$
c_{\text{depth}} = \operatorname{smoothstep}\big(0.55R,\; 1.55R,\; |z - z_f|\big)
$$

$$
c_{\text{screen}} = \operatorname{smoothstep}\big(0.34,\; 0.62,\; |y - 0.5|\big)
$$

$$
c = \operatorname{clamp}\big(\max(c_{\text{depth}},\; 0.7\,c_{\text{screen}}),\; 0,\; 1\big)
$$

Up to 0.55 R in front of or behind the focus is fully sharp, and the blur fills in over the next R. The screen band starts 34% of the screen height above and below the middle and is strongest at 62% (effectively the edge of the screen), and it is multiplied by 0.7 to keep it weaker than the depth part. The island nearly fills the frame, so with these values most of the middle of the island stays sharp, and only the top and bottom edges of the screen and the front rim of the island blur slightly.

The figure below is a map painted straight from these formulas. The horizontal axis is depth away from the focus, the vertical is screen height, and the deeper the pink, the stronger the blur.

![Two rectangular maps with the amount of blur painted as pink intensity. In the left map, for the opening island, roughly the left third, up to 0.55R from the focus, is white and sharp, the pink deepens towards the right, and there are pale pink bands along the top and bottom. In the right map, for the lab, the sharp area shrinks to a small rectangle in the middle left, and almost everything else is deep pink. Below, a marker shows that the island sits at depths of roughly 0 to 1R.](/images/posts/blocks-that-look-like-candy/tiltshift-map-en.svg)

This renderer is simple: two blur passes on a half-resolution buffer, one horizontal and one vertical, and that's all. The blur radius follows each pixel's circle of confusion and is, at most, a little over 1% of the screen height. One catch: so that sharp, in-focus pixels don't bleed out into the blurry pixels around them, each sample is mixed in only as far as its own circle of confusion reaches the centre. Leave that out and a blurry halo forms around the sharp outline of the cottage.

```glsl
// simplified for explanation: blur in one direction (horizontal or vertical)
float c0 = cocAt(uv);
for (int i = -6; i <= 6; i++) {
  float t = float(i) / 6.0;
  vec2 s = uv + dir * t * maxRadius * c0;      // maxRadius: 1.05% of the screen height
  float c = cocAt(s);
  float reach = clamp(c * 1.4 - abs(t) * c0 + 0.25, 0.0, 1.0);  // does that sample's blur reach this far?
  float w = exp(-t * t * 2.2) * (i == 0 ? 1.0 : reach);
  sum += texture(src, s) * w;  wsum += w;
}
// when compositing, this blurred result is mixed into the original image by smoothstep(0, 0.6, c).
```

The other two steps are short. Light bleed (bloom) takes only the parts of the HDR buffer where the brightest channel is over 1.15, blurs them twice each horizontally and vertically in a quarter-resolution buffer, and adds them to the original image, multiplied by 0.35, before tone mapping. I kept it weak, just enough for the sparkle on the water and the area round the windows to bleed softly.

Colour grading happens after tone mapping. Tone mapping uses a soft curve that compresses based on the brightest of the channels, so pastel hues and saturation don't fade to grey. It leaves values below 0.6 alone and gently compresses only above that, so bright pastel faces fall on this shoulder. Then the grade lifts the darks slightly towards lavender, warms the brights very slightly, raises saturation by 5% and darkens the edges of the frame softly. Finally, a touch of noise too faint to see is added so the sky gradient doesn't band.

![Two shots of the block island from the same angle, side by side. On the left, with all post-processing off, everything from the roofs to the dirt cliff at the front is sharp. On the right, with post-processing on, the middle with the pond and the villager is sharp, but the roofs and treetops at the back, the dirt cliff at the front and the lower edge of the island are strongly blurred, and the colours are a little warmer and richer.](/images/posts/blocks-that-look-like-candy/post-before-after-en.webp)

*Post-processing off (left) and on (right). So the difference shows, these were shot at the same strength as the whole island in the lab (tilt-shift 2.6×, colour grade 2.5×). The opening island is much gentler. Rendered by me.*

To my eye, the right one, with post-processing on, looks like a small model on a table, and the left one, with it off, like a much larger piece of land. It is the same blocks and the same materials. That a large part of the miniature feel comes not from the blocks but from the camera was the biggest surprise of this work for me.

Look at the two effects separately and it becomes clear where the weight lies.

![Two shots of the same island side by side. On the left, with only tilt-shift on, the roofs, treetops and the dirt cliff at the front are strongly blurred, and only the area round the pond in the middle is sharp. On the right, with only the colour grade on, everything is sharp and it looks almost the same as the island with post-processing off, with the colours very slightly warmer and the edges a little darker.](/images/posts/blocks-that-look-like-candy/post-each-en.webp)

*Tilt-shift only (left) and colour grade only (right), both at the strength of the whole island in the lab. Rendered by me.*

Tilt-shift does nearly all the work of making it look like a miniature. The colour grade only nudges the island's mood a little warmer and softer, and even at 2.5 times strength you have to put them side by side to see the difference.

## Anatomy of a frame

This renderer has three main passes.

1. **Shadow depth.** From the sun's position, the island is drawn with orthographic projection into a 2048×2048 depth texture. No colour is computed. One island mesh and one villager mesh: 2 draw calls.
2. **Lighting pass.** The same two meshes are drawn from the camera (2 draw calls), and a single shader computes the pattern, rounded edges, lighting, shadow, translucency, sheen and rim light, and writes them to an HDR buffer. Almost all the maths from the three posts in this series sits in this one pass.
3. **Post-processing.** Tilt-shift blur at half resolution, horizontal then vertical: 2. Bloom at quarter resolution, one pass to pick out the bright parts and two rounds of horizontal and vertical blur: 4. And finally one composite that combines them and does tone mapping and colour grading: 1. Every post-processing pass draws a single triangle covering the screen.

The lighting pass shader has debug modes that output intermediate values straight to the screen. Pull the same frame out step by step and it looks like this.

![The same frame of the opening island split into six panels. Top row, from the left: albedo, normal, depth. The albedo has only patterns and base colours, with no shading; the normal shows top faces green, front sides blue and right sides red, with colours mottled together on the tree clumps. The depth is grey, bright at the near front and dark at the far back. Bottom row: AO, shadow, final. The AO is almost white, grey only in hollow corners such as between the roof tiers, under the stairs and around the pond. The shadow is white only where the sun reaches, so the shadows of the trees and cottage and the right sides facing away from the sun are black. The final is the island with all colour and light in.](/images/posts/blocks-that-look-like-candy/frame-breakdown-en.webp)

*Six debug outputs of one frame. The same outputs as 'Frame breakdown' in the lab. Rendered by me.*

The albedo has only patterns and no light. In the normals, each block edge shows a band where the colour shifts smoothly: the edge rounding from the first post. The mottling on the leaf clumps is the trace of bending the normal on each peak, as described earlier. The depth is what tilt-shift reads to decide the blur. In the AO, only the hollow corners where blocks meet are dark, and the shadow shows where the sun doesn't reach and the faces turned away from it. All of these are multiplied and added inside a single shader to make the final scene.

As for scale: the opening island has 52,988 triangles, and one frame takes 12 draw calls (shadow 2, lighting 2, tilt-shift 2, bloom 5, composite 1). For time, measured in headless Chrome on a Mac with an Apple M2 chip at 1188×743 pixels, a frame took around 5 ms. That is 120 frames drawn back to back, reading back one pixel each frame to force a wait until the GPU has finished, with the total time divided by the frame count. So it is not pure GPU time but a generous figure that includes the waiting, and it varies a lot with the device and screen size. Block worlds are light to begin with, because faces hidden behind other blocks can be thrown away when the mesh is built, and the patterns and materials added in this post are all maths inside the fragment shader, so they don't add triangles.

This post was about the surface and the camera. Patterns make the materials recognisable, translucency, sheen and rim light give them the finish of a sweet, and blur puts the island on a table.

## References

**Official interviews**

- [Famitsu, ぽこ あ ポケモン developer interview (16 Feb 2026)](https://www.famitsu.com/article/202602/66124)
- [Geek Culture, Pokémon Pokopia interview (11 Feb 2026)](https://geekculture.co/pokemon-pokopia-interview-2d-nostalgia-human-ditto-mainline-games/)

**Patterns and noise**

- [Steven Worley, A Cellular Texture Basis Function (SIGGRAPH 96)](https://history.siggraph.org/?p=117007)
- [Patricio Gonzalez Vivo, Jen Lowe, The Book of Shaders: Noise](https://thebookofshaders.com/11/)

**Materials and lighting**

- [Simon Green, Real-Time Approximations to Subsurface Scattering (GPU Gems, chapter 16)](https://developer.nvidia.com/gpugems/gpugems/part-iii-materials/chapter-16-real-time-approximations-subsurface-scattering)
- [Jim Blinn, Models of Light Reflection for Computer Synthesized Pictures (SIGGRAPH 77)](https://www.microsoft.com/en-us/research/?p=154280)
- [Christophe Schlick, An Inexpensive BRDF Model for Physically-based Rendering (Computer Graphics Forum, 1994)](https://diglib.eg.org/handle/10.2312/6905)

**Block meshes**

- [Mikola Lysenko, Meshing in a Minecraft Game (0fps, 30 June 2012)](https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/)

**Post-processing**

- [Robert T. Held, Emily A. Cooper, James F. O'Brien, Martin S. Banks, Using Blur to Affect Perceived Distance and Size (ACM TOG, 2010)](https://pmc.ncbi.nlm.nih.gov/articles/PMC3088122)
- [Earl Hammon, Jr., Practical Post-Process Depth of Field (GPU Gems 3, chapter 28)](https://developer.nvidia.com/gpugems/gpugems3/part-iv-image-effects/chapter-28-practical-post-process-depth-field)

**Further reading**

- [CEDEC 2023, パルデア地方を描き出す――見た目の仕組みを徹底解説！](https://cedec.cesa.or.jp/2023/session/detail/s64242ce14adbf.html)
- [CEDEC 2026, すべてが壊せる世界の構築 ～破壊を実現するボクセル技術～](https://cedec.cesa.or.jp/2026/timetable/detail/s69a7a41874204/)
- [CEDEC 2026, もっと壊したくなる世界 ～驚きデストラクションと濃厚な絵作り～](https://cedec.cesa.or.jp/2026/timetable/detail/s69a7a1c363feb/)
