When you import meshes into realtime 3D engines, you’d probably want to bake some shadows so less calculation needs to be done. In this instance, I wanted to import 3D meshes into Flash using Papervision 3D.
Before I get into baking shadows, I just noticed that Papervision3D doesn’t recognise UVs that are outside the first quadrant in Maya’s UV editor.
As an exampe, when the UV map for the grass sphere looks like this,
…in Flash, the texture appears skewed like this.
Once I scaled the UV so that it fits in the first quadrant and tiled the grass texture file, it looked fine.
Now, back to the shadow problem. What you see in Flash looks flat because there are no shadows. The solution is to bake the lights and shadows onto the texture maps in Maya.
Once you have some lights in your Maya scene and are happy with the shadows, open up Window => Rendering => Hypershade. Select one of the texture files and the objects that are using that texture file. In this case, the grass sphere and the grass texture node were selected.
Then in the Hypershade window, go to Edit => Convert to File Texture . Here, tick Bake shading group lighting and Bake shadows and choose your file format and resolution.
Hit Convert and Maya will export the new texture file to your project folder. It’s a good idea to combine meshes where possible so you don’t end up with many texture files. Just make sure the UVs of combined meshes don’t overlap because that will mess with the baked shadows.
If you export the meshes now to Flash, you might get something like this.
This is because Maya has re-assigned your objects with surface shaders that Papervision3d can’t interpret. You need to go back into Maya and re-assign materials to the meshes again, this time using the texture files Maya exported out.
Compare it with the screenshot before I baked the shadows.