Add moss and fur with shells

Shell texturing copies your mesh outward along its normals, 8 to 32 times. Each layer discards more of a noise texture, so the stack reads as moss, fur or short grass. You write the shader in three.js, Godot or Unity. Cut the layer count as the camera pulls away, because each shell is another pass over the mesh.

Try the layer count

Move the slider from 8 to 32 layers. At 8 you can still see the gaps. At 32 the coat fills in, and each added layer is another pass over the mesh.

Turn on WebGL in your browser to load the 3D view.

16
Frame time
0.0 ms
Cost per layer
16 shell passes over the mesh

Drag to orbit the rock. Turn the mask off to grow shells over the whole mesh, which costs more fill.

How stacked shells work

Each shell is a copy of the mesh pushed out along its normals by a growing offset.

The first shell sits close to the surface. The last one sits at the tip length you chose, often one or two centimeters for moss and a little more for fur.

Each shell samples a noise or strand texture and discards pixels below a cutoff. The cutoff rises with the layer, so the inner shells stay dense and the tips break into clumps.

Cost per layer

A shell shades the same triangles again. 32 layers cost about 32 times the fill of the bare mesh, more where the shells overlap on screen.

Keep the cost down in two ways. Grow shells only where the cover should appear, such as upward faces and crevices. Drop the count with distance, for example 32 near the camera and 8 to 12 in the middle, then a precomputed color on the far mesh.

meshfx already writes LODs and impostors for that far view, so you can run the shells only on the near levels.

Wind sway

Move the outer shells more than the inner ones, so the tips sway and the roots stay planted.

In the vertex shader, add a sideways offset driven by time and world position, then scale it by the shell height squared. A slow sine is enough for moss. Fur can use a slightly larger offset on the same term.

Write the shader in your engine

You pass a shell index and a layer count, then offset, cut and tint in the shader. The same contract works in three.js, Godot 4 and Unity.

  1. In three.js, build an InstancedMesh with a ShaderMaterial. Set count to the layer count and, in the vertex shader, use gl_InstanceID as the shell index.
  2. In Godot 4, use a MultiMeshInstance3D with one material. In the shader, INSTANCE_ID over INSTANCE_COUNT is the shell height, which keeps every layer in one draw.
  3. In Unity URP, instance the mesh with one material, or set _ShellIndex and _ShellCount on a material property block. Offset positionOS along normalOS by that height times your length.
three.js
const shells = new THREE.InstancedMesh(geometry, material, 32);
shells.count = 16;

// Vertex shader
float shell = float(gl_InstanceID) / max(uCount - 1.0, 1.0);
vec3 pos = position + normal * shell * uLength;
Godot 4
// MultiMeshInstance3D, instance count = layer count.
// In a spatial shader:
float shell = float(INSTANCE_ID) / max(float(INSTANCE_COUNT - 1), 1.0);
VERTEX += NORMAL * shell * length;
// In the fragment, alpha-test noise with a cutoff that rises with shell.
Unity URP
float shell = (float)_ShellIndex / max(_ShellCount - 1, 1);
positionOS.xyz += normalOS * shell * _Length;
// Alpha-test a noise map with a cutoff that rises with shell.

Once the mesh is clean, with LODs and an impostor for the far view, you can run this shader on the near levels. Send the model to meshfx to get those LODs and impostors.

Use with your agent

Paste the prompt into Claude Code, Cursor or Codex. Your agent connects to Spatial Compiler and comes back with a cleaned GLB with LODs and an impostor your engine can load.

New accounts start with $5 of usage, and you see the price of each job before it runs.

Agent prompt

Connect the Spatial Compiler MCP server at https://spatialcompiler.dev/mcp if it isn't connected yet. Use meshfx to clean up my rock mesh, build 3 LODs and add an impostor I can use in three.js, Godot or Unity. Run a Draft first. Your first 50 mesh Drafts are free with the $5 signup credit. Ask before running a final compile.

Or add the server yourself in Claude Code:

claude mcp add --transport http spatial-compiler https://spatialcompiler.dev/mcp

Set it up in Cursor, Codex or another agent

Shell texturing questions

All questions →

How many shell layers do I need for moss or fur?

Start with 8 to 12 layers for short moss, and go up to 24 or 32 for thicker fur. Add layers until the gaps disappear at your closest camera distance, then stop.

Why does shell texturing get expensive as I add layers?

Each layer draws the mesh again, so the fill cost grows with the layer count and with how much of the screen the shells cover. Mask the cover and drop the count with distance to keep the cost down.

Is it possible to do shell texturing without bloating my draw calls?

Yes. Instance every shell with one mesh and one material, and pass the shell index as an instance value. In Godot 4, a MultiMeshInstance3D does this in one draw.

How does shell texturing work?

You draw the mesh several times, each copy pushed out along its normals. A noise texture is alpha-tested with a cutoff that rises on the outer layers, so the stack reads as volume.

Can I use shell texturing for moss, fur and short grass?

Yes, the same stacked shells work for all three. Shorter cover uses fewer layers and a tighter offset. Longer fur needs more layers and more wind on the tips.

How do I add wind to shell textured moss?

In the vertex shader, add a sideways offset that grows with the shell height, driven by time and world position. The roots stay still and the tips sway.

Should I put shells over the whole mesh?

No. Grow shells only where the cover should appear, such as upward faces and crevices. Bare rock should stay a normal opaque material so you do not pay for empty layers.

What is the difference between shell texturing and hair cards?

Shells are offset copies of the surface, good for short, dense cover such as moss and fur. Hair cards are separate strips or planes, which suit longer, styled hair that needs a clear silhouette.