Sign in to follow this  
Jorak Uln

Problem with LIGHTS Harbinger

Recommended Posts

as the picture suggests, the lights at the Harbinger are not all glowing.

How can i get the red marked lights in the pic below to glow? 

 

post-11673-0-67407600-1467385892_thumb.png

Share this post


Link to post
Share on other sites

Those specific meshes in the level model would need their self-illum values hex edited.

Ok, so far ive only renamed textures in the mdl files - so i havent done self-ilium yet.

 

The texture to be illuminated  is HAR_Lt01. What exactly do i have to edit to self-ilium the lights?

Share this post


Link to post
Share on other sites

The texture itself is irrelevant, inasmuch as self-illumination is controlled by the mesh. KOTOR only supports one texture per mesh, so level models comprise a whole bunch of separate meshes.

 

In order to change the self-illum for those lights, you need to find the MDL for that particular room/chunk of the level, decompile it, open it up in Max/GMax, and find the mesh/meshes that you need to edit. In this case, the model in question would appear to be 151HAR08.

 

For that room there are two meshes that comprise all the light sections. The ones that consists of the strips between the seats and one doorway offscreen in that pic (the second doorway is part of the adjoining MDL) and already has self-illum enabled is named HAR08_LITE_01. Interestingly, the second mesh that comprises the strips on the ceiling, under the windows, and at either end of the seats is also named HAR08_LITE_01, which is pretty atypical. It does actually have some self-illum, but the colour (which determines intensity) is set at a grey of 80,80,80, instead of the white 255,255,255 like the other mesh.

 

If we compare the two meshes in the ASCII MDL, we can see the first mesh has:

 

selfillumcolor 1 1 1

 

and the second mesh has something like:

 

selfillumcolor 0.313726007938385 0.313726007938385 0.313726007938385

 

Now that we know what we are looking for, we need to extract a copy of the original MDL/MDX and open it up in MDLOps. Hit the Read button, then the View Data button. Expand the Nodes tree to expose the meshes. Normally your mesh (or meshes) would have a unique name, but in this instance we know from the hierarchy that the mesh we are interested in the second one of that name in the list. So scroll down until you get to the second instance of HAR08_LITE_01 (node #18 in this case) and expand it, like so:

 

TSL_Harbinger_Level_Hex_Edit_01_TH.jpg

 

The last 12 bytes of the Controller Data chunk represents the self-illum (0.313726007938385 0.313726007938385 0.313726007938385) values:

 

TSL_Harbinger_Level_Hex_Edit_02_TH.jpg

 

In this case, it equates to a hex value of B2A0A03E B2A0A03E B2A0A03E.

 

If we check the other light mesh (node #15), we can see its self-illum value, 1 1 1, which is what we want to replicate:

 

TSL_Harbinger_Level_Hex_Edit_03_TH.jpg

 

Which equates to a hex value of 0000803F 0000803F 0000803F.

 

Now we can open up 151har08.mdl in a hex editor, and search for the hex string B2A0A03EB2A0A03EB2A0A03E. In this example it's easy, as there is only a single instance:

 

TSL_Harbinger_Level_Hex_Edit_04_TH.jpg

 

It's a simple matter of replacing those bytes with the string 0000803F0000803F0000803F:

 

TSL_Harbinger_Level_Hex_Edit_05_TH.jpg

 

In other cases it may not be so simple. For example if you search for 0000803F0000803F0000803F, you'll find 32 instances in that MDL. So for cases like that, you may need to include surrounding bytes in your search until you find a unique example. In this case, you might use the entire Controller Data chunk, seeing as it is pretty short. For the first light mesh, that would be

 

00000000 AA102FBE 2558E83F AE47A13F 00000000 00000000 00000000 00000000 0000803F 00000000 0000803F 00000000 0000803F 00000000 0000803F 0000803F 0000803F

 

In this case there are two instances of that chunk, but it is fairly easy to spot the one we want by the surrounding bytes. For instance the preceding 64000000 FFFF0100 0D000E00 036EC501, which is the last 16 bytes of the Controllers chunk:

 

TSL_Harbinger_Level_Hex_Edit_06_TH.jpg

 

So there you go, a crash course in hex editing for fun and profit. Here's the hex edited model from the example - http://dpmods.wheb.org/files/kotor/tsl/[TSL]_151HAR08_Self-Illum_Edit.7z

  • Like 3

Share this post


Link to post
Share on other sites

The problem is the easiest way to discover offsets for various information is via compiling slightly different versions of a single ASCII model with MDLOps and comparing them, but MDLOps adds some confusion into the mix because of the way it works. For example, look at this test model compiled with MDLOps:

 

TSL_Harbinger_Level_Hex_Edit_07_TH.jpg

 

The self-illum values are no longer the final bytes of the Controller Data chunk like there were in the above example, instead they are before a (presumed) blank/buffer block and the alpha value. Now for the game this doesn't pose a problem, as the model itself specifies what values can be found at what offsets within the file. But for people blindly hex editing, lack of consistency becomes a serious pain in the ass. It's difficult to make a tutorial saying "do XYZ", because in many situations that may not apply. In other words, the above example is less "here's how you do this" as much as "here's what I did for this specific model".

 

What would be really useful (albeit almost certainly never going to happen) would be some sort of built-in hex editing functionality for the MDLOps Data Viewer. If it identified/labelled select values for a given mesh like self-illum, ambient/diffuse, etc. and 0-1 flags like render, shadow, etc. and let you change their values and save out a new file, that would be great. But like I said, I doubt that is likely to ever happen.

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.

Sign in to follow this