SMAK User Manual

Version 2.0

Getting Started

SMAK is designed as a small, light tool that does an array of utility functions to assist 3D artists.

Loading a model

To load a model, choose Open from the File menu. As of SMAK 2.0, SMAK supports any format listed here and also Silo .sia files. If you associate a file type with SMAK, then it can be opened by double-clicking the file. Files can also be opened by dragging them onto the SMAK icon on your desktop. If changes have been made in an external application, you can use the "Reload" feature at any time to load the model again from the hard drive. As of 1.6, the "Open Into..." feature can open a model into the current scene without closing the current model. SMAK is optimized to load very large models, with 1 million + polygons.

Saving a model

Since beta 1.7

To save a model, choose "Save..." from the File menu, enter a file name and select a save format. SMAK supports saving files in the .obj, Silo .sia, and Collada .dae formats.

3D Preview Screen

After loading a model it should be visible in the 3D preview screen. You can always switch to the 3D screen by pressing the "3D" button at the top of the viewing window. This screen allows you to preview your model in a variety of different ways. The camera can be rotated with the left mouse button, and can move in and away from the model with the right mouse button. If the hardware light is enabled, it can be moved around by holding down the ctrl key and dragging the left mouse button.

The wireframe button controls the way polygons are rendered. Pressing it will enable wireframe rendering, useful for seeing individual geometry pieces.

The rendering buttons control the shading and textures of your meshes. The lighting toggle button turns on and off the hardware light. Without the light, everything is rendered fully bright, and with the light, polygons facing away from the light are shaded darker. The texture toggle button turns on and off rendering of your model's texture, should it have one. As of beta 1.6 there is a normal map button which controls whether or not the normal map is used, if present. The next buttons are the AO map toggle button and the color AO map toggle button, which enable generating of ambient occlusion maps, these are explained in their own section.

UV Preview Screen

Pressing the "UV" button at the top of the viewing window will switch to the UV space viewing mode. This allows you to see how each polygon is laid out onto its texture. The UV can be moved around with the left mouse button and zoomed in and out with the right mouse button. Selecting the wireframe button in this mode will toggle an overlay of the triangles in your model on top of the UV.

Scene Tree

Since beta 1.4

Any time a model is loaded, its components can be seen in the Scene Tree. The Scene Tree can be moved anywhere or collapsed by pressing its red collapse button. Each node in the scene can also be collapsed or expanded to view or hide its children. The scene is arranged into categories: Materials, Meshes, and Scenes. All materials from the source file's material library are shown under the "Materials" node, and clicking the visibility button can toggle the display of any object using that material on and off. The "Meshes" node holds a library of what meshes are available to be rendered. This mesh library is not what is rendered, but is rather a library of meshes that can be used for rendering by the scene. The "Scenes" node contains a list of child nodes which are what is actually rendered. Each node may contain a mesh instance, which is a reference to an object in the mesh library, complete with a list of materials that the mesh instance uses. The visibility button for the mesh instance materials allow each material to be toggled on and off independently for each mesh. As of 1.6, materials also have a Material Editor button which brings up the material editor.

Not all file formats come with complete support for the scene tree. While full-featured formats like Collada support the scene tree, most file formats simply store materials and meshes and omit the scene tree. In the case of file formats which do not contain a scene tree, each mesh is assigned its own child node in the scene and a mesh instance is automatically created for it. At the same time, SMAK does not support all of the features that some of the more sophisticated file formats have, so it may load a number of empty scene nodes intended for things like cameras and lights that SMAK handles separately.

Using The Combo Map Generator

Since beta 1.6

The "Combo Map Generator" is a special panel that bakes the details from high-resolution meshes onto lower-resolution meshes, suitable for deployment in a realtime 3d rendering engine. The Combo map generator can produce normal maps, ambient occlusion maps, and diffuse maps all in one pass. The high resolution mesh is not required to have UV coordinates or normal data to be used to generate ambient occlusion or normal maps, but must have UV data to bake diffuse maps.

Note: During the SMAK beta (up until SMAK beta 1.8) the normal map generation window handled both hi->lo res baking and texture->normal map generation. As of version 1.0 these have been separated into different windows.

A normal map is a special map which contains data about the normal (the angle of the surface) at each point on the surface of an object. Realtime 3d rendering engines use this data to modify how light on the surface of an object is rendered, which can give an object the appearace of having much more detail than the polygons alone provide. To generate a normal map, your model must first have either a texture or a high-resolution mesh which topologically matches the low-resolution mesh. This can be done in an external modeling studio, or texture creation software such as Photoshop or the GIMP. Problems can occur with the normal map if polygons are overlapping one another in the UV, so make sure that only one polygon is occupying any of the UV space.

Once your model is set up, the open the "Combo Map Generator" by selecting "Generate all maps" from the Tools menu. The "Combo map generator" dialog has a Size selector at the top that specifies the size of the generated output maps. It then has a panel for Low Resolution Meshes and a panel for High Resolution Meshes.

In order to generate your maps from a high resolution mesh, first add your low and high res meshes to each panel. Press the "Add" button and click on the appropriate mesh to add it to the tree. You can also drag and drop a mesh instance from the scene tree. A mesh instance is any node in the "Scenes" category that has the wireframe box icon beside it. To remove a mesh, select it and press the "Remove" button. Then, press the "Generate" button.

Using The Texture To Normal Map Converter

Note: During the SMAK beta (up until SMAK beta 1.8) the normal map generation window handled both hi->lo res baking and texture->normal map generation. As of version 1.0 the se have been separated into different windows.

SMAK can be used to convert a texture to a normal map using the "Normal map generator." To do this, open the Tools menu and select "Generator normal from texture." Then choose the material that you wish to use to generate the normal map by clicking it in the list. You must use a material with an associated texture. Once you select your material, SMAK will begin to pre-calculate the data which will speed up the normal map generation. Once it's complete, you can control the texture generation using the depth sliders. These sliders control how many details from each frequency band are allowed to pass from the texture into the resulting normal map.

The "Overall Depth" slider is a master "volume control" for the input texture. Turning this to 0% will remove the normal map completely. Each frequency depth slider then controls details from an individual frequency band. The "Texture Hi-Freq Depth" slider uses only adjacent texels to produce normal values, "Texture Mid-Freq Depth" can produce bumps up to 10 texels wide, and "Texture Low-Freq Depth" can produce bumps up to 20 texels wide, depending on the input.

Once the normal maps have been generated, SMAK will automatically combine the mesh-generated normal map with the texture-generated normal map into one seamless map, which can be saved to the disk by pressing the Save Map button.

Generating an Ambient Occlusion Map

In order to generate an ambient occlusion map, your model must first have a proper UV map created for it. This can be done with an external modeling studio. An example UV unwrap is shown at right. Problems can occur with the AO map if polygons are overlapping one another, so make sure that only one polygon is occupying any of the UV space. As of version Beta 1.4, enabling and disabling visibility of materials in the Scene Tree with the visibility buttons will affect how they are generated in SMAK. Disabling the rendering of a material will cause the AO generator not to generate AO values for that material. However, the geometry from that material will still occlude other geometry in the scene, as if it were still visible. This is useful for generating different parts of a model separately, but still retaining the occlusion of each part of the model on the other parts. In versions prior to Beta 1.4, problems could also be created by concave polygons, but as of Beta 1.4 this is no longer an issue.

Once you have your model ready to go, the Ambient Occlusion panel can be opened by clicking the AO button at the bottom of the window, by selecting "Generate AO Map" from the Tools menu or by simply pressing the 'A' key on your keyboard. Every AO method has two options in common, the Size selector and the Bleed selector. The Size selector chooses what size the resultant AO map texture image should be. In general, larger AO maps take longer to generate, but look better when applied to the model. The Bleed selector determines how much extra space is applied to the outer edges of each polygon after the AO generation is complete. The nearest color is used to pad the AO map in a kind of "flooding" pattern around all of the polygons in UV space.

Version beta 1.4 comes with a slew of new options. Every generator now has a new option, the Crease edges option, which causes the shading algorithm to pretend that all edges of the model are creased, or that all faces of the model are in a separate smoothing group. This causes all of the edges of the model to have sharp transitions in the resulting AO map, and can be handy for working with meshes that have not had smoothing groups set for them.

Shadow Mapping Method

Shadow Mapping is the fastest AO generation method. 1024x1024 AO maps can be generated in less than a minute due to hardware acceleration. The graphics accelerator on your computer is used to render an array of lights in a sphere around the object, adding up all of the shadows created by each exposure. The more lights in a scene, the higher quality AO map results. Consequently, while larger sizes of AO map are slightly more expensive to generate, the number of lights in the scene is the main determinant of how long it takes to generate an AO map.

Version beta 1.4 comes with a option. The Ground occlusion feature forces all exposures below a certain angle to be completely black, simulating the effect of the mesh sitting on the ground. This causes the parts of the model which face down to be shaded darker.

Raytracing Method

Raytracing is a computing-intensive method of generating AO maps. For each texel of the resulting image, rays are emitted in all directions, to see if there is geometry in that direction. The results of all the rays are averaged for that texel. Raytracing is a very accurate method of AO maps, but its generation is very slow. Making larger maps becomes very intensive. There is one option in this method, Ray Density, which will increase the quality of the generated map at the expense of some additional generating time.

Version beta 1.4 comes with new options. The Ray Falloff option controls how strong the occlusion of distant geometry is. Lower values cause higher falloff rates, meaning that only closeby geometry causes darker areas in the resulting AO map. Higher values allow more distant geometry to occlude. The falloff is exponential, and the value determines the distance at which the falloff is at 50%. It can also be set to "No falloff" which disables falloff entirely. The Randomize rays checkbox causes a slight random variation of each ray, resulting in a more grainy look to the AO map. Lower values of Ray Density will cause the graininess to increase. The Ground occlusion feature forces all exposures below a certain angle to be completely black, simulating the effect of the mesh sitting on the ground. This causes the parts of the model which face down to be shaded darker. Ground occlusion is subject to ray falloff, so if the effects of ground occlusion are not visible in raytrace mode, increasing the ray falloff may help.

Best Practices and Tips

The best options for any particular AO map greatly depends on what kind of model is being generated. Some simple guidelines can be used to ensure the best possible quality output.

» Large surfaces with sharp angles at their edges should always have those edges creased. Since AO generation uses the normals from the model data, these edges will be "smoothed" over in a way that is usually undesireable. The "Crease edges" option may help if there are no other areas in the scene that require more smooth edges.

» For internal scenes with inward-facing polygons, the raytracer is best suited. It ray falloff must be set to something lower, to prevent dark result maps.

» When using the raytracer, larger models tend to look better with higher values of ray falloff.

» The "Randomize rays" feature can result in gritty-looking maps, and can be used to great effect to create a dirty look. It also serves to ameliorate the problem of lines appearing in an AO map next to walls and poles due to ray inaccuracies. Lower values of ray density will cause much rougher looking result maps, which higher values and higher resolutions reducing the gritty look.

» Ground occlusion is best used for objects which will always be situated on the ground, or over dark bottomless pits.

Generating a Cavity Map

Cavity maps are generated from normal maps, so first you must have a normal map generated, either by the texture-to-normal method or by the Combo Map generator. If you use both then the normal maps are automatically combined, then the cavity map generator will use the combined result to generate the cavity map. Open the cavity map generator by selecting "Generate cavity from normal" from the Tools menu. Then select a material which has normal maps and click "Generate" and the cavity map will be generated and automatically applied to your model. You can save the map to your hard disk by pressing the "Save" button. Cavity maps should be applied using the "Overlay" layer blending mode in Photoshop or The GIMP.

"SMAK a Batch" Processing

Since beta 1.4

SMAK allows for the execution of its functions on the command line. This allows for automating of tasks and greater control over parameters. The same binary that is used for the graphical user interface version of SMAK is also used for the command line version, smak.exe which can be found in the installation directory. This defaults to "C:\Program Files\SMAK" on a standard Windows machine. To run SMAK on the command line, it must be run in its installation directory, so that its current working directory is the same directory where it was installed.

Ambient Occlusion Generation Options

The arguments for generating an AO map are:

C:\Program Files\SMAK\>smak.exe <input-file> --command ao [--method <shadowmap|raytrace>] [--output <filename>] [--size <64-2048>] [--bleed <0-10>] [--lights <500-3000>] [--samples <5-25>] [--falloff <#>] [--randomize] [--crease] [--groundocclusion]

[Square brackets] mean an optional parameter and <Angle brackets> mean a required parameter that needs to be replaced with the proper value. Explanations of all of the parameters is below. Full descriptions of what they do can be found in the section "Generating an Ambient Occlusion Map" in this manual.

<input-file> specifies the file name of the file that SMAK should operate on. Must be either .obj .sia or .dae

--command specifies the job that SMAK should be doing. Currently the only option is "ao" to generate ambient occlusion maps.

--method specifies the method by which the AO generation will occur. The default is "shadowmap"

--output specifies the file name of the output image. Must be either .png .jpg .bmp .tga or .psd

--size specifies the size of the output image file. Larger maps take longer to generate. Values from 64 to 2048 are allowed. The default is 1024.

--bleed specifies the about of bleed the result AO map should be given. Values from 0 to 10 are allowed. The default is 1.

--lights specifies the number of lights that the shadow map method should use. Values from 500 to 3000 are allowed. This parameter only has an effect with the "shadowmap" generator. The default is 3000.

--samples specifies the number of samples that the raytrace method should use. Values from 5 to 25 are allowed. This parameter only has an effect with the "raytrace" generator. The default is 20.

--falloff specifies the amount of ray falloff that the raytrace method should use. Any positive value above .0001 is allowed, and to disable falloff use "none". This parameter only has an effect with the "raytrace" generator. The default is 1.

--randomize instructs the raytracer to add random variations to the rays. This parameter only has an effect with the "raytrace" generator.

--crease instructs the AO generator to pretend all edges are creased.

--groundocclusion instructs the AO generator to pretend a ground exists below the object during AO generation. This parameter only has an effect with the "raytrace" and "shadowmap" generators.

Examples follow:

C:\Program Files\SMAK\>smak.exe model.obj --command ao --method shadowmap --output model-ao.png --size 512

C:\Program Files\SMAK\>smak.exe model.dae --command ao --method raytrace --output model-ao.jpg --size 1024 --samples 25 --falloff 10 --randomize --crease