Jump to content


Photo

Exporting models from Blender into TDM

blender lwo export

80 replies to this topic

#51 Arcturus

Arcturus

    Advanced Member

  • Development Role
  • PipPipPip
  • 1647 posts

Posted 08 October 2018 - 12:14 PM

No, this .ase exporter exports material name from Blender properly.


It's only a model... /// My channel on YouTube


#52 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 11 January 2019 - 04:48 PM

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/o...ver/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.


  • RPGista likes this

#53 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 15 January 2019 - 04:24 PM

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/o...ee/blender-2.80


  • nbohr1more, RPGista and VanishedOne like this

#54 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 16 January 2019 - 04:04 PM

The LWO exporter is now also updated for Blender 2.8 (strangely this one was much easier than ASE, although I assumed it was going to be more complex).

Same branch URL as before.


  • nbohr1more, RPGista and VanishedOne like this

#55 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1667 posts

Posted 18 January 2019 - 11:40 AM

Im migrating to 2.8, working on a few models too, will definitely give these a spin. Thanks a lot for this.



#56 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1667 posts

Posted 05 February 2019 - 07:04 PM

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!...be32GXV7-iomjLY



#57 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 06 February 2019 - 04:53 AM

Sure, I'll test. It didn't occur to me that the game might behave differently from DR, so I didn't actually try bringing the test cubes I exported into the game itself.


  • RPGista likes this

#58 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 09 February 2019 - 09:59 AM

Reproduced, fixed in 9dfdd82e7a7111ce01866cc3abee8e47db104d91.


  • RPGista likes this

#59 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1667 posts

Posted 10 February 2019 - 02:43 PM

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, 10 February 2019 - 02:46 PM.


#60 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 11 February 2019 - 03:51 AM

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.



#61 Spooks

Spooks

    Advanced Member

  • Member
  • PipPipPip
  • 545 posts

Posted 03 March 2019 - 07:23 AM

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.


  • VanishedOne likes this

My FMs: The King of Diamonds (2016)

 

| Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM! |


#62 LDAsh

LDAsh

    Member

  • Member
  • PipPip
  • 97 posts

Posted 04 March 2019 - 04:48 AM

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, 04 March 2019 - 04:57 AM.

  • Spooks likes this

#63 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 04 March 2019 - 07:52 AM

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.


  • VanishedOne likes this

#64 Dragofer

Dragofer

    Modeler

  • Member
  • PipPipPip
  • 607 posts

Posted 04 March 2019 - 01:07 PM

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.

#65 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 04 March 2019 - 02:46 PM

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://blenderartis...imit-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.comm...kselect/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, 04 March 2019 - 02:49 PM.


#66 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1667 posts

Posted 05 March 2019 - 12:21 AM

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, 05 March 2019 - 12:25 AM.

  • Dragofer likes this

#67 Dragofer

Dragofer

    Modeler

  • Member
  • PipPipPip
  • 607 posts

Posted 07 March 2019 - 04:57 AM

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.


  • RPGista likes this

#68 LDAsh

LDAsh

    Member

  • Member
  • PipPip
  • 97 posts

Posted 07 March 2019 - 09:29 AM

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, 07 March 2019 - 09:29 AM.


#69 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1667 posts

Posted 07 March 2019 - 10:38 AM

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, 07 March 2019 - 10:39 AM.


#70 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 08 March 2019 - 09:33 AM

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).


  • RPGista likes this

#71 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1667 posts

Posted 08 March 2019 - 01:26 PM

Good to know you have a feasible workaround designed! This reminds me I should give Rsouls script a go.


Edited by RPGista, 08 March 2019 - 01:30 PM.


#72 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 10 March 2019 - 08:21 AM

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

 

http://forums.thedar...sion-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.


  • RPGista likes this

#73 R Soul

R Soul

    Member

  • Member
  • PipPip
  • 175 posts

Posted 13 March 2019 - 06:20 PM

The Material Manager seems to be working.

http://forums.thedar...der-280-update/



#74 Ralle321

Ralle321

    Member

  • Member
  • PipPip
  • 35 posts

Posted 14 March 2019 - 06:00 PM

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/#!UB...OOCLDMM2BlxhA_4

 

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



#75 OrbWeaver

OrbWeaver

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 7648 posts

Posted 15 March 2019 - 04:41 AM

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.


  • Ralle321 likes this



Reply to this topic



  



Also tagged with one or more of these keywords: blender, lwo, export

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users