Jump to content
The Dark Mod Forums

Exporting models from Blender into TDM


chedap

Recommended Posts

  • 3 months later...

Thanks for updating these scripts chedap. It's great to see that the Blender users aren't being stuck with outdated scripts that only work with ancient versions of Blender.

 

I've taken the liberty of uploading both ASE and LWO scripts to a new GitLab repository here:

 

https://gitlab.com/orbweaver/darkblender

 

I hope you don't feel this is treading on your toes, but such repositories are a better way of sharing code than file sharing links scattered across random forum posts, and allow people to more easily checkout the latest version, as well as tracking any changes that are made. Of course if you would prefer to maintain an "official" repository yourself you are free to do so; the beauty of Git is that changes can easily be pushed and pulled between different people even on different sites.

  • Like 1
Link to comment
Share on other sites

I've updated the ASE exporter for Blender 2.8.

 

I've done some basic testing, confirming that it produces a valid ASE which displays in DarkRadiant with what appears to be the correct texture, but I haven't tested thoroughly to confirm that it is correct in all cases.

 

If any Blender users are trying 2.8 and want to test the new script, it can be found in the blender-2.80 branch of my repository:

 

https://gitlab.com/orbweaver/darkblender/tree/blender-2.80

  • Like 3
Link to comment
Share on other sites

  • 3 weeks later...

Hmmm, unfortunately Im getting an error when I try to start a map using a model I exported with the ASE 2.8 script. The model shows up fine in DR, but the dmap and map commands crash with the error: MESH _NUMTVFACES != MESH _NUMFACES.

 

Heres the model if you wanna test it on your side (just drop it in your project folder): https://1drv.ms/u/s!AtiNx4pGNqbmbe32GXV7-iomjLY

Link to comment
Share on other sites

Working perfectly now, my friend! Thank you guys for this. 2.8 is a lot better to work with and its great (and important) to have scripts that keep tdm up to date with whats going on.

 

PS: Orb I had a typo in the material file for that model, I also had to get rid of the shadow mesh as it was sticking out visibly in several places, but its fixed and looking good here on my side now.

 

Will be checking lwo next.

Edited by RPGista
Link to comment
Share on other sites

Working perfectly now, my friend! Thank you guys for this. 2.8 is a lot better to work with and its great (and important) to have scripts that keep tdm up to date with whats going on.

I agree, I really like the new 2.8 interface. It is so much more professional and dicoverable for newer users.

 

PS: Orb I had a typo in the material file for that model, I also had to get rid of the shadow mesh as it was sticking out visibly in several places, but its fixed and looking good here on my side now.

I didn't actually test with your example model, since I could reproduce the problem even using my simple test cube. The script line which populated the *MESH_TVFACES line was using some weird Blender API variable related to UV stencil layers, for some unknown reason. I changed it to simply count the number of triangles that were already being exported into *MESH_TFACE block.

Link to comment
Share on other sites

  • 3 weeks later...

Hey, here's a very old question: is there a way to circumvent the 64 character limit on filepaths in Blender? I searched around and the only thread on the internet I could find was a Blenderforums one from like 2011, with Orbweaver in it. .ASE is human readable but .LWO isn't, so I can't fix the offending, long texture path post-export. I installed Blender 2.8 beta, but it's still the same there.

  • Like 1

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Link to comment
Share on other sites

Should be possible with something like WinHex, by adjusting the material header reference and then offsetting the bytes by however many extra characters you needed.

 

Would just like to add, according to my tests, LWO vs ASE will save you some MBs on your HDD, but won't actually do much for load-times or performance, AFAIK, incase that was a concern for anyone.

Edited by LDAsh
  • Like 1
Link to comment
Share on other sites

Hey, here's a very old question: is there a way to circumvent the 64 character limit on filepaths in Blender? I searched around and the only thread on the internet I could find was a Blenderforums one from like 2011, with Orbweaver in it. .ASE is human readable but .LWO isn't, so I can't fix the offending, long texture path post-export.

 

I remember asking about that. It was much worse then, because the name limit was only 19 characters, which isn't enough for even the simplest material unless you create deliberately abbreviated material names for your models. At least we have 64 characters now, which seems to fit quite a lot of the TDM materials, but clearly not all of them.

 

I think we can work around it though. R Soul's material manager will actually detect when a loaded material is too long to fit in Blender, and adds it as a custom property. When I finally get time to work on this, I'm thinking I might add support to both the ASE and LWO exporters to use this FullName property if it is set instead of the Blender name, allowing a seamless workflow.

 

Would just like to add, according to my tests, LWO vs ASE will save you some MBs on your HDD, but won't actually do much for load-times or performance, AFAIK, incase that was a concern for anyone.

 

It probably doesn't even save you disk space once the assets get into a PK4 file for distribution, since the ASE will compress very well under ZIP. But it would still be nice to support both formats equally, which I think we can do with sufficient support in the exporters.

  • Like 1
Link to comment
Share on other sites

Thank you for the great work of providing up-to-date exporters and refining them, it really is much appreciated.

 

Unfortunately I can't get any smoothing with the scripts in this thread, though. Got the latest Blender 2.79b and the 2.79 versions of the scripts from Orbweaver's Github and tried various combinations of checkbox settings.

 

Is there maybe something specific I have to do, beyond setting face shading to smooth and ensuring no double vertices? I've seen there was discussion of going either by smoothing groups or vertex normals in this thread.

Link to comment
Share on other sites

Hey, here's a very old question: is there a way to circumvent the 64 character limit on filepaths in Blender? I searched around and the only thread on the internet I could find was a Blenderforums one from like 2011, with Orbweaver in it. .ASE is human readable but .LWO isn't, so I can't fix the offending, long texture path post-export. I installed Blender 2.8 beta, but it's still the same there.

I have two posts on Blender forums about it:

https://blenderartists.org/t/material-name-character-limit-63/1146620

 

And this one on what appears to be the official request forum (or maybe a sort of sinkhole where the Blender devs can filter out all these pesky user requests, or their version of hell banning):

https://blender.community/c/rightclickselect/hGcbbc/

 

 

 

I think we can work around it though. R Soul's material manager will actually detect when a loaded material is too long to fit in Blender, and adds it as a custom property. When I finally get time to work on this, I'm thinking I might add support to both the ASE and LWO exporters to use this FullName property if it is set instead of the Blender name, allowing a seamless workflow.

 

That would be a good idea. When I see a long name has been found, I find the material definition in DR and copy it to a new one with a shorter name which I'll then use normally.

Edited by R Soul
Link to comment
Share on other sites

Unfortunately I can't get any smoothing with the scripts in this thread, though. Got the latest Blender 2.79b and the 2.79 versions of the scripts from Orbweaver's Github and tried various combinations of checkbox settings.

 

Is there maybe something specific I have to do, beyond setting face shading to smooth and ensuring no double vertices? I've seen there was discussion of going either by smoothing groups or vertex normals in this thread.

Weird, I get perfect results using the scripts (dont remember if I actually tried the lwo yet, but the ase works for sure).

 

Aside from setting the shading to smooth, make sure you clear any sharp edges, that you set to auto smooth with a good angle and that you click on Clear Custom Split Normals Data under Geometry Data, that usually needs to be done with imported meshes.

Edited by RPGista
  • Like 1
Link to comment
Share on other sites

Weird, I get perfect results using the scripts (dont remember if I actually tried the lwo yet, but the ase works for sure).

 

Aside from setting the shading to smooth, make sure you clear any sharp edges, that you set to auto smooth with a good angle and that you click on Clear Custom Split Normals Data under Geometry Data, that usually needs to be done with imported meshes.

 

Thank you for sharing these additional steps, it works like a charm now - I do import meshes quite often, and additionally some shading issues I was having went away now that I started playing with the auto-smooth slider. Didn't need to use those settings before, but I believe this is just a more advanced exporter that takes more factors into account.

  • Like 1
Link to comment
Share on other sites

I used a program called Araxis Merge to compare some LWO files, and it seems like there is a character set to determine the length of the material header prefixed to it. Apart from the headers themselves, the rest of the files are identical to each other. There are 2 references at the top and bottom, and if this prefixed character is not corrected, then Radiant doesn't want to play nice. I'm convinced it can be manually edited, but trying to figure out how to "count" the material length needs to be figured out. The reason for it being off by 2 is possibly because of the forward-slashes, or possibly because it's using a couple of other characters to count with.

xmodels/security/pythagorasdetector1
0123456789abcdefghijklmnopqrstuvwx

rmodels/storage/twixsixbarrel1
0123456789abcdefghijklmnopqr

 

Edited by LDAsh
Link to comment
Share on other sites

Perhaps a way of solving it while blender doesnt fix the limit would be to have a separate field inside the exporter menu where you can tell it that X material means X's actual name in the game, so that the exporter will automatically substitute the X name for the actual in game name you defined when you export.

 

Something like this:

 

Material name in blender - 'rock'

In the exporter you set - 'rock' equals 'base/models/darkmod/etc/etc/etc/etc/rock'

 

You would only do this for names that are above the limit, if nothing is set in the exporter, it would simply use the blender material name as normal.

Edited by RPGista
Link to comment
Share on other sites

Perhaps a way of solving it while blender doesnt fix the limit would be to have a separate field inside the exporter menu where you can tell it that X material means X's actual name in the game, so that the exporter will automatically substitute the X name for the actual in game name you defined when you export.

 

That's exactly what my suggestion above is proposing.

 

Such a custom field already exists if you are using R Soul's material manager, since it sets a FullName property on any material it couldn't completely import due to length limitations. If you are not using his material manager, you could set this property manually in the Blender interface.

 

My proposal is that both the ASE and LWO exporters will check for this FullName property and use it (if it is set) in place of the Blender material name. So pretty much exactly what you describe, except the mapping between Doom 3 material name and Blender material name is stored on the material itself, rather than trying to store a large list of material mappings in the exporter settings (which is more cumbersome and probably won't be persisted into the Blender file).

  • Like 1
Link to comment
Share on other sites

I've begun trying to update the material manager to work in 2.8.

 

http://forums.thedarkmod.com/topic/19196-blender-tdm-material-manager-plugin-updated-to-version-230/page-2

 

Question: what's the best way to assign materials/textures in 2.8? My own criteria is whatever requires the fewest steps and that only the diffuse texture is necessary. For me that is: add material, use nodes enabled (by default), set the shader type to 'Diffuse BSDF' (Principled makes things look too shiny), select the circle next to colour and choose Image Texture. Use the buttons underneath to load a next image or choose an existing one. Viewport shading should be 'LookDev', which seems to be the equivalent of 'material' in previous versions.

 

If other people agree that that's the best way to set up materials/textures I can focus my attempts on in. If not I can try to account for other ways too.

  • Like 1
Link to comment
Share on other sites

I've encountered an error with the 2.8 ASE Exporter when exporting a specific model:

xu8dvla2.jpg

 

It only happens with this model, other ones export just fine. Also, i can export it to ASE with no problems in 2.79.

 

OrbWeaver, do you mind having a look at this?

 

I put the blend file here: https://mega.nz/#!UBY0DCoZ!ndbCrVJRhAA5eUinBOvoD7AhByMjOOCLDMM2BlxhA_4

 

Btw, thank you for the updated exporters, much appreciated. :)

Link to comment
Share on other sites

No problem, I'll have a look.

 

I'm not in a position to test right now, but looking at the code on GitLab, I'm guessing that I didn't test this part of the code because it is only activated when the mesh has vertex colours and my test cubes didn't have any.

  • Like 1
Link to comment
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.


  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...