Flash Tutorials

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


Showing posts with label Swift 3D. Show all posts

This animation will be created using cylinder shapes and simple tween animation all in Swift3D.

Our tutorial will be divided into three part:

  1. Modeling the battery using cylinder shapes.
  2. Animating the battery run-out effect using the Animate Button.

Modeling the Battery

Start off by creating a new Swift 3D file, access the Properties Toolbar and change the Layout width to 240 and the height to 320 - these are the dimensions of our output SWF.

Properties Toolbar

Our battery is divided into two four parts: the body, the lower cap, the upper cap, and the terminal. We are going to do each of these on its own in the numbered order shown in the diagram below.

Battery Diagram

As we said previously, our entire battery will be made up of cylinder shapes, so to create the body of our battery, simply click on the Create Cylinder icon Create Cylinder - Swift 3D on the Main Toolbar to create one instantly. We are going to give this one a reflective green material, so simply drag one from the Reflective Tab in the Gallery Toolbar in the lower section of the screen and drop it onto our cylinder to apply this material.

Drag and Drop Material

Our body is done, now to create the lower cap click once again on the Create Cylinder icon to add another cylinder on stage. It should cover up our existing cylinder. Access the Properties Toolbar on the left of the screen, and under the Cylinder section change the length of the cylinder to 0.100 units. That will make our cylinder shorter. We need to position this cap right below our battery body, we can use the mouse to move it around, but to get a more precise position we can simply click on the Position section of the Properties Toolbar and set the Y coordinate of our Object Position to -0.55 to get at the right spot.

Position Lower Cap Cylinder Positioned

The position is now right, we just need to apply the right material for this part and that is a reflective black material. Again, simply access the Gallery Toolbar and drag and drop one onto your object.

Drag and Drop Material

Our lower cap is now done as well, we will create the upper cap next which is identical to the one we just finished. So to save time, we can just select the lower cap by clicking on it on the front viewport and then going through Edit>Copy (Ctrl+C) and then Edit>Paste (Ctrl+P). You will not see the second copy because it is right above the old one. We are going to move this one by accessing the Properties Toolbar, then going through the Position options and setting the Y coordinate of the Object Position to 0.55.

Upper Cap Done

This completes both caps, the final remaining part is the terminal. Once again, because it identical to the cylinder we just completed but smaller, we can select the upper cap and then copy and paste it to create a duplicate. Now access the Properties Toolbar and reduce the size of the terminal by going through the Cylinder section and setting the radius to 0.200 units. We can then reposition it by going through the Position section and setting the Y coordinate of the Object Position to 0.65. That should do it, the cap might not be clearly visible from the default front view port, but you can see it on the left viewport.

Battery Model Done

We are now finished modeling our battery and will move on to the animation part in the next section.

Animating the Battery

We are going to animate our battery using the Animate Button in Swift 3D. Using this button we can create animation tweens similar to those in Flash in that the user simply provides the first and last frames and the animator generates all the frames in between. We are going to provide the first frame when the battery is fully and the last frame when the battery is almost empty. The starting state has already been made. We just need to provide the last stage.

The Animate Button

Creating tween animation in Swift 3D are made using the following procedure:

  1. Activate the Animate Button
  2. Move the Current Frame Indicator to the required frame
  3. Apply the change(s) you wish to animate
  4. Deactivate the Animate Button

The procedure is pretty simple as you can see. We are going to start off by activating the Animate Button, simply do that by clicking on it once.

Activate the Animation Button

Our animation is going to be 20 frames long, so simply click on the number 20 on the timeline to move the Current Frame Indicator to that point.

Move Cursor

We are now going to apply the changes we need to our battery. Start off by changing the colour of the body to red. You can do that by dragging a Reflective Red material from the Gallery Toolbar.

Drag Red Material

The second change we need to apply to our battery is change of size in the length of the body cylinder. We can do that by clicking once on the body cylinder and then accessing the Scale section of the Properties Inspector and changing the Y Factor to 0.1. That should shrink our body cylinder.

Shrink Body Cylinder

We do not want our empty red body to float in the center, we want it to settle at the bottom of the battery, so we need to reposition it. Access the Position section of the Properties Toolbar and set the Y coordinate to -0.45.

Battery Ran Out!

We are done. Simply click once on the Animate Button to deactivate it. You can test the animation now by clicking on the tiny Play button Play Button right below the timeline. You'll see that the green body runs out and changes into the colour red. Stop the animation when you are done. We need to do one last thing to make our animation nicer and that is to rotate it a bit to show the entire shape of the battery. We need to move all the objects together, so we are going to Group them first. Simply press Ctrl+A to select all the assets on the viewport and then go through Arrange>Group.

Arrange Group

We are now going to rotate our grouped object by simply accessing the Rotation Trackball on the lower left corner of the screen and rotating it to get the desired orientation.

Using the Rotation Trackball

You can notice that the battery goes beyond the yellow borders of our viewport, meaning that it will not be fully visible in our output SWF. To fix this we can zoom out a little bit by clicking on an empty spot on the viewport and then accessing the Camera section of the Properties Toolbar and decreasing the Lens Length to 40. This should work as a zoom out.

Battery Zoomed Out

We are done! You can play the animation again to see it from this new perspective.

Rendering the Animation

We are using the RaviX renderer of Swift 3D to create vector animations. To get the same result I got will need to first access the Gallery Toolbar and drag a Black environment colour to the viewport. This will affect the overall colour of the render.

Black Environment

Second, you need to access the Preview and Export Editor tab in the Main Toolbar and then apply the following settings to the RaviX Renderer. Most of these are self explanatory.

  1. Under General, if you are planning on using this in Flash, set the Target File Type to SWFT, if you are planning on using this on the web then set it to SWF.
  2. Under Fill Options, set the Type to Area Gradient Shading, and activate the options to include Specular Lights and Reflections but not Shadows.
  3. Under Edge Options, set the Edge Type to Outlines and activate the options for Outlines at Intersections and to Include Detail Edges.

General Options Fill Options Edge Options

When you are done you can click on Generate All Frames and then Export All Frames to get your animation!


This concludes our tutorial. You can download the end source file from here. I hope that you've learnt something helpful from it.

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.

Introduction

During the Advanced Modeler interface and tools tutorial in Part 1, there were two terms that I glossed over: Surface Groups and Smoothing Groups. In Part 2, we explored Surface Groups in depth and learned how to create them in the Advanced Modeler.

Here in Part 3, we are going to explore Smoothing Groups in depth, and learn how to use them effectively in Swift 3D projects.

Smoothing Groups: Definition

Smoothing groups are similar to Surface Groups in that they define render settings for certain areas of a mesh. The difference is that while a Surface Group defines a material or texture, a Smoothing Group defines an area that will be shaded evenly, with no discernable border between adjacent faces.

Smoothing Groups, used in conjunction with some of the other subdivision smoothing tools in the Advanced Modeler, can produce effects that are similar to - though much less powerful than - the HyperNURBs tools that you’d see in high-end 3D applications.

How to Access Smoothing Groups

If you still have your practice file from Part 2, with the box mesh that we divided into six Surface Groups, then keep it open. Otherwise, head into the Advanced Modeler and create a box mesh in the Perspective Viewport.

showing a box mesh being created in the Advanced Modeler

Smoothing Groups are a feature that can only be accessed while in Edit Mesh Mode in the Advanced Modeler. Smoothing Groups are groups of faces, similar to Surface Groups. Basically what a Smoothing Group does is remove the hard edges between the faces within the group.

showing the Properties Panel with the Smoothing Groups page displayed

This has two major effects. First, when rendering vector output with Area Gradient Shading or Mesh Gradient Shading or when rendering raster output, any area of the model that is assigned as a Smoothing Group will have a consistent, smooth appearance.

Second, when rendering vector output with Outlines, any area of the model that is assigned as a Smoothing Group will not have any outlines within it, only around its outermost edges. There is one exception to this, though. When a Smoothing Group crosses over multiple Surface Groups, then there will still be outlines at the edges where those Surface Groups meet.

Creating and Deleting Smoothing Groups

To begin working with Smoothing Groups, go to the Smoothing Groups page of the Properties Panel and click the Unsmooth All button. Now this box mesh has no Smoothing Groups at all. Above the number grid in the middle of the panel, click the Assign button. Now we're in Assign mode for Smoothing Groups. Let's create one.

Choose the Face Selection tool, and in the Perspective Viewport, select the two faces closest to the camera by clicking on them one at a time.

showing the Perspective Viewport with the closest two faces of the mesh selected

Now over on the Smoothing Groups page of the Properties Panel and click the 1 button in the number grid.

showing the Smoothing Groups page of the Properties Panel with the 1 button pressed

What you've just done is assigned these two faces as Smoothing Group 1. Now the edge that separates these two faces is no longer a hard edge. When rendered in vector mode with Area Gradient Shading or Mesh Gradient Shading or in raster mode, they will have a smoothed appearance. Additionally, if you render this box with Outlines turned on, there will not be an outline between these two faces.

showing the box rendered with Mesh Gradient Shading and also with Outlines

As you can see, using Smoothing Groups wisely is a great way to control the appearance of Outlines when rendering cartoon-shaded vector output. Smoothing Groups are also useful when producing raster output, but the name of the game with Swift 3D is vector animation for Flash movies, and that is where the features of the Advanced Modeler are the strongest.

Now let's look at an example where we combine Smoothing Groups and Surface Groups to gain very precise control over the appearance of vector outlines. Head over to the Properties Panel, select the Smoothing Groups page, and press the Unsmooth All button to erase the Smoothing Group we made earlier.

Using the Face Selection tool, select the two faces that are closest to the camera and the two faces next to those. Now you have two sides of the box selected. Just like we did in Part 2 of this guide, Right-Click on the selection and choose Group > Selection from the context menu.

showing the four faces selected and the Group - Selection option highlighted in the context menu

Now these four faces are one Surface Group. Using the Surface Group Selection tool, select this Surface Group. Go to the Smoothing Groups page of the Properties Panel, and assign this Surface Group as Smoothing Group 1.

showing the Smoothing Groups page of the Properties Panel with the 1 button pressed

See the below screenshot to view the effect this combined effect has on rendering.

showing the box rendered with Mesh Gradient Shading and with Outlines

Conclusion

Seeing this effect demonstrated with a simple box outline isn't all that impressive, but it definitely makes the wheels turn when you think about the possibilities of applying complex “paint jobs” to sophisticated meshes that will be rendered for vector output with outlines. It looks particularly impressive when it's in motion. Swift 3D is primarily a 3D vector animation tool, afterall.

Now that you have a fundamental understanding of the Advanced Modeler interface, Surface Groups, and Smoothing Groups, the next step is to get your hands dirty with some modelling projects. The later parts of this guide will be hands-on exercises in which we will model and render complex meshes in Swift 3D. See you there!

Introduction

In Part 1 of this guide (Interface and Tools), we took a Box primitive with 8 x 8 x 8 segmentation from the Scene Editor to the Advanced Modeler, converted it from a primitive object to an editable mesh, and had a detailed tour of the Swift 3D Advanced Modeler interface. If you are unfamiliar with the Swift 3D Advanced Modeler interface, then please read Part 1 before proceeding with this guide.

During the interface tour in Part 1, there were two terms that I glossed over: Surface Groups and Smoothing Groups. Here in Part 2 of this guide, we will explore Surface Groups in depth, and learn how to work with them effectively in Swift 3D modelling projects.

Surface Groups: Definition

In the Properties Panel on the left side of the Advanced Modeler interface, the third item in the menu list is Surface Groups. A Surface Group is a group of one or more faces that have been assigned together as one unit. While the faces remain separate and can be transformed individually, they can also be selected and edited as a group using the Surface Group selection tool. Using Surface Groups wisely is an integral part of any Swift 3D project. It gives you the ability to apply multiple materials and textures to one object, and is a fast and easy way to select large groups of faces that need to be moved or transformed together.

showing the Surface Groups page of the properties panel

The Surface Groups page of the Properties Panel displays a list of all of the Surface Groups in your model, and when one is selected in the list, the buttons below it can be used to Select it in the workspace, Hide it in the workspace, or Show it if it's hidden. The fourth button, Group Selection, will group whatever faces you have selected in the workspace into a Surface Group.

The Material subsection below the Group Selection button will display the material that is currently assigned to the selected Surface Group.

Exercise 1: Create a Box Mesh in the Advanced Modeler

Let's use Surface Groups to apply six different colored materials to a box. If you have the 8 x 8 x 8 box mesh from Part 1 of this guide, delete it. In the Toolbar (top), choose the Create Box Mesh tool.

showing the Create Primitive Mesh Toolbar with the Create Box Mesh button pressed

When you click on the Create Box Mesh tool, the Properties Panel on the left adds a new page called Box and jumps to that page.

showing the Properties Panel displaying the Box page

This is your one and only chance to modify the segmentation of the box before creating it as an editable mesh in the Advanced Modeler workspace. Once you create the box as an editable mesh, all object-level properties are no longer editable. For now, though, let's leave the segmentation at 1 x 1 x 1.

Move your mouse over to the center of the Perspective Viewport, hold down CTRL, Click and Drag up and to the left. When the Box mesh looks like a good size to you, let go of the mouse button and the CTRL key.

showing the new Box mesh in the Perspective Viewport

You've just created a Box mesh in the Advanced Modeler interface. Sweet. Now let's use Surface Groups to apply six different colored materials to this box. In the Toolbar, choose the Face Selection tool.

showing the Toolbar with the Face Selection tool selected

In the Perspective Viewport, click out in the empty space somewhere to deselect everything. Now use the Face Selection tool to select the two faces of this box that are closest to the Camera, by clicking on them one at a time.

showing the box in the Perspective Viewport with the closest two faces selected

With those two faces selected, Right-Click (or CTRL-Click on a Mac) to get the Viewport Context Menu, and choose Group > Selection.

Selection item highlighted" width="288" height="365">

Now those two faces are their own Surface Group. The other option in that context menu, And Separate Selection, will group the selected faces into a Surface Group and detach them from the rest of the mesh. That function serves its purpose in some cases, but not right now.

To create the other five Surface Groups, select the other sides of the box one at a time, and repeat the Right-Click (or CTRL-Click on a Mac), Group > Selection process for each side. Hold down ALT to rotate the Camera angle as needed so that you can select each side of the box. When you've completed making all six Surface Groups, take a look at the Surface Groups Page of the Properties Panel (left side of the interface).

showing the Surface Groups page of the Properties Panel after the regrouping is done

As you can see, there are now six Surface Groups in the list. Swift 3D's default naming convention for Surface Groups is that the first group will retain the original name from when the mesh was first created, and all subsequent groups will be named Regroup0x in one-up order. If you want to change the names of your Surface Groups, you can do so with the the text input box just below the list. Just type in the new name and hit Enter.

Applying Materials to Surface Groups in the Advanced Modeler

In the bottom-right area of the Advanced Modeler is the same menu panel that appears in the Scene Editor. The exception is that in the Advanced Modeler, only the Materials and Models options are available. This is a modelling environment, not a scene building environment, so the Animations, Lighting, Environments, and Bevels cannot be used here.

Using the same method as what you'd do in the Scene Editor, drag a new material onto one of the sides of the box.

showing a blue color material applied to one of the sides of the box

Notice that the material is only applied to the Surface Group where you dropped it. As you can see, creating Surface Groups in the Advanced Modeler is the way that you apply multiple materials to the same object in Swift 3D. Just for fun, I dragged some loud colors onto all of the sides of the box, and rendered this result:

showing the rendered box with several different materials on it

The important point to take from this part of the Advanced Modeler Guide is this: in any case where you want to put multiple materials onto one object, the way to do that is to take the object into the Advanced Modeler, and use Surface Groups to define the parts of the object where you want each material to be placed.

Surface Groups are also very handy for grouping and naming the different parts of a mesh as if they were parts of a real object. For example, if you were contstructing a model of a car in Swift 3D, you might have a bunch of Surface Groups with names like Front Tires, Back Tires, Body, Windshield, Left Windows, Right Windows, Back Window, etc.

Subscribe to: Posts (Atom)