Materials and Textures in Swift 3D - Flash Tutorials

Flash Tutorials

3D, Actionscripting, Animation, Special & Text Effects, Dynamic, Games, Basics, Interactivity, Math Physics and Web Design tutorials


Introduction

If you’re already familiar with Swift 3D, then you know that you can apply materials to objects in the Scene Editor. When applying materials to objects in the Scene Editor, however, there are two limitations:

1. The material application is drag, drop, and done. You cannot scale or re-align bitmap textures in the Scene Editor.

2. When you create an object in the Scene Editor, it is a single Surface Group, and as such you can only apply one uniform material to the object.

In the Advanced Modeler, you have much greater control over the application of materials and textures. The Advanced Modeler allows you to divide objects into multiple Surface Groups (see: Advanced Modeler Guide Part 2), which then gives you the ability to apply more than one material to the object.

Also in the Advanced Modeler, you have the capability to scale and re-align bitmap textures, which is absolutely essential in creating photorealistic images when rendering in raster mode.

The Project

In this tutorial, we are going to model and apply bitmap textures to a box shape, and our final rendered product will be a textured 3D software box as shown below:

showing the final product of this tutorial

To begin, please download the three bitmap textures that we will be using in this project, and extract them into the folder where you plan on saving your .T3D file.

» box_textures.zip

Exercise 1: Setting Up the Materials

If you don't already have Swift 3D open, please launch it now.

Before we create a box shape or anything else, the first step is to import these three bitmaps into the Material Gallery.

At the bottom of the Swift 3D interface just to the right of the center, you'll see the Gallery selector buttons. Click on the button that depicts metallic-chrome primitives on a checkerboard background, this is the selector button for the Material Gallery.

showing the Gallery selector buttons

If you've never tinkered with the Material Gallery before, then you'll see the default line-up of categories: Bitmap, Flat, Glossy, Metal, Pattern, Reflective, Stone, Texture, Transparent, and Wood.

showing the default line-up of Material categories

In this tutorial we're going to be using Bitmap materials, but I would recommend that you not lump then into the "Bitmap" category that already exists in the Material Gallery. Instead, I recommend that you create a new category and name it after the project for which you are using the bitmaps.

This should be a normal part of your Swift 3D workflow whenever you create new materials as part of a 3D rendering / animation project.

To create a new Materials category, simply right-click anywhere in the empty space on the Materials Gallery, and choose Setup Materials... from the context menu that pops up.

showing the context menu with Setup Materials highlighted

When you do this, you are greeted by the Gallery Setup menu. Click on New Category... and give this new category a name that suits the project, such as, "Software Box."

showing the Gallery Setup menu and the new category being created

After you click OK, you'll see that the new "Software Box" category has been added to the tab structure down in the Material Gallery. Click on the "Software Box" tab to open that category. At first you'll see a small notice in the center of the display window which reads, "No materials are available."

Let's remedy that, shall we? Simply right-click anywhere in the empty space to bring up the context menu. This time, we want to add a material to the category, so select the New Material... option.

showing the context menu with New Material highlighted

When you do this, you will be presented with the Edit Material menu. This menu has three sections: Finish, Color, and Texture. The section that we are concerned with is the Color section. In the Color drop-down menu, look all the way to the bottom and select the Bitmap Image option.

showing the Edit Material menu with Bitmap Image selected

This is a standard file browsing dialog box, so just navigate to the folder where you extracted the three bitmap images. Select the first one, box_front.bmp, and either double-click or press Import.

showing the file browse dialog box with the first material selected

At that point, you'll return to the Edit Material menu, with a small preview of this new material shown in the window.

Next to the preview in the Color section of this menu, you'll see two checkboxes labeled X Tiling and Y Tiling, with a small header above them that reads, Allow. The terms X Tiling and Y Tiling refer to the repetition of the bitmap material along the Surface Group to which it is applied. We don't want these textures to tile, so uncheck both of these checkboxes.

Also, in the Finish section of the Edit Material menu, reduce the Highlight Strength and Highlight Size of the material to about 15%, as shown in the below screenshot. These two attributes control the glossiness of the material. For a shiny object, you would turn these two attributes up. For a flat or dull object, you would turn them down as we've just done.

showing the Edit Material menu with all of the appropriate settings

Repeat this process for the other two bitmap materials. You'll now have three ready-to-use bitmap materials in your newly-created "Software Box," material category.

showing the completed Software Box material category

With the materials setup complete, it's time to create the box model and divide it into the appropriate Surface Groups.

Exercise 2: Creating The Box Model and Dividing it Into Surface Groups

Remember, in Swift 3D, in order to apply multiple materials to a single object, you must first modify that object in two ways:

1. Take the object into the Advanced Modeler and convert it into an Editable Mesh.

2. Divide the object into multiple Surface Groups, concurrent with how you would like the different materials to be applied.

For the purposes of this tutorial, we'll just create the box model the easy way. In the Scene Editor, click on the Create Box Tool to create a box primitive in the scene.

showing the Create Box Tool highlighted

At this point, I'd like to provide a helpful tip for 3D rendering projects. When you're working with bitmap materials and your intention is for them to be non-tiling (as in this project), it is extremely important that the 3D surface to which you plan to apply the material has the same aspect ratio as the bitmap image itself. Otherwise, the texture will become distorted.

In this particular case, the box_front.bmp image is 400 x 550 pixels, which is an aspect ratio of 8:11 (width:height). The other two bitmaps, box_leftside.bmp and box_rightside.bmp, are 200 x 550 pixels, which is a 4:11 aspect ratio.

With that in mind, the front of this box model needs to have an aspect ratio of 8:11, and the sides need to have aspect ratios of 4:11. Swift 3D provides an extremely easy method for achieving this.

Still in the Scene Editor, select the newly-created box in the scene by clicking on it, and then look at the information panel on the left. With the Box option selected in the upper portion of the panel, change the Sizing of this box to 8 units wide, 11 units tall, and 4 units deep, as shown below.

showing the information panel with the appropriate box sizing in place

When you do this, the box will expand greatly and occupy the entire viewport. Switch the left viewport to Perspective, and then zoom out a bit so that you can see the entire box. Also rotate the camera perspective somewhat so that all three dimensions of the box can be seen.

showing the Perspective Viewport all set up

At this point, we need to divide this box model into the appropriate Surface Groups. Make sure that the box is selected (by clicking on it), and then head over to the Advanced Modeler and activate Edit Mesh mode.

For a reference on how to divide an object into multiple Surface Groups, please see the Advanced Modeler Guide Part 2: Surface Groups.

The screenshots below illustrate which faces need to be grouped together to create the four necessary Surface Groups on this box mesh, numbered 1-4:

showing the appropriate Surface Groups highlighted

Now that the model is divided into the appropriate Surface Groups, simply apply the appropriate bitmap materials via the same drag-n-drop - only this time, you're aiming at specific Surface Groups rather than at a whole object.

For Surface Group 1, apply box_front.bmp. For Group 2, apply box_leftside.bmp. For group 3, apply box_rightside.bmp. And for Surface Group 4, just apply the Flat Black material from the "Flat," category in the Material Gallery.

showing the appropriate materials applied to the Surface Groups

At this point, the project is done. All you need to do now is return to the Scene Editor and use the Perspective Viewport to get a nice viewing angle on the box. Also play with the Lighting and the Environment until you're pleased with the resulting brightness and contrast.

When you're happy with how the Scene is set up, head over to the Preview and Export Editor, and render your box in raster mode.

showing the finished product

This tutorial has demonstrated a very simple example of what the Swift 3D Advanced Modeler is capable of in terms of working with materials and textures. In future 3D projects, this same process can be repeated and compounded many times over to apply large numbers of materials to complex meshes.

0 comments

Post a Comment

Subscribe to: Post Comments (Atom)