Sign in to follow this  

Lightmaps .X

This topic is 4730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, First of all i'd like to note that I'm a stupid artist, so If I'll write something wrong, bare with me. I was wondering how is the easiest way to implend Lightmaps into Game. We are using .x format. Right now I understoud that 2 sets of UVW coords are needed for that, 1 for basic textures and other for Lightmap, .X seems to support only 1... Any help is welcome ;) Thank you for your time, Jyri

Share this post


Link to post
Share on other sites
Hi,

I'll assume that by mentioning '.X' files you're using Direct3D? Thus this answer is dependent on that assumption [grin]

There are a few D3DX methods (ID3DXMesh::CloneFVF()) that will allow you to convert a loaded mesh into a slightly different format. In your case, it could be used to add an additional set of texture coordinates.

You could then gain access to the geometry of the mesh and fill in the missing texture coordinated accordingly. Whether you're doing this just to make some pre-existing lightmaps match up, or just setting up some texture coordinates so that you can then generate your lightmaps in-game doesn't really matter here.

Alternatively, the easiest method would be to author to the initial model so that you can load it straight in with lightmaps included. That would be your area being "a stupid artist" [wink]...

I think thats all I can think of right now, but if you need a more specific answer then let me (us?) know and I'm sure we can help out..

Jack

Share this post


Link to post
Share on other sites
Hi,

Thanks jollyjeffers for replying :) I'm the coder who's working w/ Jyri... Anyways just wanted to clarify the question a bit...

Jyri's using 3DS MAX to create a level for our game, and using the "Render to Texture" feature of MAX to generate the lightmaps. The problem is that, when he saves it to .X format, only 1 set of texture coordinates gets saved because, AFAIK the .X format only supports 1 set. So, for now what I've suggested is, he can save the mesh to .3DS format, then I'll write a tool which extracts the 2nd set of tex coords and saves it so it can be loaded in w/ the original .X mesh.

So... this isn't so much of a programming question, more about what's the best way to get that 2nd set of tex coords, given that the game only supports .X format at the moment. Also, this is more of a 3DS MAX question so this may not be the right forum to ask this... but does anyone know if MAX allows you to make the lightmaps at a lowered resolution? (To conserve memory)

Thanks very much!

roos

Share this post


Link to post
Share on other sites
Personally, I found X files too limited for lightmapped scenery. You basically have to clone your mesh at runtime and stick the second set of texture coordinates into it, either from a different file or by copying it from a second mesh. This will become messy and also doesn't allow for things like space partitioning, so you'd be better off and quicklier done when you roll your own fileformat.

Then for lightmap creation, I would advertise against the lightmap generator from Max. It plain sucks, does a bad job on things like leaking, and the packing algorithm is so efficient it must have been written on a monday (I'm talking Max5, don't know if it has improved yet).
A very good alternative I use myself is Gile[s], it creates wonderful lightmaps with extreme compact packing, and is also very cheap (no spam intended [lol]). It can export to several formats, so converting the data to your own format shouldn't be too hard.

Share this post


Link to post
Share on other sites
Quote:
So, for now what I've suggested is, he can save the mesh to .3DS format, then I'll write a tool which extracts the 2nd set of tex coords and saves it so it can be loaded in w/ the original .X mesh.

I've got a feeling that you're gonna create a whole lot of hassle for yourself if you use this technique in the long run...

Firstly, the .3DS file will be the "better" of the two, so why not just use the one file format foreverything? especially if you have to write a parser for .3DS that extracts the 2nd set of texcoords.

Secondly, with two files with similar data in existance, it's all too easy to get out of sync. I speak from experience on this one - debugged my code for hours, found no errors - eventually found out that two "identical" sets of geometry from different files had (somehow) different vertex orders for a few triangles.

One thing I would suggest looking at (if you haven't already) is to write your own exporter for 3DSMax. I've heard it's not that amazingly difficult - and could well, with a bit of effort, present the best solution to your problem.

hth
Jack

Share this post


Link to post
Share on other sites

This topic is 4730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this