Our Properties: Gamasutra GameCareerGuide IndieGames Indie Royale GDC IGF Game Developer Magazine GAO
My Message close
Contents
Using Maya's Convert to File Texture Tool for Real Time Game Environments
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
February 8, 2012
 
PSN dev Drinkbox Studios on porting code to 'mini-PS3' quality Vita hardware
 
Critical Reception: Big Huge Games' Kingdoms of Amalur: Reckoning [3]
 
Report: French game development tax breaks may be prohibited
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
February 8, 2012
 
Treyarch / Activision
Lighting Artist
 
Sledgehammer Games / Activision
MP Level Designer
 
Lantern
Environment Artist
 
THQ Montreal
Art Lead-THQ Montreal
 
THQ Montreal
Sr. Gameplay Programmer
 
THQ Montreal
Senior Technical Animator/Rigger
spacer
Latest Features
spacer View All spacer
 
February 8, 2012
 
arrow Postmortem: CyberConnect 2's Solatorobo: Red the Hunter
 
arrow Jerked Around by the Magic Circle - Clearing the Air Ten Years Later [22]
 
arrow Building the World of Reckoning [4]
 
arrow SPONSORED FEATURE: TwitchTV - How to Build Community Around Your Game in 2012 [13]
 
arrow Happy Action, Happy Developer: Tim Schafer on Reimagining Double Fine [9]
 
arrow Building an iOS Hit: Phase 1 [11]
 
arrow Postmortem: Appy Entertainment's SpellCraft School of Magic [5]
 
arrow Talking Copycats with Zynga's Design Chief [82]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
February 8, 2012
 
Merging Waterfall and SCRUM [2]
 
Business Post Mortem: Wolf Toss: Pre-launch Planning & Blended CAC
 
Minmaxing - Is turn-based fun anymore? [53]
 
PRICED TO DIE [4]
 
What happened with Shadow Physics: An Introduction [3]
spacer
About
spacer Editor-In-Chief/News Director:
Kris Graft
Features Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Frank Cifaldi, Tom Curtis, Mike Rose, Eric Caoili, Kris Graft
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
 
Feature Submissions
 
Comment Guidelines
Sponsor
Features
  Using Maya's Convert to File Texture Tool for Real Time Game Environments
by Rémi Benoist [Visual Art]
Post A Comment Share on Twitter Share on Facebook RSS
 
 
January 29, 2001 Article Start Page 1 of 3 Next
 
The rendering of realistic shadows is one of the most important aspects of maintaining a game's suspension of disbelief. It makes or breaks the good, solid look of a real-time environment. It can define the overall ambience and mood of a room, establish the time of the day, add a dramatic contrast to a specific area, or pinpoint the key areas of a level. More and more game designs are relying on those elements to make a game world believable and enjoyable.

The production of real-time dynamic shadows is the way of the future, and articles such as Hubert Nguyen's "Casting Shadows on Volumes" (Game Developer, March 1999) and Jason Bestimt and Bryant Freitag's "Real-Time Shadow Casting Using Shadow Volumes" (Gamasutra, 11/15/99) have only started to scratch the surface of those issues. This type of lighting is limited in the category of light used, and the look of the shadows is not controlled by the artist. Furthermore, for most PCs and next-generation consoles out there, using of dynamic shadows for the whole of the game environment is still something difficult to achieve within a respectable frame rate. This type of shadow is only needed for dynamic objects and environments while the rest of the scene could have preprocessed shadows applied to it. With a precise design of the environment, in which all the areas that need dynamic lighting have been sorted out, you could use depth map shadows for a good portion of the level, if not all, while saving valuable CPU processing time.


While the current batch of PC video cards is capable of displaying layers of textures in one pass, the current generation of consoles can only achieve this effect at a cost (they need to redraw the polygon with a different texture over it several times to achieve the effect). All the manufacturers of future graphics chips are making sure they are capable of displaying at least four textures (or more) in a single pass. This is the type of hardware that is recommended to achieve the effects described in this article with as minimal an impact on the frame rate as possible. Multiple textures (such as bump maps) offer a visual advantage on previous game engines that players can notice easily. Using this kind of feature will help ensure that your game stands out.

A good majority of games released use a very simplistic rendition of what a shadow can be. The black or dark-colored vertex used to define a shadow results in a dull, blurry zone defined by the geometric edges of the object. As such shadows are dependent on the geometry of the object, large rooms will tend to have large, straight, dark blurry zones, making the perception of the details and scale of the room difficult for the viewer, while doing a rather poor job at defining the mood of the level.

One other solution is the use of shadow maps. Different solutions exist to produce light maps and shadow maps. Some games are using licensed 3D engines that provide shadow maps in the rendering of their environments. But their need for specific editors hampers the building of intricate or more "free-form" objects required for more complex environments or game designs. The lights available are usually spotlights and point lights, with the rendering of the shadows still out of the artist's control.

The use of a regular 3D package can free the game designers and artists from the learning curve and limitations of an editor, allow the programmers to show off their own "L33t" engine capabilities, and return the licensing money needed for the engine right back to our royalty checks.

For this article, I'm going to concentrate on the Convert to File Texture Tool found in Alias Wavefront's Maya, because it's part of the main package, it's integrated in the general workflow, and with a bit of massaging and additional tricks, it can make miracles happen in your scene.

Figure 1. We are going to use this simple scene to demonstrate the power of ConvertSolidTx.

 

Maya's Convert to File Texture Tool and Command Line.

ConvertSolidTx [flags] [texture] [objects]

The tool can be found in the Multilister under Edit. Click on its Option box and click on the Help menu to access Maya's manual pages. There, you can see the MEL (Maya Embedded Language) command of the tool and its flags. One command in particular tickles the fancy and whets the appetite: -sh / -shadows.

Reading the manual, you will learn that having to type the command with its flags, resolution, texture name, and object name for each object requiring a depth map shadow can be seen as a task to be assigned to monkeys over the course of many weeks. For some reason, Alias did not provide this flag as a check box in the tool interface, as it did for Antialiasing. But thankfully, they left the door open and we can correct this.

Modifying the Convert to File Texture Tool Menu

Download copyConvertSolidTx.mel and performConvertSolidTx.mel and copy them in your Maya Script directory (don't forget to back up the originals!). You now have access to the depth map shadow rendering within the tool interface. All you have to do is select the object and the relevant shader, set the size of the map you want, and let Maya render the texture and assign the new shader at the right place for you.

Examples of Use and Tool Limitations

First you will need a light. Only lights that can produce depth map shadows can be used with Convert to File Texture, so the three types available are directional lights, spotlights, and area lights. Read the manual for a complete description

Figure 2. Maya's power lies in its open architecture.

 

of their characteristics. Make sure the lights you want the shadows from have Use Depth Map Shadow set to "on," and set the texture size and filtering as you would for a software rendering output. Since the tool uses Maya's software rendering to process the shadows, you can set up your lights and depth map shadow settings as you would for a regular render. You can software-render the scene with different colors in the lights to achieve different effects and ambiences, knowing that the shadows in the real-time environment will be pretty close to this result. Point lights can also be used. Those lights do not render shadow maps on or from objects, but with the option set to "on," the light emitted will not go through walls. They can be used to fake global illumination or radiosity.

You can't use raytracing, which means you can't have the direct shadow from the alpha channel of a texture (but we will see about that later), caustic effects (but you can always fake caustic with well-placed point or spotlights, or projected bitmaps), or shadows from objects made of glass.

The light setup we are going to use in our scene consists of one area light as the key light and for the shadow rendering process, with two spotlights for different purposes, and a point light just to add energy to the scene.

As specified in the online help, the tool only gives good results on objects with nonfolding UVs
In this case, the use of Maya's Automatic Mapping and Relax UVs tools are quite handy to make those UVs fit the 0-1 square with even the most intricate objects. Consult the manual for a good explanation of the workflow on those tools. The tool will also force the rendering of an object with UVs beyond 1, as one texture fitting the whole object reduces the pattern resolution.

Figure 3. The small cube textured with Automatic mapping and Converted to Solid Texture.

 

Build all your objects single sided, then check to make sure that Render Stats, Double Sided and Opposite are turned off in the Attribute Editor. Check that the normals are facing the outside or Convert to File Texture tool will render parts of the object black ! (Thanks to Tom Harper from Alias Wavefront for the info.)

Finally, because the object can use two different sets of UVs, it could break the strip if they don't match up, and could slow down the rendering. Cast the Automatic Mapping tool first, and build the textures around a template of the warped polygons in Photoshop to avoid this.

Now let's look at how to gain control of the output of the tool and its multiple uses in your game.

Figure 4. All these tricks explained.

 

 
Article Start Page 1 of 3 Next
 
Comments


none
 
Comment:
 




UBM Techweb
Game Network
Game Developers Conference | GDC Europe | GDC Online | GDC China | Gamasutra | Game Developer Magazine | Game Advertising Online
Game Career Guide | Independent Games Festival | Indie Royale | IndieGames

Other UBM TechWeb Networks
Business Technology | Business Technology Events | Telecommunications & Communications Providers

Privacy Policy | Terms of Service | Contact Us | Copyright © UBM TechWeb, All Rights Reserved.