Marius Fett 196 Posted June 27, 2022 2 hours ago, DarthParametric said: It's a gazillion times easier than Blender's approach to things certainly, but the results aren't exactly stellar. I've discussed the issues with KMax's OdysseyLight implementation with seedhartha previously and I was lead to believe that KBlender deals with them differently. I figured there was no harm (except loss of sanity points) in seeing what sort of lightmaps Blender could spit out. Which renderer are you using, out of interest? The results with the mental ray renderer are pretty meh, but I’ve seen KotOR lightmaps rendered with Vray which are REALLY high quality. Blender is a totally alien entity to me, so if you manage to make sense of it, good on you! 😆 Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 27, 2022 The problem with KMax is that OdysseyLight radii are all ginormous, so if you try using those you typically just end up with overblown whiteout. My understanding was that KBlender had addressed this, so I was hoping that it would allow for less work. Of course in a lot of cases - like pretty much every single interior module - there's really no option but to create all new lights from scratch, since the in-game lights don't match the baked lighting. If I am forced to go that route then yeah I'll just do it in Max. See for example some of my Ebon Hawk lightmapping experiments. But I thought maybe exterior modules might be doable in KBlender. But not if you can't easily batch bake the maps. Edit: Interesting. I found a batch baking script that sort of works, after a bit of editing on my part. The only problem is that it seems to regularly cause Blender to eventually lock up and become unresponsive at some random point in the process, although I did manage to get it to successfully complete a full run through a level of around 60 meshes twice. Original script here. Modified script: blender-bake-lightmaps.py Not sure if that is of any interest to you @seedhartha. Edit 2: Seems the lockup problems aren't the script, it's Blender not liking something about my system. Quote Share this post Link to post Share on other sites
seedhartha 116 Posted June 28, 2022 18 hours ago, DarthParametric said: Interesting. I found a batch baking script that sort of works, after a bit of editing on my part. Original script here. Modified script: blender-bake-lightmaps.py Not sure if that is of any interest to you @seedhartha. Who would've thought you would be scripting Blender one day 😅 That looks like one way to do it, yes. Although that script does not cover creating UV maps. Is that not what you wanted? Only baking lightmaps onto existing geometry? Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 28, 2022 Nah, as I said a few posts back, new UVs aren't practical. The original script does actually auto-UV if the mesh lacks a second UV set, but I stripped that out. I could create new atlas'd UVs far more easily in Max if it came to that. So batch baking was all I was interested in. After playing around with the script a bit, one thing I discovered is that the baked maps are very washed out. Seems like it applies a pure white material to the mesh first, which is screwing with things. Quote Share this post Link to post Share on other sites
seedhartha 116 Posted June 29, 2022 Okay, I gave it my best shot. In KB 3.5.0 it is now possible to batch bake lightmaps for the whole scene (in Render Properties, set Render Engine to Cycles, then do KotOR Lightmaps -> Bake). Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 29, 2022 So is the "Object '{}' material does not contain diffuse by lightmap node" error complaining about lacking a link to a physical file? Quote Share this post Link to post Share on other sites
seedhartha 116 Posted June 29, 2022 2 minutes ago, DarthParametric said: So is the "Object '{}' material does not contain diffuse by lightmap node" error complaining about lacking a link to a physical file? At the moment it will only work for newly imported models. Or you can try rebuilding material in Object Properties -> KotOR Model Node. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 29, 2022 Ah ok. I tried it with a freshly imported LYT and got this error: Python: Traceback (most recent call last): File "D:\Blender\2.93.9\2.93\scripts\addons\kotorblender\ops\bakelightmaps.py", line 53, in execute bpy.ops.object.bake( File "D:\Blender\2.93.9\2.93\scripts\modules\bpy\ops.py", line 132, in __call__ ret = _op_call(self.idname_py(), None, kw) TypeError: Converting py args to operator properties: : keyword "margin_type" unrecognized location: <unknown location>:-1 Error: Python: Traceback (most recent call last): File "D:\Blender\2.93.9\2.93\scripts\addons\kotorblender\ops\bakelightmaps.py", line 53, in execute bpy.ops.object.bake( File "D:\Blender\2.93.9\2.93\scripts\modules\bpy\ops.py", line 132, in __call__ ret = _op_call(self.idname_py(), None, kw) TypeError: Converting py args to operator properties: : keyword "margin_type" unrecognized location: <unknown location>:-1 Quote Share this post Link to post Share on other sites
seedhartha 116 Posted June 29, 2022 21 minutes ago, DarthParametric said: Ah ok. I tried it with a freshly imported LYT and got this error: Python: Traceback (most recent call last): File "D:\Blender\2.93.9\2.93\scripts\addons\kotorblender\ops\bakelightmaps.py", line 53, in execute bpy.ops.object.bake( File "D:\Blender\2.93.9\2.93\scripts\modules\bpy\ops.py", line 132, in __call__ ret = _op_call(self.idname_py(), None, kw) TypeError: Converting py args to operator properties: : keyword "margin_type" unrecognized location: <unknown location>:-1 Error: Python: Traceback (most recent call last): File "D:\Blender\2.93.9\2.93\scripts\addons\kotorblender\ops\bakelightmaps.py", line 53, in execute bpy.ops.object.bake( File "D:\Blender\2.93.9\2.93\scripts\modules\bpy\ops.py", line 132, in __call__ ret = _op_call(self.idname_py(), None, kw) TypeError: Converting py args to operator properties: : keyword "margin_type" unrecognized location: <unknown location>:-1 Oh, snap. I only tested with latest Blender version. KB 3.5.0 beta2 should have fixed this. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 29, 2022 OK 2.93 didn't seem to be doing anything, just stuck there Not Responding with 0 CPU use. I tried 3.2 and that seems to have successfully completed. Not sure if that is anything to do with KB, or just another manifestation of the lockup issues I described with 2.93 in previous posts. Are you able to specify the output resolution of the bakes anywhere? Seems like it is fixed at 512x512? Quote Share this post Link to post Share on other sites
seedhartha 116 Posted June 29, 2022 Weird, I have no lockup issues in 2.93. Quote seems to have successfully completed You can enable Material Preview shading and set render pass to Diffuse Color. Best way to strip dynamic lighting and shadows, and see only textures. Quote Are you able to specify the output resolution of the bakes anywhere? Bake does not create images, it will output to image of any size. You can resize an image using UV Editing -> Image -> Resize. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted June 29, 2022 26 minutes ago, seedhartha said: Bake does not create images, it will output to image of any size. You can resize an image using UV Editing -> Image -> Resize. Yeah I was aware of that, although not that it could resize them. Interesting. 26 minutes ago, seedhartha said: Weird, I have no lockup issues in 2.93. Something on my end presumably, but I have no idea what. Haven't encountered it with 3.2 yet. I wasn't using that previously because I wasn't aware that KB was compatible with it. Quote Share this post Link to post Share on other sites
CarthOnasty 214 Posted June 30, 2022 Back again with some UV issues (I think). And this could be a Blender/me thing. I have a couple of tris/quads that are coming out mismatched or stretched. I double checked my files and everything looks legit in there. (Viewed with UV Editing: Display Stretch on) Any ideas? Thanks regardless! Quote Share this post Link to post Share on other sites
seedhartha 116 Posted July 1, 2022 In 3.5.1 I have added Rebuild All Materials operator under Object Properties -> KotOR Model. Execute it on every top-level (MDL root) object, if you want to bake lightmaps in pre-existing Blender files. I wanted material setup to stay flexible as a developer, and not have to implement all sorts of heuristics when baking lightmaps. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted July 1, 2022 Just gave it a quick test with a save from the previous version and a test bake ran fine after rebuilding. You might want to add a note to the description about the button being in the OdysseyBase's properties. On a different note, how do you get KBlender to load in a layout's diffuse textures and display them in the viewport? Seems that it doesn't use the Textures directory specified in the Blender preferences. Quote Share this post Link to post Share on other sites
seedhartha 116 Posted July 1, 2022 56 minutes ago, DarthParametric said: how do you get KBlender to load in a layout's diffuse textures and display them in the viewport? Seems that it doesn't use the Textures directory specified in the Blender preferences. Didn't know about this program-wide setting. Currently, you specify absolute or relative paths in Texture Search Paths (importer preferences). Alternatively, copy all textures to where the models are at. Could be a subdirectory. To display textures in viewport, set shading to Material Preview. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted July 6, 2022 On 7/1/2022 at 11:50 AM, seedhartha said: I have added Rebuild All Materials operator Something I have encountered with this is that it also affects walkmeshes, nuking whatever their original individual surface type assignments were. If they are not able to be excluded from this process, it might be worth adding a warning about it. Quote Share this post Link to post Share on other sites
seedhartha 116 Posted July 8, 2022 On 7/6/2022 at 6:45 PM, DarthParametric said: Something I have encountered with this is that it also affects walkmeshes, nuking whatever their original individual surface type assignments were. If they are not able to be excluded from this process, it might be worth adding a warning about it. Oops. Fixed that in 3.5.2. 2 Quote Share this post Link to post Share on other sites
Idekwtp 0 Posted July 10, 2022 I am having an issue where whenever i export an .mdl from blender it gives me the error code 2482. any idea on how to fix this? Quote Share this post Link to post Share on other sites
seedhartha 116 Posted July 10, 2022 1 hour ago, Idekwtp said: I am having an issue where whenever i export an .mdl from blender it gives me the error code 2482. any idea on how to fix this? No idea. Please attach your .blend file. Also, which Blender version? 1 Quote Share this post Link to post Share on other sites
JediArchivist 70 Posted July 23, 2022 On 6/26/2022 at 2:21 AM, seedhartha said: Fully custom models are possible, but it's not going to be that easy. At a minimum, to be able to export this, you need to: Create Empty object Under KotOR Model Node set Type to MDL Root Rename to match exported filename or it could crash Reparent your Mesh object to a newly created Empty object I did what You recommended, now I can export the .mdl and .mdx files, but ran into another issue. If I open the file again in Blender, nothing shows at all (my model is absent). Also, when i try to use my model to replace another one from KOTOR nothing happpens, the regular model remains. cat.blend cat.mdl cat.mdx Quote Share this post Link to post Share on other sites
DarthDrija 16 Posted July 30, 2022 From what I've seen in your blend file, the hierarchy is wrong, the empty object tagged as "MDL root" is parented to the trimesh. Another thing you need to do is set the animation root in the MDL root as that same object. Another problem I see is the poly count, it's too big to export as an .mdl file. A warning will pop up saying that "Int is too big to convert". This can be resolved if you reduce the model into simpler shapes, try using quads remesh, it's located into "Object Data Properties" when selecting a mesh, and set the face count as 5k or something not too big. Quote Share this post Link to post Share on other sites
C Ordo 0 Posted March 5, 2023 Is there any reason why all the textures are black when Im opening the levels? Im opening the levels in blender and all the textures are black, is there a quick way to fix this? Thanks. Quote Share this post Link to post Share on other sites
houthakker888 0 Posted May 20, 2023 I'm getting this assertion on export whenever I change the animation too much: assert all([len(x) == num_points for x in dp_keyframes[1:]]) What does that mean and is it possible to fix it without starting over for like the 5th time? btw, I noticed that keyframes on import don't all line up with Blender's timeframe. Like instead of frame 2, it's frame 2.0001 or something. Ignore this and the animation will be jerky in game, delete imported keyframes or bake action and the above assertion is more likely to happen. Quote Share this post Link to post Share on other sites
seedhartha 116 Posted December 28, 2023 Big upgrade in KotorBlender version 3.8.0. Most importantly: Instead of choosing a normals algorithm on import, KotorBlender now automatically merges vertices with exactly the same position, while storing imported UVs and normals as part of the edge loops. Conversely, when exporting a model, it will split vertices with exactly the same position, but different UVs and normals. This makes modelling much more straightforward, because you don't have to manually join and split vertices every time. One-click lightmap baking is now possible via KotOR → Bake Lightmaps. KotorBlender will automatically prepare object materials for baking, hide non-lightmapped objects and restore everything to normal when finished. Note that, while it works out of the box, you will want to tweak some settings, as described in README. Material import has been rewritten, adding support for environment maps, bump maps and transparent objects. This is effectively how KotOR would look with phyiscally-based renderer. As a bonus, previous version of KotorBlender has added support for loading TPC textures directly, so you don't have to convert them to TGA anymore. As for future plans, I'm considering adding minimap creation tools, and rewriting animation export to enable armature-based edits. 3 Quote Share this post Link to post Share on other sites