Jump to content
The Dark Mod Forums
Sign in to follow this  
chedap

Exporting models from Blender into TDM

Recommended Posts

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
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?

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hey, another quick question - does anyone have a link to the current/appropriate .ase import/export script for blender/TDM/D3? Did a quick search but maybe I missed it.

 

Thanks again!

Share this post


Link to post
Share on other sites

Look through the thread, I've modified an existing exporter.

Haven't had the time to dig into importers yet (there are at least 3 out there). Haven't properly tested them either, but I don't think either works with Blender 2.7+

Edited by chedap

Share this post


Link to post
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.

Can I ask if the .ASE export file size is as efficient as .LWO..?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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...)

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...