Jump to content
The Dark Mod Forums

ASE Export Script for Dark Radiant


rich_is_bored

Recommended Posts

I've pushed a new Karmic release which should have the Python module enabled (although I don't actually have Karmic to test on).

 

It works!

 

post-144-127799349018_thumb.jpg

 

That is exciting :wub:

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

@rich: is the script linked in the first post the most recent one? Or do you have a more advanced one on your local system? I'd like to have a look at the script to see if I can optimise a few things, or tweak DR's python API.

 

edit: anyway, here's a slightly tweaked script, which checks for a valid selection and remembers the last used filename and path for exporting the model:

 

ase_export.py.txt

Link to comment
Share on other sites

Cool, I used that one as basis, I guess my one can be used as replacement for it.

 

Are there any open issues with the script? Otherwise I'm happy to ship it alongside DR 1.4.0 by default.

Link to comment
Share on other sites

There are no bugs I'm aware of. You're more than welcome to bundle it with DR.

 

I should mention that the script does not produce valid vertex and face normals. At present it's exporting dummy data. It doesn't seem to impact anyone's ability to import back into DR or even Blender so I'm not terribly concerned with it.

Link to comment
Share on other sites

Ah, the missing vertex normals might explain why the dummy model I exported looks so dark in comparison to worldspawn (left):

 

shot00150.jpg

 

I'll have a look, I don't know ASE too well though.

  • Like 1
Link to comment
Share on other sites

Should smoothing be a toggleable option in the exporter, I wonder?

 

Definitely. Would it be possible that it being rather a boolean, it being a "angle" setting (below angle X, smooth, upwards don't smooth?)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

There are two situations in the current exporter that result in seams. Multi-textured brushes are split wherever the texture changes and misaligned textures result in splits within UV space.

 

Given the only way to apply a texture to a brush is through planar projection, you'll never be able to fully control where the UV seams appear because prior to exporting your ASE, no UV coordinates existed.

 

The sphere greebo posted is a good example of what I'm talking about. Try making a sphere with brushes and then align the textures on all the adjacent faces. It can't be done with planar projection. Stretching and pinching the texture would be required and the map format simply does not support that kind of thing.

 

Giving the user a option to toggle smoothing off altogether is a much more practical option. If more control over the smoothing of faces is required, the resulting object can always be loaded into a modeling application.

Link to comment
Share on other sites

It's not trivial to implement the smoothing though, as the actual *MESH_SMOOTHING token does nothing when written to the ASE file. The actual normals as seen when switching on r_showNormals 1 reveal that it's the vertex normal itself which must be smoothed, i.e. recalculated by the exporter.

 

When exporting a patch from DR to ASE and firing up the map in TDM it's easy to see that the patch normals are smoothed, whereas the exported model has perpendicular ones. Maybe the *MESH_SMOOTHING can be used by the import script in Blender, but when directly using the ASE this doesn't work.

Link to comment
Share on other sites

Ok, here's a version of the exporter including vertex normals:

 

ase_export.py.txt

 

Looks much better in-game now:

 

post-406-127813484529_thumb.jpg

 

Copied this version to http://bloodgate.com/mirrors/tdm/pub/scripts/

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Thanks. The script will be included in the next DR release, so people won't have to download it themselves.

 

That's even better :)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

  • 2 weeks later...

I installed Blender 2.5 alpha and the scripts. The textured test cube I exported from Dark Radiant the other day as an ase imported OK. I didn't do anything in Blender but just exported it again. This imported into Dark Radiant with texture correctly. I'm impressed with that. I was doubtful the texture would be preserved. So this is worth investigating when I have time to see if that can be repeated with what type of DR geometry, with multiple textures, and whether it can be vertex painted to blend textures easily. If that can be reduced to some simple steps like that then perhaps I can do a tutorial in the future.

Link to comment
Share on other sites

  • 2 weeks later...

rich_is_bored, a few questions:

 

* I exporter a simple model with 3 brushes, all of them have the same texture. The ASE however, contains two material references, the first invalid and unused. Manually deleting MATERIAL 0, fixing the MATERIAL count and also changing all MATERIAL REF 1 to MATERIAL REF 0 creates a working model, but this sounds like a bug in the exporter?

* Exporting a model from offset 17000 creates a model where all the faes are offset by this much, too. That means upon import the model is shifted by a lot. It can be worked around by moving the model roughly to 0,0,0 before export, but this can be cumbersome. Would it be possible to let the exporter figure out the center of the modeland shift everything automatically?

* Exporting a model with two textures (wood and caulk) doesn't work either (see point 1), is this a known limitation?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

BTW, The import script works fine in Blender 2.5alpha, but not at all in the new 2.53.0beta.

 

EDIT: Sorry, of course I meant the blender import script, not the DR .ase export script, which this thread is about.

 

I retract this whole post.

Edited by PranQster

System: Mageia Linux Cauldron, aka Mageia 8

Link to comment
Share on other sites

There was a problem with vertex normals exported by this script. I've fixed it and updated the file linked in the first post.

 

Thanx, rich, does this new version also address the issue of the "offset" and the missing materials?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I've made another update. The link in the first post has been updated.

 

The exported model's center is now offset so you don't have to move objects to the center of the map.

 

I was unable to reproduce the extra material problem. I tried exporting three brushes. I also tried exporting some geometry with wood and caulk. No extra materials were found in the ASE. Maybe you can send me a map file with objects prepared to fail?

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

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 5 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...