Jump to content

Home

Lightmaps and new areas


magnusll

Recommended Posts

While studying the Kotor lightmap format, I noticed that there are many area model files where there isn't any lightmap to be seen. E.g. lots of Tatooine's area models do not have a lightmap associated with them. Yet you can obviously see everything when you walk in the area.

 

I was wondering if anyone had tried creating a new area from scratch, creating the model and importing it with mdlops, and then creating the walkmesh with the KAuroraEditor, and which problems, if any, you met while trying to use it in the game. Because as far as I can tell, there isn't really a strict necessity of using lightmaps... unless I'm missing something, which is entirely possible.

 

On a somewhat related front, I think I now know how to read the Kotor lightmaps: I've been developing a new version of the editor which is able to render area models, and when I add lightmaps to the texture stages it looks like the correct colors come up... though the lightmap definition looks pretty crappy, to be honest. Unfortunately, Gmax is not able to handle them (lightmapping is part of rendering, and 3DSmax rendering capabilites where one of the things which got stripped down in Gmax). So I'll need to investigate different options for creating (and subsequently importing) lightmaps in Kotor. I'm currently looking at Yafray to see if it's a viable option.

Link to comment
Share on other sites

Hey magnusll ,

 

Last days I've been fiddling around with your little program .

 

So I'm now trying to get my own level model into the game .

 

Its just a plain simple hollow box , I used my kowledge of Saberhilt modelling .

 

So I made a copy of this model , scaled it down and turned it into a WalkMeshModifier.

 

I then just replaced an excisting area model with mine , do note that area models seem to contain lots of dummy objects and by researching into NWmax dummy seem to contain links to kind of files the area uses .

 

Unfortunally Max doesn't show what the dummys contain .

 

Anywayz , the material-palette in Max showed me a very interesting thing about the WalkMesh I imported of the orginal areas of Kotor .

 

Colors seem to say what type of surface things are :

 

Purple = unwalkable

Gray = stone

 

WalkMeshMaterials.jpg

 

and so on ...

 

I'm really thrilled :D

 

 

 

I'm setting up all the files wich I need to create a seperate "new" module and I'll try to force it to use it my mdl and mdx files and edited WalkMesh.

 

Not sure what it will give and I might need some help with this module file thingys ;)

Link to comment
Share on other sites

Yes, if you're using the NWMax scripts you can use the material modifier window to look at which materials are used with the walkmesh objects. There are 20 different types of "walking material"; several of them are unwalkable in Kotor (I seem to recall types 2, 7, and the last ones like lava and snow).

 

The easiest way to build a new area model + walkmesh would be:

 

A) create an AuroraBase

B) create the model (i.e. a square room, a round arena, whatever) as an Editable Mesh

C) link everything to the AuroraBase and export the model with NWMax

D) use mdlops to import it? (don't know if you can do this) and build the .MDL and .MDX files

E) reopen the model, turn it into a Walkmesh, assign face materials, re-link, re-export

F) use KAuroraEditor to build the .WOK file

 

This should give you the .mdl, .mdx and .wok files. Of course the area will suck (no textures yet, for one thing) but it should be usable within the game. To avoid messy things (you still lack a .lyt file, for example) I'd choose an existing area with just one room, copy and edit the relevant files (.ARE etc) to make use of the new files you just made, and rename everything to some mxx_* not used within the game to test it. I seem to remember there are some values you need to look at in the .ARE file within the "map" struct... someone here had once guessed at what they meant, but I can't remember the details.

 

What I do know is that several of the .mdls used as rooms do not have a second texture associated with them, and given that all the second textures I've seen are in the form "xxx_lm_yy" (i.e., lightmaps), I think this points at the fact that lightmaps are not strictly necessary. Case in point: the five models m18ab_xxx (Sand People enclave in Tatooine) do not have any lightmap associated with them. Yet you can see them normally. I guess it has something to do with either the model's ambient color, the area ambient color, or the presence of light objects in the map.

 

Feel free to ask about anything you might need, as given the work I'm doing on the .mdl files I'm starting to become familiar with them. I've also discovered a few as-of-yet mysterious details pertaining to some unknown fields in the files, which hopefully will make me able to get a slightly better result than current mdlops state-of-the-art in .mdl handling.

Link to comment
Share on other sites

Well , I'm going to try and get this working

 

The lighting ambient is avaible in the options in the AuroraMesh modifier in Max .

 

The export went not that smooth , but I've got a .mdl and .mdx .

 

I ran them throw MDlops and they where easly convert to the Binary format .

 

 

I going to see if youre program can now create a .wok of my .mdls

 

And there will be a texture as I used one out of my override

 

I'll try to post as sone if I have more results .

Link to comment
Share on other sites

Well , I'm going to try and get this working

 

The lighting ambient is avaible in the options in the AuroraMesh modifier in Max .

 

The export went not that smooth , but I've got a .mdl and .mdx .

 

I ran them throw MDlops and they where easly convert to the Binary format .

 

 

I going to see if youre program can now create a .wok of my .mdls

 

And there will be a texture as I used one out of my override

 

I'll try to post as sone if I have more results .

 

This is incredibly exciting. It reminds me of when the saber format got cracked. Hopefully things go well for you.

 

Keep us updated! :D

 

_EW_

Link to comment
Share on other sites

Okay , I try something out today in the game .

 

Following my own intuition , I did the following .

 

1) Imported a piece of an area of the Taris Sith Base in MAx.

2) Removed all of its Geometry , replaced it with mine Box.

3) Slightly altered its WalkMesh .

 

4) Exported it , run the .mdl files throw Kauroro ( noticed that the WalkMesh got seriously butcherd in pieces :lol: , allthough I did not at or removed any vertices , just moved them and changed somepart of its material in Max .)

 

5) But I got a .wok file

6) I just putted everything in to my override , fired up Kotor.

 

7) Game didn't crash, I warped to the area , still no crash , just some lag .

 

8) I walked to the piece I changed , the geometry was still the "orginal" of the game but the WalkMesh was altered .

 

I fell into the black , and could walk around a bit , the "new" floor was dirt just like I assigned it in Max , small dust clouds appeared at my feet :p

 

ScreenOfRoom.jpg

 

Anyway , the geometry problem is simple to explain : I did not use MDlops to replace my new Mesh with the "old_original" Meshes .

I tried but the area is build up out of many Meshes so I didn't know wich one to pick to replace my Mesh with it .

 

And MDlops just let me replace one mesh at a time.

 

So far its a small success , the game doesn't crash , Walkmeshes you can be altered .

 

I wish I could just use my own AuroraBase export and not have to use one of an K1 area. THe only thing missing when I export from a new AuroraBase is the .mdx file . How do I get that ??? Is it possible to create one , and what exactly does an .mdx file contain ?

 

I'll have another try at it tomorrow , getting a bit to sleepy now ;)

Link to comment
Share on other sites

The Walkmesh you convert into a .wok file should be identical to the model (or at least to the floor part of the model) which you used to obtain the .mdl and .mdx files. That way the two geometries are the same. The simplest way of doing this would be to select the mesh which contains the floor, clone it, and then turn it into a walkmesh by using the appropriate NWMax modifier. This way you end up having two identical meshes, one is the original floor and the other one is the walkmesh.

 

This however assumes you're able to import the GMax model into Kotor by turning it into and .mdl and an .mdx file... which is the one thing I wasn't sure about regarding mdlops. The .mdx file contains various data belonging to the model's objects' vertices; the exact data varies from model to model, but it's variously composed of:

 

- vertex coordinates (duplicated from the MDL file)

- vertex normals

- tverts from the first texture (if present)

- tverts from the second texture (i.e. the lightmap) (if present)

- bone weights and indices (if present, e.g. in skinmeshes)

 

plus a bunch of unknown data at the end of the vertex structure. As far as I can tell, mdlops *does* produce both files... try to do something like this:

 

- open NWMax

- create an Aurorabase, type "other", name whatever you want

- create something simple to use as the area model... a plane, a box etc.

- convert the object you just created to an editable mesh (button "trimesh" in NWMax general utils)

- clone the editable mesh (edit-->clone, then select clone)

- convert the cloned object to a walkmesh ("modify" button, modifier list, aurora walkmesh)

- select everything

- link (button "fast linker" on general utils)

- export

 

Now you should have an ascii .mdl file containing whatever you created plus its copy in the form of a walkmesh. Now fire mdlops, read the file, then write it - it will generate the .mdl and .mdx files. Then fire KauroraEditor, read the file, generate the binary .WOK.

 

There you go... you now have an .mdl, .mdx and .wok file which are consistent with each other.

Link to comment
Share on other sites

Thx for the help , I already did some of the steps :

 

created a Box-Trimesh,

make copy -> turned into WalkMesh

 

Linked to AuroraBase

 

Main problem is its hard to get it exported , I have to try more then 3 times , I don't get any error messages .

 

And your little program likes to crash on these newly created .mdls , but then again I didn't run it through MDlops .

 

I'll try this out tonight , following your steps preciesly.

 

Thanks again for your support ;)

Link to comment
Share on other sites

And your little program likes to crash on these newly created .mdls , but then again I didn't run it through MDlops .

 

Argh, I just tried it on a newly created model with a plane and you're right, it crashes. There's a bug which makes it crash if there isn't at least one walkable and one unwalkable face.

 

I'll correct the bug; meanwhile, just be sure to give an unwalkable material to at least one of the faces of the walkmesh; that should take care of the problem. You don't need to run the ascii model through mdlops to produce the .wok, by the way; just read the model as exported by NWMax and that should do the trick.

Link to comment
Share on other sites

Okay I did another test run and followed your instructions, things went smooth exporting and making the .wok file.

 

In the game though , I don't get a good result , though this may be because I'm just dumping everything into the override folder and not creating an new area-files.

 

What I get is blackness where there should be my own created room , the walkmesh of this room seems to block my way , so I get the impression the walkmesh works , but my Mesh doesn't get rendered somehow .

 

And I don't have clue how big I should make this room , I used SetEnviron of the NW-tool and set my room about 500cmx500cm and about 210cm height .

 

I made sure my "save-game" was in the part that got Overriden , annoyingly Kotor just spawn me next to my room , not in it , while my coordinates in my save game should put me in the center of it .

 

Ofcourse this could all be cause I'm not using a new area , but I'm not sure how I could set it up properly .

 

As I have no idea how to get the needed coordinates for a spawn point and such .

 

Is there somesort of Spawn-armband I could use ? or is there a cheat to respawn my character at new coordinates ?

 

EDIT : edited the .wok file again and changed the adjacency of the edges .

Weird things is , they didn't change of color .

 

The number was -1 , I entered 2 , I thought this might have helped .

 

Another strange thing to notice is that certain parts of the area dissapear when certain borders are crossed ( mostly doors) .

 

Huge parts are gone , and there's only the black .

Kinda weird , but I think my invisible new mesh is collading or blocking light information or the .lyt got messed up .

 

Not sure , what causes this .

 

I thought I would be able to see my Mesh cause Kotor would use the .vis files and such to "render" my own mesh . Is there a way 3D max might read/import the .vis file from Kotor ? Could I make my .vis own if I added some Aurora-Lights ?

 

EDIT 2 :

 

Made me a new bigger fitting box , it kind of worked , I'm able to walk around somewhat , but if I dare to go closer to another piece of the level or a door , I suddenly pop upwards . And I'm stuck .

 

Not sure if he does it randomlly , as I have no idea where exactly I'm walking on my Walkmesh . The box surrounding it is still invisible .

 

Adding an AuroraDlight did not help , I'm not sure why the orginal .vis does not give light to my mesh as they share the exact name and such .

 

Next I'm going to set-up a new area , or at least have a try at this .

Link to comment
Share on other sites

magnusll, I have to say, what you are doing here is nothing short of revolutionary. This is my most anticipated project.

 

Far greater things may be on the horizon. I wish you the best of luck. Unfortunately, I know so little about lightmaps that I could never be of any serious help, as much as I’d like to.

Link to comment
Share on other sites

About the edge adjacency: yes, changing one of the edges to a value different than -1 should visually turn the edge to red. I'll have a look into this.

 

About the weird results: this is unfortunately not unexpected. It is most likely the result of trying to "fit" a new area model into an area which was not made for it. There are various other files which are used by the game engine when it renders an area:

 

- lyt; describes the layout (i.e. the relative positions) of the various area models (let's call them "rooms", even though it is not completely correct) which form an area, along with a bunch of other positions (like doors). This is just a text file, you can open one with notepad to check the structure

- vis; describes which rooms you can see when you're in another room. Text file.

- are; this contains several fundamental pieces of data used by the game while building the area as a whole; there is the list of rooms, just to name one thing; but you can also find a "Map" structure containing some sort of global coordinates / values, along with several color values like "SunAmbientColor", "SunDiffuseColor" etc. GFF file.

 

You may want to check out this thread, which contains a link to a tutorial used to build a new area starting from an existing one; it's a bit outdated but it still contains very good info on what you need to insert a new area into the game:

 

new module tutorial thread

Link to comment
Share on other sites

- lyt; describes the layout (i.e. the relative positions) of the various area models (let's call them "rooms", even though it is not completely correct) which form an area, along with a bunch of other positions (like doors). This is just a text file, you can open one with notepad to check the structure

- vis; describes which rooms you can see when you're in another room. Text file.

- are; this contains several fundamental pieces of data used by the game while building the area as a whole; there is the list of rooms, just to name one thing; but you can also find a "Map" structure containing some sort of global coordinates / values, along with several color values like "SunAmbientColor", "SunDiffuseColor" etc. GFF file.

 

 

These might be "linked" to the actual model by the dummy objects .

I looked up some info about NWN module editing , looks like these dummy contain certain info needed by the "model-object" ( whatever it is : a head , part of a level) .

 

Sad thing is , when you select a dummy in Max , you can't see any info on what it orginaly contained .

 

Perhaps if I kept the dummys things might go better .

 

Don't know what you think of this and I'm sure you noticed these things aswell or know more on what they are and what they do :)

Link to comment
Share on other sites

These might be "linked" to the actual model by the dummy objects .

I looked up some info about NWN module editing , looks like these dummy contain certain info needed by the "model-object" ( whatever it is : a head , part of a level) .

 

Sad thing is , when you select a dummy in Max , you can't see any info on what it orginaly contained .

 

Perhaps if I kept the dummys things might go better .

 

Don't know what you think of this and I'm sure you noticed these things aswell or know more on what they are and what they do :)

 

As far as I can tell, the dummy objects are just used as containers i.e. they mostly are at the root of a hierarchy of nodes in a model. They are auto-generated by NWMax when you export the model using the scripts; if you open the file with wordpad, you'll see the first node generated is always a dummy node.

 

For example model m46aa_01a (the Rakatan mind prison) is composed of 5 nodes; the first one is a dummy, then there's the actual room, the walkmesh (dubbed "Object01"), and two auroralights. The dummy node does not seem to contain any info which is then replicated in the .ARE file (which is contained in ebo_m46ab.rim, BTW... the names do not match for some reason).

Dummy nodes have very few significant info in them, generally speaking; in this case, it has a position of (0, 0, 0) and a rotation of (1, 0, 0, 0) which are the default "neutral" values... apart from that, it is mostly composed of a bunch of pointers to its children (the other 4 objects) where you can find the interesting stuff. If you have a look at m46aa.are, the stuff in it (especially the info in the "map" structure) doesn't seem to have anything to do with those values. They look like informations on boundaries and scale to me, but I'll need to have a closer look into it at some point.

 

The Rakatan mind prison is another one of those areas where there isn't any lightmap in sight, BTW; I'd suggest to use it as a starting point for a scratch-built area as it is very simple, having only one room and no doors.

Link to comment
Share on other sites

Okay , I tried to do Darth Insidious Tutorial , wich creates a new area aswell.

 

The link in your proposed Tutorial leads me to the authers site , where I can only find his mods , no sign of his tutorial ??? ( And firefox mangles his site pretty bad )

 

EDIT: Darn I must be getting blind :lol: . I found the tutorial ;) , stupid me !

 

Unfortunally the game crashes when I try to warp to this "new" area . Haven't changed anything of the .mdl and .wok files , they are still the orginal .

So I might have made an mistake in the .are file or something went wrong HEX editing the .mdl .

 

I'll restart and use the Rakatan room , I want this to work !

Link to comment
Share on other sites

Okay , I did some other test today and so far no luck , I can't even walk around again , allthough I'm using the same .wok file in different areas .

 

Are there any .ifo , .are and .git files for m46aa_01a , so far I only found the .mdl and .mdx files with Kotor tool , wich Unk_m40 Rims should I export to manipulate this area ?

 

Or should I use the other thread for my annoying problems ?

Link to comment
Share on other sites

The mysterious box module is called ebo_m46ab. It's one of the Ebon Hawk modules. .git, .are and .ifo are all present.

 

Thanks , I just did a super-fast test , and I got results , YEEEEEEEEEEEESSSS!!!

 

Screen01-1.jpg

 

 

But OMG , my mesh is wrong ! Looks like KotorI mangled the verteces .

And the .wok aswell , can't run around anymore :( , but I see it , aswell a part of the texture I had assigned it .

 

I'll now do a good test-run , as I said above it was rather hasty . And I just picke one of my manny TestBox.mdl and .wok I have hanging around on my HardDisk .

 

But it looks like the end of the tunnel is nearing a bit closer :p

 

EDIT : Why didn't any of you prankster told me m46aa_01a is actual a dome , textured in white :lol: ,

 

okay so I overrided the texture , works fine in game , but the orginal UVW mapping makes it really stretched out ( cause I made one with text on ) and I only see the back color .

 

Funny thing is when I place my new .mdl+mdx ( their pretty big :) ) and .wok all the sudden Kotor uses a white texture again .

 

Not sure if I did something wrong in Max , he should have used the orgina named texture LSF_dream l ... and so I can't tell if now actual uses my files .

 

So far I can run like around , but can't see any clear edges . Allthough my party members spawn very very very far away from me . So I'm like 70% positive I created new area .

 

This far away spawing is caused because the floor has the "door" material assigned .

 

Ofcourse I'll go of now and re-edit my max file .

 

Where getting very close my friends :p

Link to comment
Share on other sites

More news : Look good people !!!

 

Screenshot 01 , the orginal area-model and Walkmesh , texture got edited and has now the "chroom" effect added . You cand see the area is like a cilinder and Carth stands pretty close .

 

This screen was taken just when I "warped" in .

 

Screen03.jpg

 

 

This other screenshot is when I put my own Area-model+Walkmesh into Kotor,

the texture doesn't look like it should , but Carth really stand very very far away ... and I can walk to him , get close again . Takes pretty long time .

 

I drew a circle around him :

 

Screen02-1.jpg

 

 

So what does this say ... I don't know , I would like to scream and shout this is actually the first ever new area-model imported into Kotor I , but then again the texture should not be like this ... and still I can run like a minute untill I reach Carth , wich would indicate that Kotor DOES use my walkmesh

Link to comment
Share on other sites

Wow, you're really getting there. Another step closer... Amazing work!

 

I noticed something else that gives me more certainty that Kotor actually uses my model , there are no more shadows .

 

And this is one of the options I haven't put "on" in 3D-Max in the aurora-trimesh modifier , Render is "on" ( obvisiously) .

 

I'll now check my mdl with a HEX-editor , perhaps I should change the name in there aswell .

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...