Light Racer 3D - Days 3-4 - Textured Racer Model

Every 3D game has a process defined for creating models, texturing and importing into the game. In these two days, I've come up with a process that works for Light Racer 3D and all of the games we will be developing in the future. This process will be a little different from project to project, depending on the requirements of the game and which tools you are using to create your art. I wanted to use Maya but was most familiar with 3D Studio Max so I went forward with it for Light Racer 3D.

Day 3 - What was done:

Added normals to obj import
Added groups to obj import
Created basic racer model of around 550 polys
Tested on G1 - Initial failure
Switched out code to use GLSurfaceView
Tested on G1 - 60FPS with arena and 3 racers all in view. (awesome!!)

Day 4 - What was done:

Optimized racer model
Created texture map for racer
Created basic texture for blue racer
Added Flip V to import for textures (texture coordinates were upside down)


The emulator runs OpenGL far slower than a G1. I was really upset on the night of day 3 because I couldn't get the app to run at all on the phone and on the emulator it was dipping down to around 10-15FPS, which basically indicated complete disaster. I originally set up this project about a year ago and used some much older EGL configuration code that came from the Android API Demos. It didn't work correctly on the device at all. Since I'm targeting Android 1.5 as the release platform, I can use the new GLSurfaceView class that they provide. I retrofitted my project to use that, which allowed for almost all of the gross initialization code to be removed. Now the "game" runs at 60FPS on the G1 with 3 Racers each with 550 polygons. I can't image that I'll ever need many more than 2000 polygons to do a mobile game so this is great news.

I spent all of day 4 optimizing the model by removing additional polys and faces. I also spent some time lining everything up very carefully because I didn't want to have to edit the geometry again. For you 3D studio users - you probably already know how to do all of this, but I'll outline the process simply as a matter of documentation for myself.

1) Create the model geometry. This is where you draw splines, extrude sides and faces, draw tubes, circles, or whatever else you want. Just make all of your new geometry and edit until you have it all looking the way you want.
2) Convert everything into an editable mesh and attach objects together into the correct groups.
3) Select all of the elements, go to materials and assign material 1.
4) Select the editable mesh and add an Unwrap UVW modifier
5) Clear the UVs and edit - creating a nice map.
6) Export the map as a template and edit, then save as a 512x512 or whatever size PNG.
7) Go back into the materials, edit material 1, choose a map for the diffuse, pick your PNG as the file. Also hit the little checkered box that shows the maps in the viewport - this makes working on your texture easier because all you need to do is hit reload when you've changed the file.
8) When everything looks good, export as an OBJ. Don't flip YZ like poser. Export normals and optimize everything.

Make copies of your MAX file or save your UVW after you've made it! It's too easy to accidentally destroy it and 3D Studio can only go back 10 or so steps of undo. Remember - if you change your geometry, you have to redo your UVW map. Make sure you've got the right geometry and that it's totally optimized before texturing.

I have a problem with the texture going in to OpenGL ES upside down. For whatever reason, 3DS's V coordinates and Android's OpenGL ES texture V coordinates are reversed. I changed my OBJ importer to flip them by doing one minus the coordinate, and all is well.

Here are some screenshots of where I'm at:

3 Racers with wrong texture3 Racers with wrong texture Low-Poly Racer in 3D StudioLow-Poly Racer in 3D Studio
Textured Racer in 3DSTextured Racer in 3DS 3 Blue Textured Racers In-Game3 Blue Textured Racers In-Game
Blue Racer TextureBlue Racer Texture

The racer model is final but the texture is not. Once I can see everything in-game while playing, I'll start working more on detailing textures.