Thinking Particles Sprites

Per-Anders Cinema 4D, Tutorials

This is a neat way to render lots of particles fast and also fake volume or light particles. It’s got a number of other uses too, but let’s start with the very basics.

What is a sprite?

A sprite is simply a 2 dimensional image. The trick with sprites is that they always face the camera, they’re always flat to the viewer like cardboard cutouts, so you can fake 3d effects with them, trees, people in scenes, volumetrics… but because they’re only 2d they render faster than the full 3d image. You will in all likely hood have seen sprites in video games, the classic one is usually trees in racing games. Of course the effect doesn’t have to be so obvious as that, it’s really up to your texturing prowess, but i’ll get you started with simply emulating visible/volumetric lights.

The sprite is a 2d plane that faces the camera

Giving the illusion of a solid object to the camera itself

Why use sprites?

Simple, less geometry=faster render times. Usually a sprite is on a single poly, this is about as little geometry as you can get! Much less at least than the artists dummy in the above images.

So how do I do this with Thinking Particles?

To start off, simply add a library TP Emitter object Object->Object Library->TP Emitter to your scene, this will create our particles for us and saves us having to make the Xpresso network to emit our sprites.Next add a Polygon Object to the scene Object->Primitive->Polygon Object (please note this is different to the Object->Polygon Object which is an empty polygon object which contains no polygon geometry at all to start off with, it appears at first glance to look like a Null Object), this is going to be our sprite surface, sprites in 3d are produced by texturing a polygon and using an alpha to mask out the shape of the object.To make sure the sprite faces the camera we should change the way it faces so with the Polygon Object selected go to the Attributes Manager and change the Orientation to -Z.
Make the Polygon Object a child of the Particle Geometry object in the TP Emitter and delete the Cube Object that’s generated by default in the TP Emitter.
Next to make the emitter emit our Polygon Object select the TP Emitter object in the Object Manager, then drag and drop the Polygon Object into the Particle Shape box in the Attributes Manager.

If we play our animation now the emitter should be emitting our Polygon Object nicely, however it’s not much use unless you’re looking directly at the emitter, we need to orientate the particles to face us at al times.

Add a new Camera Object to the scene Object->Scene->Camera. In the View port go to Cameras->Scene Cameras->Camera (or whatever you’ve called your Camera Object) to look through our new Camera in that View port.In the Object manager Select the Camera Object and add an Xpresso Tag to it (from the Object Manager menu File->New Expression->Xpresso Expression). The Xpresso workspace should open and here is where we will make the particles face the camera.
In the Xpresso workspace drag and drop our Camera Object from the Object Manager, a node should appear called Camera. Next add two more nodes that we will need to do this, firstly a PPass node Right Click on the Xpresso Workspace New Node->Thinking Particles->TP Initiator->PPass and a TP Alignment node Right Click New Node->Thinking Particles->TP Standard->TP Alignment. Now we have al the nodes we need to make our particles always be flat face on to the Camera.From the Camera Node outputs (the menu from red square in the top right hand corner of the node) add a Global Position output Coordinates->Global Position->Global Position. On the TP Alignment node add an input Axis.Select the TP Alignment node and in the Attributes Manager change the Type to User Position. This option makes particles align with and point towards a point in space defined by the Axis setting. This is how we will make the particles look at our Camera, we will do this simply by connecting the Position of our Camera Object in the world (the Global Position) to the Axis value, this way the particles will always face our Camera Object, and wherever our camera looks the particles will appear flat on (unless we get really close up where the illusion can loose it’s effectiveness as the particles try to rotate around the camera).

To do this drag a connecting line between the dot on the Global Position output of the Camera node and dot on the Axis input on the TP Alignment Node. Now the particles have the camera’s position to point towards, however we’re not there yet, we still need to tell the TP Alignment node which particles are going to face the Camera, so to do that drag a line from the output of the PPass node to the Particle input of the TP Alignment node. Now we’re all connected. The particles wont align till we press play, So close the Xpresso Workspace and hit the Play Button and try moving the camera around a bit, rotate it around the TP Emitter object to see the particles face the Camera Object at all times.

Useful?

How do we make this useful? Well here’s a simple example say we want to make it look like we’re emitting lots of visible lights into the scene. Visible lights are slow to render, Sprites are much faster. So here’s what we would do.

Make a new Material, and change the settings, first off switch off the Color Channel, and switch on the Luminosity Channel Make a nice color that we want our lights to be (HINT : if you want to give the effect of really bright lights make the basic color as you would with the light then bring the brightness up to over 100% till the color is the brightest color that you want your “lights” to have at any point). Next switch off the Specular channel and switch on the Alpha channel. In here add either a BhodiNUT Gradient or a standard Gradient, edit this and change the settings to 2D Circular type and make it so that it’s white in the middle and black at the edges, this will give the look of a circular falloff from the “light”

Now apply this material to the Polygon Object (our sprite), now it will render out looking for all the world like a visible light.

Preparing to render

Then before we render this go to the Render Settings dialog box and under the Options page change the Ray Depth to 50 (the maximum) this will make sure we shouldn’t get any artifacts when rendering (though it will slow the render down a little bit). Now seeing as the type of thing we’re rendering is already rounded and soft there’s no need to have any anitaliasing on so go to the Antialiasing page of the Render Settings dialog box and switch Antialiasing type to None. Next allow the animation to play a little so you have a few sprites and render. It should look like you’re emitting visible lights.

Other things you can try are putting in images in the Alpha channel of the material you apply to the “sprite” this is the channel that creates the cutout. Just make black and white images with white where you want the sprite to be solid and black where you want the sprite to be transparent or “cut out”.In this example the camera fly’s around an emitter emitting sprite snowflakes using this method.

Click to play movie (200k Quicktime)

Another thing you can try is using a BhodiNUT Fusion in the Alpha channel. Then put the gradient in the top channel and a BhodiNUT 3D Noise in the bottom channel, set the blending mode to Multiply and edit the BhodiNUT 3D Noise however you want, try using World as the texture Space to get the particles to move through a texture, different texture space options create different effects so play around. This is a good way to emulate some simple volumetric effects as the particles will move through a 3d texture showing their “slice” of that texture for each and every frame, you can create some wonderful effects this way. Check my upcoming tutorial on faking volumetrics for more hints and tips with this sort of effect.

Download the source file for this image here (zip) .

Here’s another playing around this time with animating the parameters on the noise and the Polygon Object to create a smokey emitter.

Download the cinema 4d file here (zip). Or click the image or here to play the movie (177k quicktime).

Hopefully by now you should realise the power and usefulness of sprites in 3d.