Jump to content
The Dark Mod Forums

Recommended Posts

Posted (edited)

I've been working on an ASE export script on and off over the past few days and now have something to show for it. The script needs to be placed in the DarkRadiant/scripts/commands folder to show up in the scripts menu.

 

Download

 

It iterates over everything selected and exports all brushes and patches.

 

This should make vertex blending terrain a cinch. Just construct terrain however you please, export it, load it into a modeling program and vertex paint it.

Edited by rich_is_bored
  • Like 2
Posted

I've been working on an ASE export script on and off over the past few days and now have something to show for it. The script needs to be placed in the DarkRadiant/scripts/commands folder to show up in the scripts menu.

 

Download

 

It iterates over everything selected and exports all brushes and patches.

 

This should make vertex blending terrain a cinch. Just construct terrain however you please, export it, load it into a modeling program and vertex paint it.

 

Hm, would it possible to somehow mark the textures to be used and let the exporter vertex-paint it? That would save the "use a modeling program" step, which poses quite a big challange to a lot of users.

"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

Posted

If you're willing to sacrifice per-vertex control then yes the script could be adapted to skip the "use a modeling program" step by looking at the material applied to each face, interpolating vertex colors where there are seams, and exporting a material shader based on the two in use.

 

But that's a very condensed version of the process under ideal conditions. In practice such a script would be very complicated and time consuming to write. If we both started today, you'd probably know how to vertex paint before I finished writing the script.

Posted

If you're willing to sacrifice per-vertex control then yes the script could be adapted to skip the "use a modeling program" step by looking at the material applied to each face, interpolating vertex colors where there are seams, and exporting a material shader based on the two in use.

 

But that's a very condensed version of the process under ideal conditions. In practice such a script would be very complicated and time consuming to write. If we both started today, you'd probably know how to vertex paint before I finished writing the script.

 

Erm, I am trying to use blender for several years now and never got beyond the "install it and try to load a model" step :)

  • Like 1

"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

Posted

Erm, I am trying to use blender for several years now and never got beyond the "install it and try to load a model" step :)

Have you seen my tutorial i posted in this thread?

 

http://forums.thedarkmod.com/topic/10726-blender-for-beginners/page__st__75__p__211417entry211417

 

 

Link to file: http://www.fileshost.com/download.php?id=F02584AD1

 

 

It's only a model...

Posted

 

Looking at it, but I am not sure I want to repeat Fidcals experience ;) But who knows what a week ill at home can create ;)

"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

  • 1 month later...
Posted

If you're willing to sacrifice per-vertex control then yes the script could be adapted to skip the "use a modeling program" step by looking at the material applied to each face, interpolating vertex colors where there are seams, and exporting a material shader based on the two in use.

 

But that's a very condensed version of the process under ideal conditions. In practice such a script would be very complicated and time consuming to write. If we both started today, you'd probably know how to vertex paint before I finished writing the script.

Except that that one script could help thousands to "skip the modeling" who would otherwise each have to learn it individually (which the vast majority won't). :)

 

Anyway, it sounds awesome; I hope you haven't closed that idea off completely.

Posted

^ Hm, also I can't seem to get the script to work. Just tried it out with DR 1.3.0 SVN build (a couple of weeks old) and 2/2 separate tries, neither DR nor Blender 2.49b could open either file properly. DR gave me a placeholder entity instead of the walls and arch I exported, and Blender said it couldn't open it because it wasn't a valid blender file. I don't know if it's a lacking python issue (can Blender import ASE natively yet?), but since it didn't work in DR either, I guess maybe not. Confused. (all the more push for "skip the modeler step" :))

 

Compiled with Python version 2.6.2.

'import site' failed; use -v for traceback

Checking for installed Python... No installed Python found.

Only built-in modules are available. Some scripts may not run.

Continuing happily.

In BPY_call_importloader(name=D:\test_ase2.ase)

 

[EOL]

Posted

I did a few searches but cant really figure what vertex painting does, or why is it better than uv/paint? How is it used in terrains? diffuse maps are applied over that? or does it tell how diffuses apply/and blend? I imagine it like Unwrapping and painting without the unwrap procedure.

Posted

I did a few searches but cant really figure what vertex painting does, or why is it better than uv/paint? How is it used in terrains? diffuse maps are applied over that? or does it tell how diffuses apply/and blend? I imagine it like Unwrapping and painting without the unwrap procedure.

 

If I remember correctly then it's like being able to crossfade multiple textures on a single mesh. Good for fading between grass and a dirt road on terrain for example.

 

 

 

Posted

Yup, its to do with blending.

 

The advantage is that vertex painting is quite fast to do and once you have done it you only need one material declared for the blend. So you dont need to make special UV's and have them added as materials with a finite scale, instead you can take two already made darkmod textures and say "when the vertex is this colour, use this texture", and if the colours change it automatically blends them, a bit like terrain/texture splatting.

Posted

So brush/patch gets exported, vertex paint happens in modeling program(?1?),model is set so it uses the material set up with the blended textures, get it back to doom3(?2?).

 

?1?: how many colors / surfaces can be used? And how does the surface react on blended parts? The material with the blends has its own surfacetype defined that is used on the whole i guess?

 

?2?: does vertex paint info get stored in .obj too?

Posted

I can't speak for how the script works with any version of DarkRadiant currently in SVN. I assume most users are using the pre-compiled version hosted on the website. It's currently at 1.2.2.

 

Anyway, I did notice a small bug with the script and I have corrected it. The link in the first page has been updated.

 

Setting up the script is simple. ase_export.py goes in your DarkRadiant/scripts/commands folder. Once placed there it should appear as a menu item under Scripts the next time DarkRadiant is started.

 

Then it's simply a matter of selecting the geometry you want to export, typing a filename and selecting a directory. You can verify that it worked by viewing the resulting ASE in a text editor. Here's just a small sample of what you should be seeing in the file...

 

*3DSMAX_ASCIIEXPORT	200
*COMMENT "Dark Radiant ASCII Scene Export (*.ase) v0.0.1"
*SCENE {
*SCENE_FILENAME "unnamed.map"
*SCENE_FIRSTFRAME 0
*SCENE_LASTFRAME 100
*SCENE_FRAMESPEED 30
*SCENE_TICKSPERFRAME 160
*SCENE_BACKGROUND_STATIC 0.0000	0.0000	0.0000
*SCENE_AMBIENT_STATIC 0.0000	0.0000	0.0000
}
*MATERIAL_LIST {
*MATERIAL_COUNT 1
*MATERIAL 0 {
	*MATERIAL_NAME "_default"
	*MATERIAL_CLASS "Standard"
	*MATERIAL_AMBIENT 0.5882	0.5882	0.5882
	*MATERIAL_DIFFUSE 0.5882	0.5882	0.5882
	*MATERIAL_SPECULAR 0.9000	0.9000	0.9000
	*MATERIAL_SHINE 0.1000
	*MATERIAL_SHINESTRENGTH 0.0000
	*MATERIAL_TRANSPARENCY 0.0000

 

As for importing it into a modeling application, I have been working on an import script for Blender 2.5. The discussion thread for that is here.

 

@_Atti_:

 

If you're blending between two materials you use greyscale values. Black represents one texture. White represents the other. Values in between represent a mixture of both textures.

 

Color tinting is also possible in which case you can use any color you like. The texture applied to the model will be tinted based on the vertex colors in game.

 

I'm not sure how surfacetypes and sounds are handled on vertex blended surfaces. A member of the mod team will need to comment on that.

 

I don't think OBJ format supports vertex colors. I can't find any documentation suggesting it does. At any rate, you can't use OBJ format in the Doom 3 engine. Only ASE and LWO can be used for static meshes.

Posted

Okay, I installed DR 1.2.2 and the new script, and Blender 2.5 alpha 2 and the importer.

 

The export from DR works, and the import to Blender works (afaict). I cannot re-open the file in DR. Perhaps I'm doing something wrong. I'm just dropping the ASE in our folders and browsing to it like any other model, but I don't recall if there's anything else I must do to set it up first. Can you confirm that you can export ASE and then open it right back up in DR as a model? Not sure what to make of that, since ASE works otherwise. Damn, I guess we're kinda up the creek without a Blender ASE export at this time.

 

Big kudos on this Rich; this is a huge development for TDM mapping (and DR and Blender in general).

 

Edit: BTW, the script seems fine with 1.3.0 as well.

 

 

OT: holy moly the Blender interface has finally changed/updated! (for the better or worse, I don't know!) :blink:

Posted

Nope that's not it. The DR export script converts all geometry to triangles.

 

It never occurred to me to try exporting and then importing entirely within DR. I've always tested this in conjunction with Blender.

 

At any rate I've experienced the same problem. However, it does give a clue in the console.

 

PICO_ERROR: No ASE material exists with id 1
PICO_ERROR: No ASE material exists with id 1
PICO_ERROR: Could not find material/submaterial for id 1/0
PicoModelLoader: Could not load model << models/test/test.ase

 

Apparently DR doesn't like when material id's start at zero. So I opened the file in a text editor and changed...

 

	*MATERIAL 0 {

 

... to ...

 

	*MATERIAL 1 {

 

... and it loaded up without error but not without problems. It appears the normals are inverted and I don't see a texture applied.

 

Oh well I'll sort the bugs out soon enough. Thanks for testing it.

Posted

I've updated the script. The link in the first post has changed.

 

The normals for brushes were inverted and UV coordinates were flipped along the V axis. This along with the "No ASE material exists with id 1" error has been corrected.

 

I have discovered one other issue with textures that I will need to address but the script is mostly functional in it's current state.

 

It seems Doom 3 does not handle textures applied per face. Instead it falls back to textures applied per object. This isn't an issue with patches as you can't apply multiple textures to them. However, it is possible to texture brushes on a per-face basis.

 

I'll need to revise how I'm handling brushes to account for this. Until that happens everything exported will be using the same texture.

  • Like 1
Posted

@rich: some feedback on the script

 

The Good:

Success in DR! See image. I created the brushes, exported, and immediately reopened as a model in DR 1.3.0. The result is happiness.

post-58-127505776696_thumb.jpg

 

The Bad:

The resulting ASE won't import successfully to Blender 2.5 alpha 2. It is shown as the rectangle (and I had to scale it down immensely). Interestingly, the proper working (give or take) arch model shown is from the previous version of your script. So I guess something busted along the way.

post-58-127505815965_thumb.jpg

 

And a couple of suggestions:

-The export Save dialog doesn't query confirm for overwrite of existing files. Fine as is, but users will have to be really careful not to clobber files of same name. Better if it confirmed (if that's possible).

 

-I was unable to name an exported model with the character "o" in it; apparently the dialog is not trapping some hotkeys used by DR. IOW, attempting to export a model as "bob" resulted in a file named "b.ase", and the console (shortcut for "o") opened up. Interestingly, "s" was not a problem (shortcut for surface inspector), so I'm not sure why it is some hotkeys and not others...

Posted

I'm not too concerned with the Blender import script at the moment but point taken. I'll address the problem once I've got this script in a more finalized state.

 

Adding a confirmation dialog to prevent people from overwriting files won't be an issue.

 

As for the dialog not trapping key presses, that is out of my control. I guess I need to file a Dark Radiant bug report.

Posted

Oh, I didn't realize this meant something is wrong with the blender import script; I assumed since your previous export worked but the new one didn't, that it was the exported file itself that had something about it blender wasn't accepting.

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

    • MayheM

      It would be nice to have a link to the forum thread of a mission in download section, rather than having to search for it manually, like on Thief Guild.
      · 0 replies
    • taffernicus

      Anaglypta , floral and damask wallpaper look great in older homes 
      It’s rare to see anyone using “shader not found” wallpaper in their house

       
      · 0 replies
    • Ansome

      Terribly difficult juggling map designing with work, but I'm still alive and chipping away at something very special. I'm actually making a collaboration of sorts with a friend, I make the map itself and he acts as my "Chief Scope Creep Consultant" that checks in every so often to make sure this project isn't getting out of hand. It's a good system!
      · 1 reply
    • JackFarmer

      We don't need artificial intelligence; we need artistic intelligence. 
      Ralf Hütter, Kraftwerk
      · 6 replies
    • taaaki

      The post editor for the dark themes should be working again. Apologies for the inconvenience.
      · 1 reply
×
×
  • Create New...