|Tutorial - Amapi 4.1.5 Material Editor|
Best Viewed at 1024 x 768 or similar resolutions.
In this tutorial,we'll open an existing file containing a soda can's geometry. We'll then apply various materials such us 2D or 3D procedural textures for wood, marble, grid, random colors etc... mapped to color, bump or transparency. We'll also use images as 2D texture maps for decals.
Let's start Amapi 4.1.5 and open the file called 'newcan2.zip' (Amapi file inside Zip archive). For that, you can simply select the
File > Open...
option in the Amapi menubar. The soda can appears in your view like this (assuming basic wireframe display mode and using the original Workshop interface):
You'll notice that the shapes of the various components on the can appear to be very rough, i.e. there are only a few polygons making up the sides of the can. Amapi is just showing you the original coarse mesh. We have already applied Smoothing to the parts, but Amapi 4.1 does that in a 'cached' way, which means it will be used during rendering (or upon exporting) but not necessarily during modeling for the time being.
If you hit ENTER you will see the smoother appearance upon rendering:
If you wonder how these surfaces were built, you can use the 'Show' tool (white ghost in center-right of control panel at bottom of window) to click on and view the hidden construction curves.
The initial view is from the side (because that's what it was when we saved the file. Use the Arrow keys on the keyboard to orbit the camera around the scene. Hit '2' on the numeric keypad to get the front view.
The Material Editor
We'll want to explore all features the material editor has to offer, so let's not use the default 'simplified' material editor mode. Instead, we'll want to select the 'Extended Editor' mode. For that, select the
Render > Render Settings...
option from the menu. You will see a popup window with various
parameters which control how in general the rendering is done.
for rendering can be different from the one used by default, which is
the Amapi view (workshop view), if
you had one or more cameras in the scene.
The number of passes for anti-aliasing quality is best left to zero initially. Use the 1 or more passes only for final rendering if you have a fast machine and enough time.
If you have spot lights in the scene that cast shadows, you can overide it here and disable shadow casting. This is useful to do quick previews without all shadow casting calculations.
Click the black 'Background color' bar and select a white background instead.
If you want you can designate an image to be used for the background - during rendering. (note that another image can be used for modeling, e.g. tracing from templates, look in the Workspace Preferences if you need this.)
There is a section for the Material editor with 4 check boxes. Be sure to enable the 'Extended Editor'. If you have an average to fast system, also select the 'Geometric Smoothing'. Enabling this option means that during rendering in the material editor's preview area, any cached (geometric) smoothing will be applied. On slow systems this may be too time-consuming. If you leave this option disabled, then a coarse sphere which had smoothing applied to it will still show a coarse set (low number) of polygons in the preview window.
At the bottom, you'll see the size options for 'Render File', which is the command used to do a rendering into an image file (Jpeg, Tiff, Targa,...). You can set the Width and the Height (in pixels) of the image to be rendered. When you later use the 'Render File...' command, Amapi will use these dimensions for rendering into an image buffer; at the end of the rendering you'll be able to specify the filename and folder in which to save it.
The Defocus Dei support checkbox optionally
enables saving the Zbuffer information (depth buffer) into a .dei file,
by Defocus Dei, a program from Blackfeet which allows
for postprocessing of the image and adding field-of-depth blurr. If you
leave this box enabled, a second file ending in .dei (and with same
filename as the saved image file) will be generated.
Click Ok to finish.
Bottom of Can
Click '0' and '2' for front view, then use the down arrow key to view the can from a little bit more down below. Select the bottom of the can (not the side walls of it, but the inward bent (curved) surface at the bottom of it. Select it simply by clicking it with the left mouse button. If you look from under the can as shown below, you should have a clear look at that bottom of the can, which for the purpose of this exercise was created as a separate part.
Note that the workshop table (workbench) and the groundfloor grid are still visible. If you don't like that, use the dark ghost (hide tool) to select them for hiding away.
Click the Shader icon on the control panel. It is the 'Picasso' painting palette at the lower right, second icon from right.
You can also get to it from the Render menu:
Render > Shader... (Ctrl-L)
This will open the material editor on the current part (bottom of can) and render a preview of it in the preview area at the center.
Note that there are fewer sliders and options shown if you use the
default 'Simplified' mode in the material
editor options. Be sure to use the 'Extended Editor' as shown
Just above the preview area, you'll see the catalog, showing materials in the Materials tab.
The current folder of that set of materials is showm next to the materials tab. In the example above we're looking at
D:\Amapi 3D 4.1\SAMPLES\MATERIALS
but there are no materials in there so the placeholders (black boxes) are all empty. If we were looking at existing Amapi materials, we would see them there and we could simply drag-and-drop them from a placeholder into the preview window to apply it that way to the object.
To the right of that folder location you'll see three more icons, which let quickly navigate to different bookmarked folders, or change folders, etc...
For instance, clicking on the first icon from the left
(Bookmarks), you can add the current folder location to your Amapi
materials bookmarks. You can then easily switch between that and other
bookmarked locations. The
middle icon, which looks like a folder, pops up as a menu with several
One of these options is to switch (change) to another directory (i.e.
Basic Material Properties
To the left of the preview area, you'll see a bunch of basic buttons to rename and save the material. You'll also notice a button 'Create a style', which let's you switch to a cartoon-style rendering mode for this part, using TGS's ActiveStyles rendering. When you create a cartoon style, there are only two colors involved - fill color and edge color, but there are a few more options for appearance.
Below that, to the lower-left of the preview area, you see the basic material properties as defined by what Amapi calls the Uniform Layer (level 0). Amapi organizes materials in multiple layers. Any material has at least one layer 0, with the basic attributes:
The preview area shows initially a rendering with the current material attributes, but it is not a static view. You can use the Arrow keys to navigate around the area of interest, you can use the viewing control keys on the numeric keypad to zoom in/out etc... just like in the main view. (you may need to move the cursor over the preview area in some cases).
When you have zoomed in and want to re-render it, just hit Enter
would normally outside of the material editor.
Adding new Layers - 3D & 2D procedural textures, and 2D Image textures
Below the Preview area is where Amapi lets you create additional layers for the current material. There are three buttons at the bottom of that section:
Click the 'Texture 3D' button. Below the preview area, you're
now looking at a newly created 'Layer 1'. It is a 3D distribution of
texture mimicking wood grain. It is a procedural texture, i.e.
algorithmically generated. The Operand (color elemnts in the texture,
also known as texel or voxels) are mapped to the Color of the surface
in a way that Replaces the existing part's color. You could easily
change that by clicking on the various pull-down menus for Operand and
Operation to map the woodgrain to Bump or Transparency instead, or just
the diffuse or specular portion of the lighting equation.
|A new set of parameters appears to the right of the preview area. These are the sliders and parameters affecting the algorithm of this 3D textures. There's also a choice of various types of textures, such as Marble and Grids. The default is Wood.|
Click on the 'Texture' menu and change it from Wood to Noise.
Set the Proportion slider to a high number, like 80. You'll see a bunch of random colors all over the surface.
Increase the Density by 100% (the slider jumps back to the middle thereafter).
Set the Perturbation to about 50.
Now, below the preview area, looking at the operand and operation:
Change the Operand from Color to Bump
Change the Operation from Replace to Mix, and use the Balance slider to increase the mix a bit (70 - 80)
The color changes from your 3D texture noise are now creating a bumpy surface, a bit like an orange fruit's surface. Keep fiddling with the sliders for, Density, Perturbation and Proportion to get the right mix.
In the Uniform layer to the right of the preview area, click the color box of the Diffuse color and select a blue-greyish color, etc, etc etc... you can see how you can create the desired color effects.
For a metallic (aluminium) look, let's get rid of the bump map in Layer 1 (click: Suppress The Layer). Set the Ambiant slider to zero, Diffuse to about 50 (depending on intensity of current Diffuse color), and Specular slider at around 80. Keep the Spread at a low value, which makes a wide spread (scattering the specular reflection). For a bit of metallic reflection, set the Reflection to about 10.
Let's save this set of material parameters into the catalog. Simply click the 'Save' button or click an empty placeholder in the catalog. Hit the TAB key to change the material's name to something easy to remember, such as alu-bottom, to indicate it's the type of Aluminium made for the bottom. If you fine-tune the material some more, click 'Save again to save as a new material.
Click on OK when finished with the material for this bottom part.
Applying 2D Textures
In addition to the 3D procedural textures, Amapi offers two types of 2D textures - procedural, and image based. In both cases, you get to select how the texture is projected and mapped to the geometry - sperically, planar, etc...
Select the outer hull of the can (the main body). The part is named 'can' and its name appears in the lower-left corner of the window.
Re-enter the Material Editor (Render > Shader).
Drag-and-Drop the previously saved aluminium material onto the can in the preview area. This applies the same material to the current part. Use the Diffuse and other sliders to make it a bit lighter. Click a new Empty placeholder to save this as a new material. Again, click on the name widget to set the name for that material to something meaningful you'll recognize.
Now we'll add a 2D texture of Image type to this material. Under 'Add a Layer:', click the "Image' button. A standard file selection dialog lets you look for and select an image file. Several commonly found formats are supported, like JPEG, Targa, Tiff and BMP... In this example, we're looking for and selecting an image named 'label.tif'. Select and open the image file.
About the Images:
If you have your own GIF image and wish to use it in Amapi, be
sure to use an Image converter to turn it into an appropriate
Click on 'Image' in the 'Add a Layer' dialog.
A new dialog with a few options opens to the right of the preview area. The image gets displayed on the can, in a spherical mapping projection by default.
Click the 'Mapping' menu and select 'Cylindrical'. Indeed, the geometry of the can is closest to a cylinder and we'll get best results that way.
A new set of hot-spots appear in the preview area.
When you move the cursor over certain areas of the preview, different types of hotspots appear. You can use them to re-orient (rotate), scale and translate (move) the mapped texture.
Use the Arrow Keys while you do that if you want to change to a top view looking down etc...
Select a front view (2) and place the cursor to the top center of the can. You'll be able to grab a Rescale handle. Use it to scale the mapping down a tiny bit, enough to make the edge of the texture appear at the top and bottom of the can.
Also, below the Mapping menu, you can set the tiling (count) to 2 for horizontal tiling, so that the image gets wrapped around the can's cylinder two times and you'll see more of the label. (just for this tutorial).
You can also place the cursor over the middle/center of the preview area. A hand cursor indicates that you can move (reposition) the mapping cylinder. Move it up a little, so the grey aluminum color appears at the bottom of the can where the mapped label ends.
You can further fine tune with the Diffuse and Specular color components. You could add another layer to the material, and map it to the bump or amount of reflection, or make it an image-based environment reflection map that mixes into the can's color with a blend factor (balance). The possibilities are endless.
When satisfied with this, click the 'Save' button to the right of the preview, a new rendered can material is saved in an empty placeholder of the catalog. Click 'Ok' to quit the material editor.
Hit Enter to do a test rendering.
This is of course just a test render. We still need to apply a
material to the top of the can, and perhaps add some spot lights and a
piece of geometry underneath to place the can on and have it cast
When you are done playing with the materials, select at least one level of anti-aliasing in trhe Render Settings menu, and do a final r ender to file:
Render >> Render File...
Amapi will start rendering the image into memory (rather than onscreen). Amapi first does the rendering and then asks what file type you wish to save it under. After a while (or a long while, depending on many parameters), you'll get a dialog box asking to save the image to particular file name and filetype. The rendering is done and ready to be saved to file.
Here's an image rendered to screen:
Here are 3 cans, duplicated from the original, with various similar images mapped across. The left-most has also an additional layer of bump mapping, the right most has a tiling count that's higher in X and Y directions to show the label several times.
For a final rendering of this to JPEG image file with Anti-Aliasing, click here.
You can find the Amapi project file here.