Author Topic: blender level creator script  (Read 3476 times)

0 Members and 1 Guest are viewing this topic.

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
blender level creator script
« on: March 24, 2015, 06:38:10 PM »
I'm wondering if we could create MAP files within Blender via python scripting.

I've started coding the initial code of the scripts, I'm using this as a reference for the map format: https://modwiki.xnet.fi/MAP_%28file_format%29

how could then the UV coords for the materials be applied? it woudl be great to have the UV pre-established as in any radiant
how would entities be set? maybe create a box and have it a "custom property" announcing it's "spawnclass"?

on the bezier surfaces (patches) blender has a bezier very similar to idtech3/4

well guys what do you think?

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 825
  • Karma: +37/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: blender level creator script
« Reply #1 on: March 24, 2015, 09:45:11 PM »
Blender 2.49 already has a .map exporter.  I don't know if it's compatible with D3 but it does work with Q2/3.  That would be a good start to see how they did that one.

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: blender level creator script
« Reply #2 on: March 24, 2015, 10:33:39 PM »
do you have it? I've been trying to locate the most recent version of it, it should have been in a more modern Blender, but in the current version of Blender it's no longer present in the addons folder.

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 825
  • Karma: +37/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: blender level creator script
« Reply #3 on: March 25, 2015, 06:53:18 AM »
Here's the Blender 2.49b release downloads: http://download.blender.org/release/Blender2.49b/

Just download the one for your OS & install/unzip.   The script has some issues, like not settings verts to the grid all the time, everything is walls (no solid brushes), but it works.

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: blender level creator script
« Reply #4 on: March 25, 2015, 09:03:15 AM »
I've been toying with it, and I see that even the most recent version of that script is for quake 1 / 2 map system

quake 3 used version 2 already that stores the brush info diferently, it stores the brush face with the "face equation" and then a 3X2 matrix for the textures in this implementation:

(plane equation) ( ( xxscale xyscale xoffset ) ( yxscale yyscale yoffset ) ) "material" ?

where the plane equation is 4 numbers: 3 for normal direction and the fourth for the shortest distance to the center of the map

therefore a brush is a mesh defined not by its vertex positions but by the volume inside it's faces

so that means that the "quake map" script is useless

trebor

  • Jr. Member
  • **
  • Posts: 94
  • Karma: +14/-7
  • Boomstick Veteran
    • View Profile
Re: blender level creator script
« Reply #5 on: March 26, 2015, 06:28:03 AM »
I've been working on a new .map format for id Tech 4 for the last weeks. I have an implementation on my private branch that works with polygons instead of brushes like Blender works.
I also modified the map compiler and the collision framework to support it. AAS support is still missing but I think I can figure out that as well.
I was able to build a valid BSP tree using triangles instead of brushes once I figured that dmap bsp surfaces only require windings and not brush sides.
I'm going to merge this back to RBDOOM-3-BFG this or the next weekend. It would be cool if I can get some support in the Blender scripting department.

My plan is to scrap the Radiant level editors completely and the first big important step is done. I thought it would be trivial but it took me another 80 hours to get it done with areaportals and everything.
My branch also features nice .map -> .obj exporters and dmap features -glview that exports several .obj files for BSP / split plane analysis in Blender.

https://www.dropbox.com/s/6vmw0dwlyebih6j/Screenshot%202015-02-23%2014.33.29.png?dl=0

https://www.dropbox.com/s/lewlkqcnduz4qf3/Screenshot%202015-03-11%2000.26.53.png?dl=0


motorsep

  • Hero Member
  • *****
  • Posts: 947
  • Karma: +72/-127
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: blender level creator script
« Reply #6 on: March 26, 2015, 08:48:41 AM »
The effort is admirable, but getting a rid of brush based level design workflow is not wise. Even UE4 will be bringing CSG/BSP geometry back. Rapid prototyping is not possible with models.

AFAIK ETQW made it possible for AAS to use models too, which I think is a way to go. But hey, anyone can do whatever they want with their engines :-)  Good luck trebor.

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: blender level creator script
« Reply #7 on: March 26, 2015, 11:11:23 AM »
Trebor this is great news! I was thinking on adding a new brush token that used definitions for triangles instead of planes, I also think we should maintain the brush system though, because it makes prototyping a level quite easy.

argoon

  • Full Member
  • ***
  • Posts: 243
  • Karma: +17/-79
  • Doom Newbie
    • View Profile
Re: blender level creator script
« Reply #8 on: March 26, 2015, 07:38:34 PM »
I also think removing BSP geometry is not wise, for whats its worth, like others said prototyping is faster, is also easier for a younger modder to mod your game, learning Radiant like tools is easier than learning blender or any other alike 3D app. Is also faster to make your map and see it ingame.

Valve didn't removed BSP they even used it has a template for their terrain system on Source, Epic didn't removed it even on UE 4 (even tho i found its BSP tools to be inferior to Radiant), Cryengine and Unity have tools on the editors that give us the ability to box map (not really BSP).       
« Last Edit: March 26, 2015, 07:40:21 PM by argoon »

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: blender level creator script
« Reply #9 on: March 27, 2015, 12:51:16 AM »
I've found the method by which find the distance between the surface and the origin of the map (the fourth number in the brush surface equation):

Code: [Select]
Find the tangent to the surface. Then find the equation of line perpendicular to the tangent. Substitute the points. You will get the equation of line. Find its intersection with the surface(points). Then find the distance between two points.
now i need to translate this to python and to idtech4 specifics...

motorsep

  • Hero Member
  • *****
  • Posts: 947
  • Karma: +72/-127
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: blender level creator script
« Reply #10 on: March 27, 2015, 08:23:05 AM »
now i need to translate this to python and to idtech4 specifics...

May I ask why do you need this? If you want to make a .map file in blender and then finish it in Radiant (any flavor that works with Doom 3) then it makes no sense, sorry.

If you need some ideas to put your unending energy into a more practical direction, I have a few :-)  Solving "player gets stuck" beyond 32k units around 0 0 0 of the map is one of them. Besides the obvious solutions, there is an unfinished function in physics_player.CPP that suppose to get player unstuck. That would be a really useful fix that would help all :-)

trebor

  • Jr. Member
  • **
  • Posts: 94
  • Karma: +14/-7
  • Boomstick Veteran
    • View Profile
Re: blender level creator script
« Reply #11 on: March 27, 2015, 09:02:03 AM »
My approach is just the next logical consequence because I don't want to maintain any crappy radiant editor and this stuff is to enhance my own productivity on the content production side.
And it only requires a new meshDef primitive definition in the .map file. You can forget to export Blender polygons to brush sides because it has tons of limitations and is error prone.
It is also obsolete because brushes are converted to windings which are equivalent to Blender N-Gons anyway. So it is better to write a .map file that contains meshes with N-Gon faces.


motorsep

  • Hero Member
  • *****
  • Posts: 947
  • Karma: +72/-127
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: blender level creator script
« Reply #12 on: March 27, 2015, 09:04:06 AM »
My approach is just the next logical consequence because I don't want to maintain any crappy radiant editor and this stuff is to enhance my own productivity on the content production side.
And it only requires a new meshDef primitive definition in the .map file. You can forget to export Blender polygons to brush sides because it has tons of limitations and is error prone.
It is also obsolete because brushes are converted to windings which are equivalent to Blender N-Gons anyway. So it is better to write a .map file that contains meshes with N-Gon faces.

Although you already settled with new approach, may I ask if you tried DarkRadiant? (I know it's not a flexible as Blender, but it seems to be the best of Radiants for Doom 3 out there).

BielBdeLuna

  • Full Member
  • ***
  • Posts: 242
  • Karma: +8/-20
  • Doom Newbie
    • View Profile
    • my Github repositories
Re: blender level creator script
« Reply #13 on: March 27, 2015, 11:26:12 AM »
 - dark radiant doesn't compile form me since several builds

 - dark radiant displays strange geometry in the compiled builds due some kind of incompatibility between the intel GPU I have and the new framework they are using

 - my time is for me to waste on whatever I want to waste it to, is what you waste your time worth the time you waste on it?

besides I get a great hardon when I solve maths problems by myself and my findings, and that REALLY suits me... is it ok? do you approve?  ;D

Trebor how do you need data structured in your implementation?
« Last Edit: March 27, 2015, 11:29:26 AM by BielBdeLuna »

motorsep

  • Hero Member
  • *****
  • Posts: 947
  • Karma: +72/-127
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: blender level creator script
« Reply #14 on: March 27, 2015, 11:57:14 AM »
besides I get a great hardon when I solve maths problems by myself and my findings, and that REALLY suits me... is it ok? do you approve?  ;D

Oh, then you will definitely a get double (or even triple) of that by solving collision issues :)

I see your reasons for using Blender (I have similar concerns, but not really due to the same issue you have) as mapping tool.

The fundamental issue of using Blender for mapping (and exporting to .map) isn't the brushes. We already have exporter that sames .map with perfect brush work (Quake 3 .map) and making it saving Doom 3 brushes isn't that hard. The core issue is texturing these brushes, since not only there is no UV map on them, but there are no tools to do texturing in Blender like it's done in Radiant (and exporting proper texture coordinates). Another issue is lights, entities, links and bindings, etc.

« Last Edit: March 27, 2015, 11:59:02 AM by motorsep »