Material Assets How-To

This document describes how to use the flash authoring environment to create media suitable to be used in material definitions within the FFilmation engine.

Creating Media for a MovieClip Material

A MovieClip material is in short a MovieClip that you export in any loaded SWF. This clip is attached to the scene and then scaled and deformed to match the wall’s (or floor) dimensions and perspective. You don’t have to worry about perspective when drawing the MovieClip: you always work with flat texture maps, as in 3d modeling.

MovieClip material step 1Here’s how to make one: first create an empty MovieClip. Make it 2 frames long. Draw the map along both frames. The top-left corner of the map must be at (0,0). This is your basic material. Let’s explain now why it is 2 frames long.

First, lets imagine that your material is to be applied to a wall, a stone wall. The basic material would be a stone-filled box. But you’d like to add a little bit of grass at the bottom that would overlap slightly with the floor, and make a nicer edge. You need a way to tell the engine that the “stone” box needs to be scaled to fit the wall’s dimensions, not taking into account the grass pixels that grow outside this box. You do it by placing the grass only in the second frame. The engine scales the movieClip in frame 1, and then gotoAndStops it to frame 2, where you can draw additional graphics that grow outside your material and overlap other elements.

MovieClip materials allow you to define holes as well. Holes in your material are used by both the light rendering algorythm and the collision detection algorythm. You can draw a window or a door and objects will automatically be able to move across this material. Light will project the appropiate shadows as well. At this moment only square-shaped holes are supported. Multiple holes per material are allowed.

MovieClip material step 2
In order to create a hole, first make the hole physically in your material. The clip must be transparent in the hole’s area. It would be nice that the engine could recognize this transparent area, but for now you have to inform of its coordinates manually. To help with this procedure, use the Hole MovieClip. You can get this clip from the sample library FLA or any of the downloadable examples. Now drag this movieClip in a layer over your map, only in frame 1. Adjust position and scale until it matches the transparent area. That’s it, the engine will read from this clip and understand this area corresponds to a hole.
MovieClip material step 3

Ok, so you have setup a movieClip material. Right-click this clip on the library, select export settings, choose an export class ( leave baseclass as it is ). Check “export in first frame”. Remember name. Publish. Use name as source for diffuse map in your material XML.

Setting up movieClip bumpMaps works almost exactly the same way, but:

  • Bumpmaps only have one frame
  • Clip is assumed to be grayscale
  • Bumpamps don’t need hole definitions, they are assumed to be the same of its related diffuse map.

Creating Media for a Tile Material

A tile material is a box of any size painted with a given bitmap. The bitmap is tiled to fill all of the requiered area. At this moment tiled materials don’t support holes and are more limited from a creative POV that movieClip materials, but provide an easy way of automating walls and floors, as one single material can be applied to lots of different walls and floors ( a randomly generated labirynth, for example)

To create a source for a tile material follow these steps

  1. Import bitmap into library. Make sure it tiles nicely.
  2. Right-click this bitmap on the library, select export settings, choose an export class.
  3. Check “export in first frame”.
  4. Remember name.
  5. Publish.
  6. Use name as source for either diffuse or bump map in your material XML.