PDA

View Full Version : Question About Model Lighting


e-varmint
07-20-2008, 04:19 PM
I added an item to room m02ae_01a by merging it into the model in NWMAX. Once I got it positioned/trimeshed/linked/resetxformed, I exported the geometry and compiled it using mdlops 5.0. I dropped the .mdl and .mdx into override.

I was able to get into the altered area without any problem, and my vending machine was there, but the room was DARK! Since it is not a new area, I assumed that the original lightmaps would still work. Apparently, this is not the case.

Does anyone know preserve the area lighting in a case like this?

TriggerGod
07-20-2008, 04:26 PM
Your gonna need to edit the lightmap of the original model, in this case, m02ae_01, and that'll make your module brighter.
But, I don't believe many people know how to edit lightmaps...

Quanon
07-20-2008, 04:32 PM
IIRC, MDLops doesn't compile lights.

I'm sure there where some light dummys in your G-Max scene when you edited the geometry.

You could also try and compile your model with Kaurora, see if that makes a differance.

Else it might indeed help to try and edit those lightmaps, I believe that gets covered by DI's retexturing a games area tutorial.

e-varmint
07-20-2008, 04:33 PM
Your gonna need to edit the lightmap of the original model, in this case, m02ae_01, and that'll make your module brighter.
But, I don't believe many people know how to edit lightmaps...

It's probably got something to do with the .vis file.

It says this:

M02ae_01a 4
M02ae_05a
M02ae_09a
M02ae_10a
M02ae_12a

I have no idea what it means, though.

IIRC, MDLops doesn't compile lights.

I'm sure there where some light dummys in your G-Max scene when you edited the geometry.

You could also try and compile your model with Kaurora, see if that makes a differance.

Else it might indeed help to try and edit those lightmaps, I believe that gets covered by DI's retexturing a games area tutorial.

I'll give the Kaurora a shot and see what happens.

Edit: No luck so far. This thread, however, may hold the answer:

http://www.lucasforums.com/showthread.php?t=180034

Edit 2: Here's one way to fix it, form the Kaurora readme file.

"put the value "16777215" in the sun diffuse and sun ambient fields in the .ARE file"

I still don't know why the game isn't reading the original lightmapping.

-

magnusll
07-21-2008, 04:56 PM
It's probably got something to do with the .vis file.

It says this:

M02ae_01a 4
M02ae_05a
M02ae_09a
M02ae_10a
M02ae_12a

I have no idea what it means, though.



I'll give the Kaurora a shot and see what happens.

Edit: No luck so far. This thread, however, may hold the answer:

http://www.lucasforums.com/showthread.php?t=180034

Edit 2: Here's one way to fix it, form the Kaurora readme file.

"put the value "16777215" in the sun diffuse and sun ambient fields in the .ARE file"

I still don't know why the game isn't reading the original lightmapping.

-

MDlops doesn't know how to correctly process lightmaps. Kaurora doesn't, either... but this has to do with the fact that I don't know how to correctly export lightmaps from 3DSmax, thus it would be pointless to insert the code handling lightmaps into KAurora without creating a way of exporting those lightmaps from 3dsmax first.

Essentially, a lightmap is nothing more than a second texture applied to the model. It is combined with the first lightmap by color multiplication (the red, green and blue values of each texture for each vertex get multiplied and the resulting value is assigned to the vertex).

Within the trimesh node header, models containing a lightmap have two texture names associated with them, one for the "regular" texture file and one for the lightmap. There's also another field which tells the game what kind of data he can expect to find into the corresponding .mdx file; the specific bit of that field indicating the presence of lightmap tverts values must be set to one. Finally, you need to insert into the .mdx the lightmap tvert values for every vertex in the model... much like what you need to do with regular textures.

KAurora is capable of correctly handling the trimesh header structure and the .mdx structure; what it can't do is to import lightmap tverts data into the binary file, simply because I don't know how to make 3dsmax write the tverts values in the first place; without a format with which to work, I can't write the relevant code. Unfortunately, NWmax doesn't handle lightmaps because they weren't present into Neverwinter Nights; this means an add-on Max script is needed to add lightmap-exporting capabilities to NWMax. But I don't know how 3dsMax creates lightmaps so I can't do the script, thus I can't add the code into Kaurora, thus no lightmaps. Sorry.
[And note that even if I could write the script, you'd still have little luck as Mdlops won't export the original lightmap data, so you'd have to recreate the lightmap. Or wait for me to write code for the "export to ascii" part for KAurora]

The method you cite simply forces the "sun" generic ambient light to white light, thus giving a flat lighting to the whole area. Still better than darkness, though.

e-varmint
07-21-2008, 07:07 PM
............The method you cite simply forces the "sun" generic ambient light to white light, thus giving a flat lighting to the whole area. Still better than darkness, though.

Thanks for the info!!! Now I understand the nature of the problem. The sun settings will do what I need, and I can use the RBG Calculator to generate different shades.

Also, I switched to an outside area and discovered the benefits of turning SunFogOn to 0 (zero) in the .are file. Thanks to Doc Valentine for that extremely useful information from another thread!

-

magnusll
07-22-2008, 05:02 PM
Incidentally: if anyone here wants lightmap-importing capabilities added to Kaurora, and knows how to create a lightmap with 3dsmax, he can contact me sending an appropriate scene file (a stupid square surface with a single light will do) and detailed instructions on how to create the freaking thing.
Note that I have no use for an already generated lightmap; I need to be able to debug the creation process while it's running. This way I'll find where 3dsmax stores lightmap tverts data, I'll write an exporting script, and the corresponding code in Kaurora.