DarkTree Textures from Darkling Simulations is one of those hidden gems of the graphics world that has permanently changed the way that I create art for games. Using a sublime blend of art and mathematics, DarkTree Textures allows you to create images and animations that would be virtually impossible to create by hand. I commonly use DarkTree textures to create special effects like flames and smoke. This tutorial will introduce you to the power of DarkTree by showing you how to create a simple but effective explosion animation.

DarkTree can be a rather challenging application to get started with. Many of the samples that it comes with are quite complicated, and it’s not always obvious how the creators achieved the effects that they’ve created. However, once you wrap your mind around the basics of how DarkTree works, experimentation is quite intuitive and you’ll be creating rewarding results in no time.

The Basics: Components and Links

Each project you create in DarkTree consists of components chained together by links. A component is essentially a “black box” that takes multiple inputs and generates an output. The output can either be a volumetric color image, a volumetric field of grayscale values, a volumetric field of bump map values, or a function.

Color, Percent, Bump, and Function components

The output of a component is determined by its inputs. By right-clicking on a component, you can see what input it takes.

The inputs of the Ether component

Green dots represent a color input, blue dots represent a bump input, gray dots represent a single value or percent input, and gray dots with a curve icon represent function inputs. Right now the two color inputs of the Ether component, “low” and “high” are not linked and therefore are the solid colors red and yellow. Let’s link the “low” input to the output of another color component.

Linking the “low” color of the Ether component to a checkerboard component

The reds have now been replaced by the checkerboard, but the yellows have stayed the same, since we didn’t link them. It is this composition of components through linking that will allow you to create sophisticated textures and effects in DarkTree.

Choosing a Base Component

I think the simplest approach to creating an effect in DarkTree is to choose a base component, and then tweak it with other components until it looks the way you want. Since an explosion is a cloud of hot gasses, it seems natural to start with the “clouds” component. Using the menu on the left, choose Natural->Clouds and drag the component somewhere onto the middle of your workspace as a Percent component. We’re using a percent component because we’re going to recolor it later using a gradient mask.

A default Clouds component

You can double click a component to change its attributes. Double click the Clouds component and change it to these settings. There’s no magic here—I just fiddled with the values until they looked right.

Adjusting the attributes of the Clouds component

Shaping the Effect

The Clouds effect gives us a nice looking field of puff shapes. Now let’s give it a round shape so that it looks like a fireball. We’ll do this by modulating the “Puff Size” input of the Clouds with a circular gradient. The inside of the gradient will be a middle gray, giving us a medium puff size in the middle of the effect. This will fade to black on the outside, making a puff size of zero, or in this case, no visible puffs.

Create a new Gradient->Absolute Shells component to the right of your clouds as a Percentage componenet. Then double click the Absolute Shells component and change it to have the following parameters.

Values for the Absolute Shells

Now right click on the ridged area of the Clouds component, and choose “Puff Size” from the menu. Then click on the output (the little gray dot). This will link the Puff Size input of the clouds to the Absolute Shells gradient component.

Clouds linked to Absolute Shells

Presto! Now the explosion is taking on the shape of a fireball.

Animating the Fireball

Now comes the trickiest part. In order to change the size of the fireball over time, we are going to connect the Shell Position inputs of our Absolute Shells gradient to function curves that are controlled by a time-based input. We are going to modulate the inner and outer radius of the gradient to grow and shrink over time, and also modulate the center color of the gradient itself. Each of these modulations will be adjusted with an editable Spline curve.

Create three Generator->Spline components to the left of your Absolute Shells. Then Create an External->Time component to the left of those.

Preparing for animation

Connect each of the Splines’ “Input” inputs to the output of the Time component. Then connect the Shell Position 1, Shell Position 2, and Shell Value 1 inputs of the Absolute Shells to the outputs of each of the three Spline components. At this point, your tree should look something like this:

Links for animation

Now comes the trickiest part. We’re going to shape each of the Splines so that the explosion grows and shrinks over time. We want the outer radius to always be a little bigger than the inner radius, and we want to overall puff size to increase and then fade out.

Here’s what I came up with. Double click each Spline to edit it, and try to match mine as best you can. In my tree, the input for Shell Position 1 on top, Shell Position 2 in the middle, and Shell Value 1 on bottom.

Animation Splines

If you’ve set everything up correctly, you should see… well, nothing! In frame zero the explosion is invisible. To preview what you’ve done, right click on the image of the Clouds component and select “Examine->Diffuse Level” This will allow you to play back your animation. You should have an expanding cloud shape.

Animated clouds

Note that you can also use the “properties” tab of the left-hand menu to change the “current frame” of the tree to something other than 0. This will change all the components’ preview images to another frame so it’s easier to assess your work.

Navigating 3D Texture Space

Our animation is looking great but let’s do one more thing to make it even more dynamic. Every component in DarkTree textures actually produces a 3D output. You just see one slice of the output at a time. By sliding along the z-axis over time, a noise component will appear to morph and change shade.

Create a new Transform->Translate component to the right of your Clouds. Hook the “Percent Moved” input of the Translate component to the output of the Time component that you already made. Then connect the Background input to the output of the Clouds component. Edit the Translate component so X-Amount and Y-Amount are 0.0, and Z-Amount is something like 0.5.

If you preview the animation now, you’ll see that the puffs of clouds are more dynamic and lifelike.

Coloring the Explosion

We’re done with the construction of the animation. Now all that’s left is to color it using a gradient map. Drag a Gradient->Gradient Mask component into the Root slow of your tree. Connect its Mask input to the output of your translate component. Then edit the Gradient Mask so its parameters look something like this:

Parameters for the Gradient Map

The complete DarkTree should look like this:

Complete Explosion DarkTree

Preview the animation and you’ll be pleasantly surprised. It’s very convincing and only took a few minutes to put together.

Rendering the Animation

Now that your effect is complete, let’s render it to a sequence of bitmaps, which could be put into a game. Right click the root component (Gradient Mask) and choose “Send to Bitmap Renderer.” This opens DarkTree’s export utility.

DarkTree’s Bitmap Renderer

The interface here is straightforward. You can choose filename, size, anti-aliasing options, etc. Export your frames to a movie or series of images and bask in the glow of your new animation!

DarkTree Textures is one of the most versatile and elegant tools I’ve ever used. I’ve used in every game I’ve ever work on for the last several years, and I still continue to discover new techniques for creating cool textures and effects.

Each of the DarkTree components has an excellent help page that will help you understand its intricacies. Now that you have a basic understanding of how the program works, I’d also recommend looking through the excellent examples that the program comes with. They do some wild and wacky things that I’m sure will give you new ideas!

I know I sound like a broken record, but I really think that DarkTree Textures is a wonderful program that pros and novices alike can benefit from. Give it a try!

You can download the source file for this tutorial here: explosion.dstc