The Magic of Spray Foam

Create spray foam you can actually spray around your scene.

The Blend.

One detailed technique for realism in Blender, in 5 minutes each week.

By Samuel Sullins

The Blend

In a basement…

On a spaceship…

In the back of an old van…

On the side of a building…

If you look for it, you can find foam insulation all over the place. Especially on more functional things (like spaceships.)

Next time you’re on a spaceship, look around. I bet you’ll see some insulation.

Spray foam is the most versatile insulation of all. It can be used to:

  • Fill gaps and holes

  • Cover seams between panels

  • Seal around objects

Because it’s so useful in reality, it’s also useful in Blender—to add a whole new layer of realism to your scene.

In today’s Blend, you’ll learn how to create some nice useful spray foam.

I wrote a book…

If you’re a beginner, you’ll find this book useful.

It introduces you to Blender, walks you through all the basic tools, and teaches you how to create your first final render.

Available for purchase now.

Today’s Technique

We’ll create this in 3 phases: setup, Geometry Nodes, and material. It’ll go fast.

First, the setup.

  1. Add a new Curve → Bézier curve. You’ll generate your spray foam along this curve.

That was all the setup. No idea why I made a whole phase for it.

Next, the Geometry Nodes.

  1. Go to the Geometry Nodes tab.

  2. Select the curve and press New. Name the new node group “spray foam.”

Since you know how to build nodes yourself, I’ll just show you a picture of the final result, then explain what it’s doing.

Explanation:

  1. First is the Curve To Points node, which changes the curve to points. In Length mode, we choose how many new points to make as a multiple of the curve’s length.

  2. Next we use a Set Position and a Random Value to mess up the points a little.

  3. Next we use an Instance On Points to put an icosphere on each point. Two Random Value nodes make sure that there spheres all have a different rotation and scale.

  4. Finally a Realize Instances turns the setup into a real mesh.

It’s looking like spray foam, but now we need to make it look smooth and blobby.

To do that, add a Remesh modifier with these settings:

Now the modeling is complete. On to materials.

Since we’re using a Remesh modifier, we can’t add a material to this object (it just doesn’t show up.) To solve this, we create our own “set material” modifier with Geometry Nodes.

  1. Press Add Modifier > Geometry Nodes to add a new modifier, then click the New button on that modifier.

  2. Name the new node group Set Material.

  3. Add a Set Material node, like this:

Now that’s done. Go to the shading tab, add a new material, and name it Spray Foam. In your Set Material modifier, select this material.

Finally it’s time to set up the material nodes. It’s simple: we’ll use Noise Textures to create small bubbles in the foam and some color variation.

Here’s the nodes:

Now you have spray foam—but you can’t spray it yet.

Read on to get to the Extra Tip and see how you can spray this foam all over the place ↓

Samuel’s Selections

Today’s featured render is by Andrianiaina Toky.

..and it’s a realistic 3D snail made in Blender.

I’ve thought about trying to make a snail in Blender for a long time.

I’m glad somebody finally made one! It’s very realistic, too, with excellent materials. I also like the mushroom it’s on.

My favorite part of this render is the texture on the snail’s body. It looks very realistic.

↪ Reply to this email with your own render for a chance to get featured!

Extra Tip

To spray your foam on things:

  1. Select your foam.

  2. Tab into Edit Mode.

  3. Press A then X to delete the entire curve.

  4. Enable the Curve Draw tool in the sidebar, then select Surface to make it stick to surfaces when you draw:

This allows you to draw curves in your scene—which all get converted to spray foam. Now you can draw foam on anything!

Note that you are still in Edit Mode—when you go back to object mode, the foam will look better, since you’ll be able to see the Remesh modifier at work.

Pick next week’s topic.

Reading this online? Cool but still that’s a bit strange. You know you can just subscribe and get this in your email right? You won’t have to try to remember to come here and check for new posts all the time.

Reply

or to participate.