Recommended Posts

There's a guide here by J, but i'm not having much luck with doing them.

i've selected all objects, and i run the auto bake from KOTOR. 

It creates a single lightmap, i save it, i unwrap it and i end up with a terrible looking ground with tons of black triangles.

Not sure the lightmap even looks correct, its just a rather thin horizontal strip on a black texture, 80% is wasted on the pure black.


I was thinking i could give these my own file names in the Lightmap slot (under Main Texture), but that doesn't work. It will only create 233telEA_lm0.tga, so i guess that's the name to go for in all lightmap slots for the objects? 

I am thinking i could skip it completely (adding tons of new trees and various plants to some maps) and while its still an improvement, even without the lightmaps, it would be interesting to see how it looks with proper lightmapping.

Overall it seems like an extremely cumbersome thing to do, to even get it to unwrap is very, very inconsistent, often i can not make it mark the UV so that i can unwrap it (yes, all objects selected). 

Share this post


Link to post
Share on other sites

Lightmaps are arguably the hardest thing in KOTOR modding, both because of the fiddliness of setting them up and baking them in the first place, but also in trying to match the vanilla artistic lighting intent (assuming you are baking vanilla modules). It's a lot more straightforward in custom modules where you don't have pre-existing restrictions.

To the first part, KBlender has made the baking process a hell of a lot better than it used to be in KMax, albeit you have to deal with all of Blender's alien logic for the setup. Since you mentioned UVs, I take it you're not doing this, but it's worth noting that you can't use vanilla lightmap UVs because the bakes will be terrible, even 20 years later at 50+ times the resolution. I gather Bioware baked the maps and then repacked the UVs afterwards for performance reasons on the Xbox, remapping the lightmaps to suit. My experiments with KBlender routinely found issues across UV seams, so my suggestion is to try and keep to contiguous islands as much as the geometry allows. In practice, this means condensing all meshes with shared diffuse textures as much as possible. I'm not sure how you do this in Blender, since I don't use it for modelling. Same with remapping the UVs - no idea how to do it in Blender. To give you an idea of the sort of thing I'm talking about, here's an example from some of my rebake experiments with the "hangar" of the Dantooine enclave. You can see most of the main floor geometry is a single contiguous island to minimise seam artefacts. At the bottom is a comparison of the vanilla maps vs the re-UV'd/rebaked maps.

 

Dantooine_LM_Rebake_Example_01.jpg.ed929a899b635717ee8edad85fc850b3.jpg

 

Dantooine_LM_Rebake_Example_02.jpg.e2d869228271bc1bd701cc149fa4b247.jpg

Share this post


Link to post
Share on other sites

Those are great looking, what an improvement :)

Yeah i dunno, seems too difficult, but i am not very technical, its why i prefer to do textures. 

Do you know if the engine supports vertex painting? i can always fake lightning via that instead, way easier and very fast to do. Not the same results, but its something.

Actually, looking at the original maps, i first thought they had just painted dark blobs under the trees. 

Share this post


Link to post
Share on other sites

The problem with the vanilla lightmaps is that they reduced them down to tiny sizes. In some cases a single room might comprise two or three lightmaps each only 64x64. So whatever quality they were in their raw state (probably not that high res to begin with circa a quarter century ago using 3DS Max 8/9 and Photoshop 6/7), once they crunched them down for the shipped version everything got turned into blobs. It's honestly impressive they look as good as they do, all things considered. But they didn't "paint" them. If you look in the vanilla models you'll like see a bunch of empty null/dummy objects with light names. Those were all the fill lights they used originally to bake the lighting. They presumably got converted to nulls by their exporter since they weren't of an appropriate game type.

As to vertex painting, no. The engine doesn't support displaying any colour information that way. Not that it would help you for lightmaps anyway.

  • Like 1

Share this post


Link to post
Share on other sites

some old games faked shadows with vertex painting, but yeah, not the same thing as lightmaps. 

Share this post


Link to post
Share on other sites

Yeah it's a process but in most cases you need to rewrap with new UVs.

Not only do you need to switch to the secondary UV on every mesh. You have to select each mesh that shares a lightmap and rewrap. Once you do that for every lightmap, you can bake new ones.

Plus you have to adjust the light sources and world background color to get it looking right.

You could also just edit the lightmap manually with an image editor.

Share this post


Link to post
Share on other sites
1 hour ago, J said:

Yeah it's a process but in most cases you need to rewrap with new UVs.

Not only do you need to switch to the secondary UV on every mesh. You have to select each mesh that shares a lightmap and rewrap. Once you do that for every lightmap, you can bake new ones.

Plus you have to adjust the light sources and world background color to get it looking right.

You could also just edit the lightmap manually with an image editor.

do you know how to give new meshes a lightmap? or how to get a lightmap that isn't just the name of the map, which seems to be the default. 

I think the hardest thing for me to understand how different lightmaps would even work for a scene, they overlap in layers? I'm totally new to lightmaps, never used it before.  

all the tedious things can easily be made into a .py script with chatgpt or any other AI, it will give you one in seconds. Like making sure the secondary UV is selected for all meshes, or anything else you need to do manually. As long as you can explain the whole process in great detail (show it screenshots too), it could make a 1-click solution for doing UV-maps, apart from lighting.

I tried and it did read your guide, and looked at the source code, but so far no luck with a 1-click solution, parts of it works really well though, making sure everything is set up correctly. i think where it fails is the files themselves because i can not give it detailed information about how that part even works.

Share this post


Link to post
Share on other sites

They are just a texture. For a new mesh, you can duplicate the texture UV and turn on lightmap in the KOTOR mesh settings. The game engine blends the vertex shading, diffuse texture and the lightmap together (per pixel). 
image.png.7cc52ffa8ccbcee3192dbe17728975ce.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.