Jump to content
The Dark Mod Forums

Exporting models from Blender into TDM


chedap

Recommended Posts

  • 2 weeks later...

Hey chedap, I love the .ase exporter, it defaults to sensible options and gets the material right and outputs smaller files. I exported a new sword model I made, its not that small (around 4k) and it handled that beautifully. However, when I tried bringing in other models I was working on, I got this error while dmapping: "unknown token. 'MESH_FACE10000:' while parsing MESH_FACE_LIST". Obs pointed out it should be something with the exporter, and indeed, changing back to the previous one I was using, the models load in game without problems. Check out his post: http://forums.thedarkmod.com/topic/9082-newbie-darkradiant-questions/page-328?do=findComment&comment=422955 .

If it makes a difference, the models I was importing were on the heavy side, each had several separate meshes and the tris count ranged from around 5k to 15k (they are groups of trees).

 

Hopefully this isnt difficult to fix? Thanks for this, its great work.

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

  • 3 weeks later...

Hi guys - I'm getting my feet wet with modeling, and was hoping maybe someone could help with a couple of questions.

 

I was starting with some base models from D3 to experiment. I was originally using one of the default blender .lwo export scripts, which did not seem to ever set smoothing on export, so unless i edited the materials to use the renderbump command, the models were faceted in game. I switched to the script referenced earlier in this post, and smoothing is definitely now set in the exported .lwo ( Yeah! ), but now I'm having a different issue - I can't seem to set a hard edge. Even if I select a portion of the model and split it off ( select faces then 'Y' to split ), the engine still smooths across that edge. The only way I could find to stop the behaviour was to assign the same material with a different name to the split portion of the mesh. Anyone experience this before? Using Blender 2.77 fwiw. Remove doubles is NOT set on the export script - just the smoothing option is set.

 

My second question is about baking normals ( which is turning out to be a pretty interesting rabbit hole ). I was trying to model a simple cup - ( styrofoam coffee cup ). I made high and low poly models, and baked the normal from the high to the low, and it generally seems to work. The issue I'm having is the seam where the normal map wraps around the cup. Where the halves of the map meet, the normals look obviously inverted on the model in game. I tried splitting the model in half, unwrapping the UV's for half the model to the full texture space, mirroring the half to complete the model, welding the halves together, moving the mirrored UVs off the 0-1 UV map, baking the normal map, then moving the mirrored UVs back. This looks better, but the normals still seem to be wrong when looking at the model from different angles in game. I feel like I'm missing something here, any ideas would be appreciated. Thanks!

Link to comment
Share on other sites

Even if I select a portion of the model and split it off ( select faces then 'Y' to split ), the engine still smooths across that edge.

That would happen if you forgot to remove renderbump command from your material definition.

The issue I'm having is the seam where the normal map wraps around the cup. Where the halves of the map meet, the normals look obviously inverted on the model in game. I tried splitting the model in half, unwrapping the UV's for half the model to the full texture space, mirroring the half to complete the model, welding the halves together, moving the mirrored UVs off the 0-1 UV map, baking the normal map, then moving the mirrored UVs back. This looks better, but the normals still seem to be wrong when looking at the model from different angles in game.

TDM uses DirectX normal maps (Y-). So if you had Blender bake Y+ ones you could see weirdness at the seams, while at a glance it would seem the map is doing its job.

Other than that, could be different things, hard to guess without pictures. Try on a simple sphere: does the issue persist?

Link to comment
Share on other sites

That would happen if you forgot to remove renderbump command from your material definition.

 

You know, when I first read this comment, I thought to myself 'man, what kind of idiot does this guy think I am? I checked the material def a bunch of times!'. Turns out you know exactly what kind of idiot I am - I was editing the wrong material def. :) Fixed it and problem resolved.

 

 

TDM uses DirectX normal maps (Y-). So if you had Blender bake Y+ ones you could see weirdness at the seams, while at a glance it would seem the map is doing its job.

So in blender is it as simple as switching +Y to -Y under bake/swizzle? ( does D3 also use -Y?)

 

Thanks a ton for the help - saved me lots of frustration!

Link to comment
Share on other sites

Glad it helped, both were guesses on my part.

So in blender is it as simple as switching +Y to -Y under bake/swizzle?

Yes, but you don't even have to re-bake the whole thing, just inverting the green channel on an exported image gives the same result (e.g. in IrfanView "Image>Negative>Green channel").

And yes, Doom 3 also uses Y-.

Edited by chedap
Link to comment
Share on other sites

  • 1 month later...

Alright, so I've checked out the four existing .ase importers, and they all could probably work with minimal tweaking, but they're all fairly basic. So this time I decided to write one from scratch.

Download Blender .ASE importer

Supports:
- Transformed meshes (position, rotation, scale)
- Multi-materials / sub-materials
- Smoothing groups (correctly converts to sharp edges)
- Split vertex-per-face normals
- Vertex colors
- UV coordinates, multiple UV channels
- Can turn tris to quads without disturbing split normals
- Can import multiple files at once, grouping meshes per-file
- Can look up textures if the path is the exact match
- Adds image nodes for Cycles (if it's the current renderer)

Limitations:
- Static triangulated meshes only
- Only imports diffuse and specular colors, not transparency, emission, etc.
- Slow when importing hundreds of files with "to quads" and "group objects" checked

- Doesn't use Blender's validate method on meshes, to avoid deleting two-sided surfaces

This is a beta release of sorts. It seems to run smoothly on TDM models and synthetic tests, as well as vanilla D3 & Q4, but I want to run some more tests still. Specifically, I might add quad support and change some material import logic if needed.
In the meantime I'd appreciate any reports of import failures. These would spit out some traceback info to Blender's info bar. I mean this thing (not "system console" or "Python console") - which will also print some non-critical errors encountered while parsing the file. Let me know if you can't explain some of those too.

  • Like 4
Link to comment
Share on other sites

Alright, so I've checked out the four existing .ase importers, and they all could probably work with minimal tweaking, but they're all fairly basic. So this time I decided to write one from scratch.

 

TDM gets its very own ASE exporter? Thats absoutely amazing, man. Youve become our resident file formats expert in no time. I will be sure to check this guy out, as Ive been working with vertex blends and Ive been having difficulties making them work on the lwos Im exprting. Those new features and improvements sound incredible, specially al the attention to normals, which are the most troublesome part of game modelling for me. And the efficiency gains... Huge kudos.

Edited by RPGista
Link to comment
Share on other sites

Actually I also have a question about your lwo exporter. Ive been using it flawlessly and getting consistent results. But I am getting problems with vertex alpha blends using lwos. The model with materials show up but there doesnt seem to be any blending occuring (each section only shows one material). Maybe Im making some simple mistake somewhere along the line, but looking for options inside blender I noticed this function at the botton of the material windows, and thought it would be a good idea to select the vertex map for each mesh before exporting but the button is simply non selectable. You cant change the "none" option. Is this a problem? Or am I missing something?

 

post-8474-0-09311700-1536244025_thumb.jpg

Link to comment
Share on other sites

TDM gets its very own ASE exporter?

Exporter's on the previous page, this one's an importer.

Actually I also have a question about your lwo exporter. Ive been using it flawlessly and getting consistent results. But I am getting problems with vertex alpha blends using lwos.

I only changed a couple of lines in the lwo exporter, it isn't mine.

That said, you should be able to select any of your vertex color layers, like so. Make sure you have some data to export, I guess? I don't really know if the option works, I haven't tested it in lwo's personally (might test it later today)

 

Edit: imported blend_ground.ase from "A House of Locked Secrets", selected vertex color layer, exported it back out as .lwo, seems to be working as expected. Keep in mind that your blend won't show up in DR, only in-game.

Edit of edit: or not. what's up with the bricks showing through where they shouldn't? Will look into it.

Edited by chedap
Link to comment
Share on other sites

Thanks for all the hard work. :)

 

Would you be interested in assisting with this issue:

 

http://bugs.thedarkmod.com/view.php?id=4825

 

(model side changes)?

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Preliminary stuff on lwo vertex colors: you have to export as "idtech-compatible" to have any blending show up in TDM. But it only seems to export boundaries between colors? Or something with the alpha? I don't know, it's weird, and the exporter has a bunch of vertex color-related code commented out. I'll get around to it by the end of the week, but it's not immediately obvious.

Would you be interested in assisting with this issue:

 

http://bugs.thedarkmod.com/view.php?id=4825

Please elaborate on what needs to be done (I don't have access to the referenced thread btw).

I've seen the issue and exchanged some PMs with @stgatilov, although I thought the issue was the same as this one. I've since learned the latter is called the "shadow terminator" problem and is a common occurence in a lot of engines. Maybe it is the same as the one on the tracker, maybe not.

Edited by chedap
Link to comment
Share on other sites

Edit of edit: or not. what's up with the bricks showing through where they shouldn't? Will look into it.

 

Thing is, I cant click on the dropdown at all, it simply wont respond, so I cant choose the vertex color map. The "none" is fixed. I am using version 2.79b (or was it c?), so maybe its some sort of incompatibility... Good to hear you are on the major issue, though.

Edited by RPGista
Link to comment
Share on other sites

What other games even use .lwo? This whole idtech-compatible thing is a bit baffling to me. The "incompatible" files seem pretty compatible with TDM, meanwhile the Blender importer (that ships with it) chokes on them.

So yeah, anyway, I just removed a couple lines and it works, with the added bonus of now being able to export "sharp" vert-per-face colors, like so. Another headscratcher. Downoad here for now, but I guess I'll probably eventually rewrite this one as well.

The "none" is fixed.

I'm on 2.79b, can't reproduce. Are you saying it's actually inactive or that "none" is the only choice in the drop-down selection? Can you try it on another version (or same but fresh)? Just download a zip version, unpack and run, no installation required, won't ruin your configs.

  • Like 1
Link to comment
Share on other sites

You can export those using the modified .ase exporter. With regards to lwo, I don't see vertex normals in the spec. Here's how TDM source code describes handling them:

Calculate the vertex normals. For each polygon vertex, sum the normals of the polygons that share the point. If the normals of the current and adjacent polygons form an angle greater than the max smoothing angle for the current polygon's surface, the normal of the adjacent polygon is excluded from the sum. It's also excluded if the polygons aren't in the same smoothing group.

This seems to confirm what I assumed about lwo smoothing previously: with quads triangulated, smoothing gets skewed at the surface boundaries, since one of adjacent quads is counted twice.

Edited by chedap
Link to comment
Share on other sites

  • 1 month later...

Perhaps it might be useful to keep links for the latest versions of the scripts in the first post. Someone looking for that might have to re-read the whole thread. Or like me, someone who hasn't yet read the whole thread might be wasting time downloading one of the previous ones.

 

I've tried using your ase exporter, but something's wrong. The exported model isn't textured. I'm using R Soul's Material Manager, but it doesn't seem to make a difference.

Nevermind that. Seems like the problem was that I had several UV layers.

Edited by Skaruts

My FMs: By The Cookbook

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  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • 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
×
×
  • Create New...