project-navigation
Personal tools

Author Topic: Blender map exporter  (Read 9225 times)

Offline wrwrwr

  • Rookie
  • ***
  • Posts: 19
    • View Profile
Blender map exporter
« on: January 23, 2008, 06:58:43 am »
I present you a script, which (from time to time ;) can export a Blender scene as an UFO map. What started as a small experiment, over time has grown to a nice piece of software. Of course Blender is not a mapping tool, what causes some trouble (basically you have to restrict yourself to a subset of its capabilities), and the exporter adds even more limitations, nevertheless it should already be usable.

Why would you want to use anything other than GTKRadiant? For most the answer is: You wouldn't. But here are some pros of using Blender:

- it's easier to map in a 'non-rectangular' way (Blender has many tools for making complex meshes, however note that the engine directly only supports simple, convex brushes),
- you can use one tool for mapping and modelling,
- you can make use of your experience with Blender, while learning a new tool is not always convenient,
- and last, but not least, Blender has exporters for both Crystal Space and OGRE, so it should be reasonably easy to reexport maps if you ever decide to make the engine switch.

Read a bit of a story: http://www.wrwrwr.org/2008/january/blender-ufo, or jump right to the dowload & documentation (some example maps included): http://www.wrwrwr.org/b2ufo.

Looking forward to some comments,
wrwrwr.



Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Blender map exporter
« Reply #1 on: January 23, 2008, 08:07:39 am »
damn cool piece of work - very nice job, is pathfinding working for the mountain/terrain brushes?

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Blender map exporter
« Reply #2 on: January 23, 2008, 08:11:29 am »
your tutorial text is licensed under...? i would like to copy it to the wiki, too.

Hoehrer

  • Guest
Re: Blender map exporter
« Reply #3 on: January 23, 2008, 11:53:57 am »
Damn, that's nifty. Gotta try that ASAP :)

Werner

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Blender map exporter
« Reply #4 on: January 23, 2008, 12:03:11 pm »
Quote
Note: with the current development version it looks poorly. Somewhere between revisions 13827 and 13837 the terrain started to be much less detailed. Anything that can be done to make it look good again?

Can you please explain a little bit more?

Did you see our terrain support via material systems? http://ufoai.ninex.info/wiki/index.php/Mapping/Materialsystem

Offline wrwrwr

  • Rookie
  • ***
  • Posts: 19
    • View Profile
Re: Blender map exporter
« Reply #5 on: January 23, 2008, 03:23:45 pm »
Sure, you can move it all to wiki, I'll stick to it too. I wouldn't mind a link to my page however :) I may put there some personal todo or I don't know what yet. Added FDL as the text licence, let me know if you need some other.

Attaching a screenshot of the penguins map with the head ufo, a difference is especially visible for the pond. I have a rather old graphics card, maybe it's only me?

As for the path finding, more or less it does; for example on the second map it won't find a path from the bottom to the top, but you can make it in three or four steps. The AI has some glitches with that, but usually it does ok (I've experienced an alien not doing anything, or just moving not shooting a couple of times).

I'm a bit pressed for time till the week end, but I should be able to inspect the material system and do some more coding in a couple of days. Would be good if someone could compile some list of most needed, missing things.

[attachment deleted by admin]

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Blender map exporter
« Reply #6 on: January 23, 2008, 06:02:30 pm »
i suppose it's not only you - are you already using a material for that map? i've only seen this effect with terrain material definition that has the lightmap blended, too

can you please try to nail down the revision even more? (where the artifacts first occured)

Offline wrwrwr

  • Rookie
  • ***
  • Posts: 19
    • View Profile
Re: Blender map exporter
« Reply #7 on: January 23, 2008, 07:47:22 pm »
No, no materials, that's the very map you can get from my page. There's also another issue with it -- if I make the texture bigger (1024x1024, currently 512x512) it loads fine in 2.2, but fails to load with some DRI error with 2.3. (I'm using the open source ati driver from mesa.)

I'll try to reproduce the error and find the exact revision, but it'll also have to wait a bit, sorry for that.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Blender map exporter
« Reply #8 on: January 23, 2008, 07:53:48 pm »
no problem, the revision would really help - but take your time.

thanks

Offline wrwrwr

  • Rookie
  • ***
  • Posts: 19
    • View Profile
Re: Blender map exporter
« Reply #9 on: February 01, 2008, 12:49:55 am »
At last some time to research the texture problem. 13833 looks nice, 13834 not any longer. R_FilterTexture in r_image is causing this. More specifically, setting r_brightness to 1 makes it look ok again.

Might this be due to the fact that the scene is very dim (no sunlight at all) while the texture is mostly white?

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Blender map exporter
« Reply #10 on: February 01, 2008, 12:23:32 pm »
how did you compile the map?

Offline wrwrwr

  • Rookie
  • ***
  • Posts: 19
    • View Profile
Re: Blender map exporter
« Reply #11 on: February 01, 2008, 01:30:26 pm »
./ufo2map base/maps/penguins.map
No errors or warnings of any kind.

Adding the -extra switch doesn't seem to change anything. However a dri error shows up: "[driAllocateTexture:636] unable to allocate texture". This is a bit of another issue. Happens when using large textures. For example, if I make this very texture 1024x1024, it fails to load (appears nearly all black) and those errors are continuously printed (I could've used textures of that size with 2.2 too, but I blame the limited texture memory not being able to accommodate the engine improvements for that.).

The default brightness seems to be set to 1.5, so isn't it expected that bright points end up completely white? I can simply make the image darker and get the expected result with the default settings.

Offline wrwrwr

  • Rookie
  • ***
  • Posts: 19
    • View Profile
Re: Blender map exporter
« Reply #12 on: February 01, 2008, 01:35:58 pm »
Another thing, maybe i should always write some light and ambient setting to the map file? As for the night maps for example?

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Blender map exporter
« Reply #13 on: February 01, 2008, 03:48:37 pm »
some light yes - have a look at the existing map files to get some reasonable values here. the night maps e.g. don't have ambient set. also check angles and color in worldspawn

Offline wrwrwr

  • Rookie
  • ***
  • Posts: 19
    • View Profile
Re: Blender map exporter
« Reply #14 on: February 03, 2008, 02:53:23 pm »
Currently on default it exports with something found on many day maps (light 160, _color 1.0 0.8 0.8, angles 30 210, ambient 0.4 0.4 0.4). This is configurable, but I wanted to add an option to set it to day or night defaults anyway (todo list is growing rather fast :)

But what I wanted to know is, if not writing those light options could cause any trouble? I can output "light 1" or "light 10" or skip it completely or write "ambient 0 0 0" or nothing at all. Would it make any difference?