Gamasutra: The Art & Business of Making Gamesspacer
Using Maya's Convert to File Texture Tool for Real Time Game Environments
arrowPress Releases
December 15, 2017
Games Press
View All     RSS






If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Using Maya's Convert to File Texture Tool for Real Time Game Environments


January 29, 2001 Article Start Previous Page 3 of 3
 

Workflow on a Complex Scene

The four textures used in this next scene are small, and tinted in a light gray with a hint of blue. Each object in the scene has its own shader with a layered texture node applied to it. Consult the online manual for a description of this node and it’s use in conjunction with Visor and Hypershade. The objects are mapped with planar projections. Two different light setups were built: one for night, the other for early morning. Each setup contains several lamps casting shadows, and all of the lights are tinted according to the time of day you want to achieve. The scene is rendered in software to check the quality of the shadow-casting and for future reference.

We will start with the early morning setup. The early morning scene is copied, and a white Lambert shader is applied to all the objects in the scene and new UVs are set with Automatic Mapping. Check the Texture view to see if the Automatic Mapping is making an optimized use of the texture space; if not, change the settings until you think it's close enough without distorting the UV too much. This scene is going to be used to cast the shadows on white textures generated by the Convert to File tool. Set the size of the texture relative to the size of the object to be rendered.

 

Figure 10. The original scene.

The original scene is then imported and Automatic Mapping is applied to all the original objects in the scene but with Create New UV set checked "on" (don't forget to name them). Now, all the processed shadow maps from the copied object are applied to the layered texture node of the original object by sliding the right texture to the color channel with the right mouse button. Make sure that the Multiply blend is applied to the right texture in the right order. You can change the order in which the textures are displayed by moving the files around in the Attribute editor. Check in the interface that the blending of the two textures is having the desired effect (you must have "Layer is Visible" checked "on" to see the different textures at the same time).

Figure 11. Morning light.

If we have a look at our object, nothing coherent is happening yet. We need to set each texture to the right set of UVs. With the Relationship editor open, select UV Linking, and with the object and the corresponding shader selected, link the shadow map texture to the shadow UV sets. It is quite important to have relevant names for the textures and the different UV sets. Since the operation is done with them only, the only visual clues of what is going on is happening on the object itself. Now that we are done with all the objects in our scene and are quite happy with the result, let's go on to the nighttime setup.

The procedure for nighttime is no different from the early morning scene, except that the light emanating from the inside the tower needs a different approach. Because the color of the spotlights used there is quite strong, using a shadow map for this area would render a poor result with a Multiply blend. This kind of light beam projection is similar to the stained glass trick explained earlier. To get this to work, we need to render the ground texture tinted yellow by the spotlight and its shadow. We will then just swap the textures on the appropriate ground object. For this process, the UV on the ground objects must not overlap or tile.

Figure 12. The same scene lit for night time.

With this technique, it's quite simple to have different lighting conditions on the objects in the scene and still keep a large amount if not all of the original textures. We could have a different set where an alarm is set off and only small exit signs are lighting a room, or for different weather conditions.

Conclusion

What stands out with the use of accurate shadow maps in real time is the immediate clean look software-rendering the scene gets. Which makes it even more interesting when we start spinning the camera around. The walls and objects standing on the floor gain a more solid feel, with a weight they did not have before. Because the control we get over the light behavior is the same as setting a scene for a software render, it's a lot easier for the artist to achieve the result he or she has in mind. With the scene rendered in software as reference, the real-time result is shockingly close. Compared to painting the vertices and software-rendering the different sides of an object and applying the textures back to it, the whole process is more accurate, easier, and faster. And it doesn't alienate the use of painted vertices, which can be of use in a dynamic environment. The use of different resolution, palette definition, and compression ratio on the shadow maps add more control to the use of texture space on what could be seen as a very expensive use of it. Adding the benefit of being able to change the shadow maps while retaining the original textures looks like a bargain for the artist and the programmer.

Other issues can be seen in the UV set management. All the processes could be simpler, with added functionality. The option to move the order of the UV sets without having to change the links in the Relationship editor and being able to transfer entire UV sets from one object to another and keep the order it originated from would be a big plus. Having the option to assign the layered textures to the corresponding UV set when the shader has been applied in the Relationship editor could bypass the use of an extra window, and add visual cues to the procedure. It might be wiser to apply those changes to the Hypershade and upgrade it. The possibility of rendering raytraced shadows or caustic lights could offer a wider choice of materials to be preprocessed (such as textures with an alpha channel and transparent objects).

One thing you may notice using the tools described here is that they tend to work better on a per-object basis. The Automatic Mapping and the Convert to File tools can give poor or unpredictable results if applied to a multiple selection of objects.

With an accurate render of shadows all across the scene, the remaining problems now reside in the render of the characters or dynamic objects in the scene. This technique can only be completed with a dynamic render of the game characters' shadows: a simple blob underneath them or a set of flat polygons that get cut at the base of a wall would not look right, and would be spotted at first glance. Furthermore, precise planning is needed if pieces of geometry (columns, walls, or roofs) could be collapsed, destroyed, or blown up by the player.

Some limitations could be tied up with MEL scripts and customized plug-ins, but since this is out of my domain, I'll leave this to the programmers out there willing to give it a try.

What strikes me is how the shadow rendering flag ended up in Maya in the first place. It looks like a half-finished function waiting for a clever interface. And it might be just that. We could see a new, full-fledged tool in Maya 4 performing the functions described in this article. Use this at your own risk, or wait for Maya 4 to come out and pray.

For More Information

http://www.aliaswavefront.com

  1. How to Prelight a Scene (This tipped me off to the Convert to File tool and made me search for more)

Birn, Jeremy. Digital Lighting and Rendering. Indianapolis: New Riders Publishing, 2000.

Acknowledgements

Thanks to my friends Hubert, Pierre and David for their support.


Article Start Previous Page 3 of 3

Related Jobs

University of California Santa Cruz
University of California Santa Cruz — Santa Cruz, California, United States
[12.14.17]

Art & Design: Games & Playable Media Program, Assistant Professor (Open Until Filled; Initial Review 01/15/18)
SMU Guildhall
SMU Guildhall — Plano, Texas, United States
[12.14.17]

SMU Guildhall Faculty (eCenter) - 2 positions
Insomniac Games
Insomniac Games — Burbank, California, United States
[12.13.17]

Lead VFX Artist
Kaneva
Kaneva — Atlanta, Georgia, United States
[12.13.17]

Software Engineer, UI





Loading Comments

loader image