Stratus3D

Software Engineering, Web Development and 3D Design

Autotracing Is Not for Every Image

Autotracers are great time-saving tools that can save you hours of monotonous hand tracing, but they are often misused. In this tutorial we will look at two real world autotracing examples using Inkscapes built-in autotracer (also known as a bitmap tracer). Our goal in all of these examples is to create a clean black and white vector. You will see that autotracers are very limited in what they can do.

Tracing Basics

Before we start looking at examples let’s first get familiar with Inkscapes autotracer. Open up Inkscape, click on the “Path” menu and select “Trace Bitmap”.A sidebar will appear on the right. On the right of the dialog there is a preview window, if you select a bitmap and click the Preview button it will show a preview of what the tracing will look like. This is very useful when you are tracing complicated images that take along time to trace.

On the left there are different tracing methods, the top three create only a single path. There are several different ways of tracing a bitmap. The first option, Brightness Cutoff, works similar to GIMP’s Threshold tool. It creates only one a black path of the areas of the image that are darker than the threshold value. By adjusting the Threshold value you can control what is considered black and what is not. The second tool is Edge Detection. This tool uses an algorithm to determine what parts of the image are edges and what are not. If part of the image is considered an edge it becomes part of the black path. By adjusting the threshold value you can control what is considered an edge and what is not. Higher value mean less of the image is consider an edge. The third option is Color Quantization this option creates adds a path where the colors in the image change. By adjusting the the Color value you control how many different colors the image should be considered. The bigger the color value the more outlines it creates.

The next three options create multiple paths. The first method for creating multiple paths is Brightness Steps. This divides the image into different increments of brightness and covers each one with a path of the appropriate brightness. The next option is Colors, this option creates a path for each area color. The third option is Grays, this option divides the image into different increments of brightness and covers each one with a path of the appropriate color, this option works very similar to the Brightness Steps. By adjusting the amount of scans you control the how many increments of brightness there are.

There are several more miscellaneous options for tracing. There is the Smooth option that smooths the curves after being traced. The Stack Scans options stacks the brightest paths over the darker ones, as opposed to cutting out the darker paths. The Remove Background option removes the lowest, or darkest, scan from the tracing. The Invert image checkbox inverts the image before being traced, I bet your glad I explained that one!

Now if you click on the Options tab on the top you will see three more options. Suppress Speckles, this option suppresses speckles in the bitmap by ignoring small details in the tracing. The bigger the Size value the smoother the tracing (and the less detail). The second option is Smooth Corners, this option smooths the sharp corners of the path. A higher threshold means smoother corners. The last option is Optimize Paths, this option uses an algorithm to create the paths with the least amount of nodes necessary, i.e. cleaner paths. Always leave this option on if you are not going to manually edit the path later.

There are no perfect settings. Each image you trace will need slightly different settings based on the quality and type of image.

Tracing a Photograph

Mouse on desk

Here we have a relatively high contrast image with fairly clean lines. Our goal is to make a black and white tracing of the mouse and cord. It seems like Autotracing is the way to go. So lets autotrace this image and see what happens. Import the image into to Inkscape and click on the path menu and select “Trace Bitmap”(Note: the image being traced is a higher resolution than the one you see above). Select the image and click the preview button in the Autotrace dialog. I chose Brightness Cutoff as scanning method. Adjust the threshold value up or down if necessary and click the preview button to see the results. Once you have got it the way you want it click ok. Then delete the image. Now let’s zoom in and inspect the path. Zooming in to where the button on the mouse meets the front of the mouse we see a weird outline. Not only does this not look correct it also is impossible to edit.

Mouse tracing Nodes on Path

A path should have relatively few control points and be fairly simple. Lets view the control points or nodes as they are called in Inkscape. Click on the edit tool and then select the path to see the nodes. There are so many nodes the path impossible see, let alone edit!

Conclusion

This image cannot be traced correctly by the autotracer. This is a relatively simple image that will only take a few minutes to manual trace. If you tried to clean up the autotraced path you would spend more time cleaning up the path than you would just tracing it manually, and you would end up with a poorly traced path. Manually trace this image.

Tracing a 3D Image

Birdie

A 3D image like this one is not a whole lot different than a photograph. The only major difference is there is less noise and the image is a lower resolution. Due to the low amount of contrast in this image we will not be able to use Brightness Cutoff, in fact we will not be able to use any of the single path tracing options. I found that for this image that the Colors and Grays options worked the best. Of course our goal was to create a black and white vector image, so I had to do a little manual editing of the paths to make them black and white.

Badminton Path

Now lets zoom in and inspect the path. The path is fairly accurate and has a good amount of detail, there are no funny outlines like we saw in the photograph and the outline is easy to recognize. Now let’s select the edit tool and click on the path. The path is covered in nodes and is way too cluttered. It is nearly impossible to edit and is not much better than the tracing of the photograph.

Path Nodes

Conclusion

The best way to trace this image would be to do it manually, but with all the detail it would take hours. You would probably be better off if you just spent an hour or so cleaning up the autotrace manually. Either way you could not use the autotrace alone.

The Best Way to approach Tracing

I feel that the best way to approch tracing an image is to first try autotracing (or just previewing it if you have detailed image) with all the different different tracing methods. If you find one that gives fairly acceptable results go with autotracing and do a little cleaning up of the nodes manually. If you find no acceptable tracing method, manually trace the image yourself. What ever method you choose always check the path for excess nodes and do editing if necessary.** Manually tracing always produces better results.** Do it if you can afford to spend a couple hours tracing!

Faking Volumetrics With Blender

Smokestack

This tutorial video is 26 minutes long.

This tutorial will teach you how to make particles appear volumetric and create semi-realistic clouds and smoke with Blender 2.49

without using volumetrics. You might wonder what good fake volumetrics are when you could just use real volumetrics with Blender 2.5. Well, there are several advantages. First, fake volumetric are faster because there is no “volume precache” and second, they cast shadows from shadow buffer lamps onto other particles and strands.

So let’s get our scene setup.

There’s nothing solid but a red and white smokestack. Add a cylinder and a delete the center end vertices. Then scale up along the Z axis to about 4. Next select all the verts and extrude them and right click, leaving them in the same position. Then use the shrink/fatten tool (Alt-S) to give the edge of the smokestack some thickness. Next deselect all, then select all the verts on the bottom and scale them out to about 1.2. Now go back to object mode and move the smokestack to the right. Then in the editing buttons select “Set Smooth” and then click on “Add Modifier” and select “Edge Split”. Now the smokestack material, leave all the shader settings the way the are but change reflection to 1.00, and the specularity to 1.00. For the textures add a node texture in the first slot, leave it as the default red and white checkerboard pattern. Now set the mapping parameters as shown below.

material buttons

Add a blend texture in the second slot and click flip “XY” button, set the colorband as shown.

blend_parameters

Set the parameters as shown. This texture will make the top rim of the smokestack look dirtier than the rest of the smokestack.

Smokestack texture

Now the lighting. This scene only has two lamps, the first is a hemi lamp. Add the hemi lamp anywhere in the scene and point it straight down, then rotate it on the y-axis -40 degrees. Set energy to 0.3 and the color to light grayish-blue color. The second light will be a spot light positioned down and at angle opposite to hemi lamp. Set the parameters to energy = 1.5, color = h 0.18 s 0.12 v 1.0, falloff = constant. Set the shadow parameters to shadow buffer, classical, with a size of 60.0, softness of 0.15, and with a buffer size of 3872. Spot parameters

Next let’s set all the world parameters. The sky is nothing but a blue background, I chose #80ACDC as the color of the sky. Go to the Ambient Occlusion tab and turn the AO on. Set the sampling to approximate and the energy 0.3.

Now comes the fun part - the smoke. Place the 3d cursor directly above the center of the smokestack and add a Icosphere. The scale down to 0.5 and add a subsurf modifier. Go to Object<Particles and add a new particle system. Set all the parameters as shown. particle params

Then go to materials and add a material to the sphere and set the setting as show below.

particle material Now that we have the particles set up you can press the bake button. As you can see the smoke stays close together as it goes up. This is not the way real smoke behaves, real smoke spreads out and gets thinner as it goes up. We will add a lattice and apply it to the particles, then stretch the top out to make the particles spread out. So add a lattice in the same spot as the particle sphere them set the UV parameters to U = 5 V = 5 W = 20. Then using proportional editing shape the mesh into a funnel like shape. Like this.

Lattice Shape Then rotate the lattice and and position the bottom of the funnel over the sphere, as shown. Now select the sphere and add a Lattice modifier to it. Enter the name of your lattice in the Lattice field.

Now we need a bit of wind to make the smoke move randomly, so add a Empty and go to Object<Physics click on the field type drop down menu and select wind. Set the noise to .2 and set the energy to 0.9. Then press “I” and select “Force Strength” then open up a IPO curve window. Use the up key to advance 200 frames ahead, then change the force -.02, move your mouse over buttons window and press “I” again and again select “Force Strength”. Repeat this several times to create a nice random force strength curve. Rotate the Empty so the wind blows horizontal.

Now everything is done except one thing - the shadows. The whole point of this tutorial is to make the particles look like they have volume. Right now if you render a picture you will see they look completely flat. So we need something to cast shadows.  We will use a triangle billboards. We will start one billboard and add particle instance modifier to duplicate the billboard to each particle.

So position the 3d cursor to the at the center and add a plane. Select two verts and Press Alt-M and select “Merge at Center”. Back in edit mode add a Empty in the same position as the plane. Now select the Empty and, holding shift, select the plane and enter edit mode. Select all the verts and and press Ctrl-H and select “Add, to Selected Object”. Now the modifiers. You’ll see the first modifier is the hook modifier we just added. Click the Add Modifier button and select “Particle Instance” from the menu, then enter the name of the particle emitting sphere in the Object field. Next we will add a Lattice modifier so the billboards will be effected by the Lattice like the particles are.  Now we need to make the billboards point to the light. Select the empty and go to object menu and click “Add Constraint” and select “Copy Rotation” set the parameters as shown. Empty constraint Scene Setup

If you render now you will have nice shadows, but one problem, the billboards show up. There is a simple way to fix this, go to the billboards material buttons and click on “Ztransp” and “OnlyCast”. And that’s it! you now have ordinary particles that look like volumetric smoke! Smokestack