Jump to content
The Dark Mod Forums

Recommended Posts

Posted

Hmmm, thats a shame, Im working on a coulple of terrain models that have vertex blending... Will be looking foward to the fix.

Posted

I've committed some initial changes to stop the script from crashing when vertex colour information is present in the mesh, however I have not yet tested that the exported vertex colours are correct. You're welcome to try the latest version and see if it does what you expect.

 

EDIT: The results look fairly reasonable I think; at least this more or less matches what I see in Blender.

 

post-254-0-81081400-1553115294_thumb.png

  • Like 2
  • 2 weeks later...
Posted (edited)

I know that this thread is mostly focused on getting LWO and ASE from Blender, but I don't want to make another thread for this one.

 

I downloaded this https://sourceforge.net/p/blenderbitsbobs/wiki/MD5%20exporter/ and tried to check whether it'd work with Blender 2.80.0 and it didn't. I checked the code block by block in Blender's console, most of which resulted in no errors whatsoever until the menu and registering parts, which throwed up a lot of errors:

 

def menu_func_import_mesh(self, context):
    self.layout.operator(
        ImportMD5Mesh.bl_idname, text="MD5 Mesh (.md5mesh)")
def menu_func_import_anim(self, context):
    self.layout.operator(
        MaybeImportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")

def menu_func_export_mesh(self, context):
    self.layout.operator(
        MaybeExportMD5Mesh.bl_idname, text="MD5 Mesh (.md5mesh)")
def menu_func_export_anim(self, context):
    self.layout.operator(
        MaybeExportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
def menu_func_export_batch(self, context):
    self.layout.operator(
        MaybeExportMD5Batch.bl_idname, text="MD5 (batch export)")

def register():
    bpy.utils.register_module(__name__)
    bpy.types.INFO_MT_file_import.append(menu_func_import_mesh)
    bpy.types.INFO_MT_file_import.append(menu_func_import_anim)
    bpy.types.INFO_MT_file_export.append(menu_func_export_mesh)
    bpy.types.INFO_MT_file_export.append(menu_func_export_anim)
    bpy.types.INFO_MT_file_export.append(menu_func_export_batch)

def unregister():
    bpy.utils.unregister_module(__name__)
    bpy.types.INFO_MT_file_import.remove(menu_func_import_mesh)
    bpy.types.INFO_MT_file_import.remove(menu_func_import_anim)
    bpy.types.INFO_MT_file_export.remove(menu_func_export_mesh)
    bpy.types.INFO_MT_file_export.remove(menu_func_export_anim)
    bpy.types.INFO_MT_file_export.remove(menu_func_export_batch)

if __name__ == "__main__":
    register()

 

 

 

 

 

>>> def menu_func_import_mesh(self, context):
...     self.layout.operator(
...         ImportMD5Mesh.bl_idname, text="MD5 Mesh (.md5mesh)")
... def menu_func_import_anim(self, context):
  File "<blender_console>", line 4
    def menu_func_import_anim(self, context):
      ^
SyntaxError: invalid syntax

>>>     self.layout.operator(
  File "<blender_console>", line 1
    self.layout.operator(
    ^
IndentationError: unexpected indent

>>>         MaybeImportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
  File "<blender_console>", line 1
    MaybeImportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
    ^
IndentationError: unexpected indent

>>> 
>>> def menu_func_export_mesh(self, context):
...     self.layout.operator(
...         MaybeExportMD5Mesh.bl_idname, text="MD5 Mesh (.md5mesh)")
... def menu_func_export_anim(self, context):
  File "<blender_console>", line 4
    def menu_func_export_anim(self, context):
      ^
SyntaxError: invalid syntax

>>>     self.layout.operator(
  File "<blender_console>", line 1
    self.layout.operator(
    ^
IndentationError: unexpected indent

>>>         MaybeExportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
  File "<blender_console>", line 1
    MaybeExportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
    ^
IndentationError: unexpected indent

>>> def menu_func_export_batch(self, context):
...     self.layout.operator(
...         MaybeExportMD5Batch.bl_idname, text="MD5 (batch export)")
... 
>>> def register():
...     bpy.utils.register_module(__name__)
...     bpy.types.INFO_MT_file_import.append(menu_func_import_mesh)
...     bpy.types.INFO_MT_file_import.append(menu_func_import_anim)
...     bpy.types.INFO_MT_file_export.append(menu_func_export_mesh)
...     bpy.types.INFO_MT_file_export.append(menu_func_export_anim)
...     bpy.types.INFO_MT_file_export.append(menu_func_export_batch)
... 
>>> def unregister():
...     bpy.utils.unregister_module(__name__)
...     bpy.types.INFO_MT_file_import.remove(menu_func_import_mesh)
...     bpy.types.INFO_MT_file_import.remove(menu_func_import_anim)
...     bpy.types.INFO_MT_file_export.remove(menu_func_export_mesh)
...     bpy.types.INFO_MT_file_export.remove(menu_func_export_anim)
...     bpy.types.INFO_MT_file_export.remove(menu_func_export_batch)
... 
>>> if __name__ == "__main__":
...     register()
...     
Traceback (most recent call last):
  File "<blender_console>", line 2, in <module>
  File "<blender_console>", line 2, in register
AttributeError: module 'bpy.utils' has no attribute 'register_module' 

 

 

I'm not an expert of Blender API (in fact, I passionately hated earlier versions of the software), but I know that it was one of the major changes in 2.80.0 and I wanted to ask if the plugin may work correctly after updating this part.

Edited by Snehk

'What do I care for your suffering?'

Posted

Its more complicated than that. The script will really only work up to version 2.72. If you use it on version 2.79, eveything looks great and the model and animations will go through, but they will actually be corrupted internally. I wasted countless hours trying to make it work before it finally crossed my mind to use an earlier version, because there were no visible errors pointing out the problem. So updating the scripts would probably take a bit more work.

  • Like 2
Posted

I guess that rewriting the scripts would be the best solution.

'What do I care for your suffering?'

  • 2 months later...
Posted

I'm happy to update the script for API changes and bring it into my repository along with the LWO and ASE exports, but I don't have any experience with the MD5 animation system so testing it would be somewhat challenging.

 

Probably the most reliable way to do it would be to get hold of an example BLEND file along with the correct exported result (from earlier Blender versions) and then treating this export as canonical test data which the updated script needs to produce. In fact I should do that with the ASE and LWO scripts too, to make it easier to check for future breakages without having to do a full export and manual inspection in game.

  • 4 weeks later...
Posted

Hi OrbWeaver.

Each time I load Blender, for your ASE and LWO addons the console lists a load of warnings about properties that should be annotations. It doesn't say why, just that they should be.

Warning: class <class name> contains a property which should be an annotation!
...
    assign as a type annotation: EXPORT_OT_ase.filter_glob
    assign as a type annotation: EXPORT_OT_ase.filepath
...
    assign as a type annotation: EXPORT_OT_ase.option_scale

Fortunately all that's necessary is to change the = to a : and the console loses a lot of clutter.

  • Thanks 1
  • 2 weeks later...
  • 1 year later...
  • 2 years later...
Posted

Is there an LWO exporter that works with Blender 3.4.1 ? 

I use some rogue ASE exporter and while it seems to work fine on small low poly models, it seems that it doesn't export properly larger higher poly models :(

Posted

As far as I remember, the engine drops smoothing information from LWO file and applies automatic determination of smooth groups depending on some hardcoded angle.
So I'm not sure these smoothing settings will help in TDM or Doom 3.

Posted
5 hours ago, stgatilov said:

As far as I remember, the engine drops smoothing information from LWO file and applies automatic determination of smooth groups depending on some hardcoded angle.
So I'm not sure these smoothing settings will help in TDM or Doom 3.

Where can I get LWO exporter for Blender 3.4.x to give it a try ?

Posted
On 1/23/2023 at 7:53 PM, stgatilov said:

As far as I remember, the engine drops smoothing information from LWO file and applies automatic determination of smooth groups depending on some hardcoded angle.
So I'm not sure these smoothing settings will help in TDM or Doom 3.

What?! That is news to me, I use .lwo for all my static models and smoothing imports to idtech4 just fine!

Thou I most say, I don't use Blender for anything but MD5 models and still use old Modo 601, the same tool Seneca Menard a idSoftware artist uses, and also use his custom Modo plugging's, that he made public, exactly to streamline making static models for Doom 3 and Rage.

In modo you can set smoothing angle or edge smoothing (hard or soft edge) and it works in idTech 4, perhaps blender and other tools handle .lwo differently? After all modo was made by the same people that created lightwave 3D, so they literally created the .lwo file system.

 

modoex.gif

modoex2.gif

Posted
On 1/23/2023 at 7:27 PM, motorsep said:

Is there an LWO exporter that works with Blender 3.4.1 ? 

As far as I know the most up-to-date one is the script I maintain (there is a single tdm_export script which supports both ASE and LWO export). However I haven't specifically tested with the latest Blender 3.4 series, so it's possible that it will need an update.

On 1/23/2023 at 7:53 PM, stgatilov said:

As far as I remember, the engine drops smoothing information from LWO file and applies automatic determination of smooth groups depending on some hardcoded angle.
So I'm not sure these smoothing settings will help in TDM or Doom 3.

I believe this information is out of date. The problem of LWO losing smoothing information was caused by the Blender exporter itself ignoring object-specific data and enforcing a hard-coded smoothing angle. This is now fixed in my latest version, although the old behaviour is selectable at the time of export if you don't want to deal with object smooth groups. As far as I can recall, when I was testing this, the smoothing options did take effect in the engine (although I couldn't say whether they were 100% mathematically correct).

  • Like 1
Posted
On 1/26/2023 at 9:55 AM, OrbWeaver said:

I believe this information is out of date. The problem of LWO losing smoothing information was caused by the Blender exporter itself ignoring object-specific data and enforcing a hard-coded smoothing angle.

Well, if I look into the code at https://github.com/stgatilov/darkmod_src/blob/trunk/renderer/Model.cpp#L1101
I see that vertices which are almost equal by positions, texcoords and normals, are merged together.
And the constants which control that are r_slopVertex = 0.01, r_slopTexCoord = 0.001, r_slopNormal = 0.02.

On the other hand, it is probably OK.
It does not break convex or concave edges.
And only on mixed-convexity edges of edges with tangential points smoothing can be enforced near tangential points. But only in cases where it is almost zero anyway.

Posted

Actually I might be confusing two different things.

What the latest LWO exporter fixes is the smoothing angle. Previously this was hard-coded at some weird value slightly less than 90°, but this can now be configured to smooth everything, smooth nothing, or use the Autosmooth Angle setting on the object.

I have no idea if explicit smooth groups are supported, or if this is even a thing in Blender.

  • 1 year later...
  • 3 months later...
Posted (edited)

Thanks for this. Btw, the very fine ASE exporter for Blender is also working with the new Blender 4.2. 🙂

In my experience, if Blender gives you an error on export, check that the materials are correctly applied and that the UV map is good.
If it still fails, check the object data properties and delete the VertexColourMap attribute (if there is one). That usually fixes it for me. Blender models made from scratch do not have that attribute set by default, so it isn't usually an issue.

Note that if you import LWO models from Darkradiant to edit in Blender, that they will have a VertexColourMap. Just delete that or your ASE export will fail. Also the imported LWO models often (always?) have duplicate vertices that will need to be deleted in Blender (just select all, hit m and merge by distance).
 

ase_exporter.jpg.a61f03881d5f9b9d965121c8ba492515.jpg

Edited by grodenglaive
Typo
Posted
On 7/27/2024 at 1:28 PM, grodenglaive said:

Thanks for this. Btw, the very fine ASE exporter for Blender is also working with the new Blender 4.2. 🙂

Thanks for testing. I don't rigorously re-test with every new Blender release because most Blender releases don't break the export scripts, although some do obviously (particularly when they make huge changes like removing the whole Autosmooth function).

On 7/27/2024 at 1:28 PM, grodenglaive said:

In my experience, if Blender gives you an error on export, check that the materials are correctly applied and that the UV map is good

Yes, the scripts aren't particularly good at reporting errors unfortunately. I should probably fix that when I have time.

By the way, it's LWO — LightWave Object — not IWO.

  • Like 1
  • 1 month later...
Posted

The ASE importer doesn't work with Blender 4 series nor Blender 3.6. It works in 2.83.9. In newer versions the error message is KeyError: 'bpy_prop_collection[key]: key "Color" not found'

It's only a model...

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

    • Goblin of Akenash

      Goblin-Secrets episode 2 is out now!
       
      · 3 replies
    • Airship-Ballet

      https://www.twitch.tv/airshipballet2 There was a mapping stream here, it's gone now.
      · 8 replies
    • peter_spy

      Stumbled upon a documentary on Enki Bilal, he is one of the most influential comic book artists of my adolescence. English auto-subtitles is rubbish, so you might need to brush up on your French
      · 3 replies
    • Goblin of Akenash

      Today I did a bit of an experiment! I wanted to see if I could get a dark radiant map into garry's mod, the quickest and dirtiest and not-workiest method is "OBJ2VMF" which converts .obj models into VMF files for hammer to then compile, the way its supposed to work is that you input a 6 sided cube and it turns it into a 6 brush room (not exactly ideal for this since that's not how TDM maps work, this honestly would have been a better idea with any thief game from 1 to the one from 2014 since they all work like that) so what ended up happening was that for every brush there was 6 brushes would be ontop of that almost inflating everything in the map like a balloon, map scale was also an issue that I couldn't fine-tune easily either so the scale is way off ontop of everything being inflated making the space inside the map very tiny! anyways heres the result of that and it looks almost nothing like footloose (plus I did add a bunch of random props in gmod for funsies and better visibility since the process involved replacing all the textures with dev ones that look very flat when in full-bright)

      https://streamable.com/ctmh58

      (streamable link will expire in 2 days but I'll have a spoken word version of this post along side the video and other fun images relating to the bsp inflation effect in the next "Goblin Secrets" video next month)
      · 0 replies
    • Frost_Salamander

      @taaaki Wiki seems broken. Main page works but click any link and:

      · 2 replies
×
×
  • Create New...