Jorak Uln 458 Posted July 1, 2016 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? Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted July 1, 2016 Those specific meshes in the level model would need their self-illum values hex edited. Quote Share this post Link to post Share on other sites
Jorak Uln 458 Posted July 1, 2016 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? Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted July 1, 2016 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: The last 12 bytes of the Controller Data chunk represents the self-illum (0.313726007938385 0.313726007938385 0.313726007938385) values: 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: 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: It's a simple matter of replacing those bytes with the string 0000803F0000803F0000803F: 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: 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 3 Quote Share this post Link to post Share on other sites
Sith Holocron 2,479 Posted July 1, 2016 DP, you might want to convert that into a tutorial! 1 Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted July 2, 2016 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: 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. Quote Share this post Link to post Share on other sites