Developing Unity Lightmapping tools NO. 1 : FBX Exporter


After some consideration I decided to change the name for a moment to make it less confusing for other people, because the project indeed is focused on the connection between Unity and Vray over 3dsmax, but the main core will allow everybody to use it for their own purpose with any software with a FBX importer and rendering system supporting UV’s on channel 3.

After a few days of work I’ve written the main core of the FBX Exporter which now allows to export any mesh objects, with their textures and for the moment – a UV on channel 1.

At first I was a little feeling a little uncomfortable when I’ve discovered that Unity splits vertices’s, however for my current project it wasn’t such a big deal. Accordingly to the assumptions the scene should be ready for baking on the export time, so I don’t have to really think about all those additional vertices’s that will show up in 3dsmax until it looks properly.

Later I’ve been a bit impressed in how sophisticated way was the Unity API designed – it really makes writing for it easy and comfortable and that’s something I would not say about Autodesk FBX documentation, because there’s no documentation at all and the most of my time I spent on endless experiments, trying to figure how things work there inside. I still cannot say that I figure out everything cause I’m having a little smoothing problems and I didn’t test it with other objects that won’t be attached as one mesh.

At the moment I would like to give a few tips to anybody straggling ย with FBX in ASCII mode.

  • At exporting UV’s from Unity to FBX be set the “MappingInformationType” to “ByVertice” and “ReferenceInformationType” toย “Direct”
  • Most of the properties supported by the object in an FBX file aren’t needed when you want just import it to 3dsmax, just be sure to left 6-7 last properties
  • When exporting a reference to a texture there’s no need to export Video objects connected with them.
  • 3dsmax importer is tolerable when it comes to file paths, you may use “/” as well as “\”

I’ve also researched other areas like UV packing in Unity, running from command line and lightmapping in 3dsmax.

As it turn’s out, one can get a really fantastic results will well adjusted materials.

Below you can see a simple scene without any Unity light (not well unwrapped though) which shows the difference between lightmaps rendered with objects that contained bumpmaps in their materials and those which don’t.
On the bumpmaped I’ve added a little reflection to the floor and as you can see it became rendered pretty well too.


4 Responses to “Developing Unity Lightmapping tools NO. 1 : FBX Exporter”

  1. Q: How much time have you spent rendering the images! and shall it be rendered in real time?

  2. Well, I’m not sure if your’re familiar with the lightmap concept – traditionally the lightmaps are being rendered once, before game production and mainly on static elements of the game leval.
    It can take even a whole night rendering your scene, depanding on amount of realism you want to achieve and how clever your set up the rendering options ๐Ÿ˜‰

  3. ooh .. I got it .. but what if I have moving lights in the game!! ๐Ÿ˜›
    or if there is laser guns ๐Ÿ˜€

  4. think about lightmaps as static shadows, so you can “lighten” them later on with additional dynamic lights.
    This kind of solution seems to work out really well – see Mirrors Edge gameplay for instance. The gpu doesn’t have to waste so much of it’s power on light calculations, but if one needs a shadow – for example below the player, it can be done with one of a few simple hacks ๐Ÿ˜‰

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: