Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Thu Sep 09, 2010 9:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ] 
Author Message
 Post subject: brush format in the .map file
PostPosted: Sat Nov 26, 2005 3:53 pm 
Offline
Quad Damage!
User avatar

Joined: Tue Jun 22, 2004 6:57 pm
Posts: 4779
Location: Green Bay, WI
can someone translate this into english?

Code:
// primitive 13
{
brushDef3
{
  ( 0 0 -1 0 ) ( ( -0.0078124986 0 0 ) ( -0.0000000001 -0.0312499944 0 ) ) "textures/common_trims/c_trim04_slime"
  ( 0 0 1 -32 ) ( ( 0.0000000002 0.0078124977 0 ) ( -0.0312499907 0.0000000008 0 ) ) "textures/common_trims/c_trim04_slime"
  ( 0 -1 0 -704 ) ( ( -0.0078124986 0 0 ) ( -0.0000000001 -0.0312499944 0 ) ) "textures/common_trims/c_trim04_slime"
  ( 1 0 0 -384 ) ( ( -0.0078124986 0 0 ) ( -0.0000000001 -0.0312499944 0 ) ) "textures/common_trims/c_trim04_slime"
  ( 0 1 0 672 ) ( ( -0.0078124986 0 0 ) ( -0.0000000001 -0.0312499944 0 ) ) "textures/common_trims/c_trim04_slime"
  ( -1 0 0 -384 ) ( ( -0.0078124986 0 0 ) ( -0.0000000001 -0.0312499944 0 ) ) "textures/common_trims/c_trim04_slime"
}
}

_________________
Don't take the swine flu shot!


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Sat Nov 26, 2005 4:14 pm 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 6006
Location: Here, not there.
Hmm... at first I would recomend this as a start:
http://www.gamers.org/dEngine/quake/QDP/qmapspec.html

but it looks like you're missing a third set of coord's in there. You've got texture info & the X, Y but no Z.

all 6 sides are there though.

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Sat Nov 26, 2005 5:33 pm 
Offline
Captured the Flag
User avatar

Joined: Sun Aug 29, 2004 11:39 pm
Posts: 1825
I'm going to use a simpler brush for the sake of making it easier to describe and understand. For this I made a simple 128 cube with the caulk texture evenly distributed:

Code:
// primitive 0
{
brushDef3
{
  ( 0 0 -1 0 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk"
  ( 0 0 1 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk"
  ( 0 -1 0 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk"
  ( 1 0 0 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk"
  ( 0 1 0 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk"
  ( -1 0 0 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk"
}
}


-The "Primitive" is the brush number, if you receive an error and it says something is wrong with brush# 134 it would be "// primitive 134" in the map file. It's only for information purposes though.

-brushDef is the type of brush. You'll see brushDef2 and 3 as well as patchDef entries depending on the type of geometry you've added. Although I'm not 100% certain I believe the different "def's" determine if it's a cube, 3 sided, etc.

-The first set of numbers is the texture placement on the face in relation to 0 0 0 of the world.

-The second set of number on the same line is the texture scale and rotation.

-The texture information is pretty self-explanatory hehe.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 27, 2005 12:28 am 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 6006
Location: Here, not there.
pb, I think that's an entity, not a brush.


Code:
// primitive 2
{
brushDef3
{
  ( -0.1240350083 -0.9922778606 0 -1714.65234375 ) ( ( 0.0039062509 0 8.7382469177 ) ( 0 0.00390625 2.25 ) ) "textures/rock/skysand1" 0 0 0
  ( 0 0 0 -1714.65234375 ) ( ( 1637138432 -1817 -1517289472 ) ( 0 0.0038719547 3.7500016689 ) ) "textures/rock/skysand1" 0 0 0
  ( -0.8944270611 0.4472138286 0 -4261.0512695313 ) ( ( 0.0039062509 0 -7.228096962 ) ( 0 0.00390625 2.25 ) ) "textures/rock/skysand1" 0 0 0
  ( 0 0 1 -320 ) ( ( -0.00390625 -0.0000000011 4.59375 ) ( 0.000000001 -0.0039062509 -22.5 ) ) "textures/rock/skysand1" 0 0 0
  ( 0.1208066642 0.9060481787 -0.4055643678 1553.8555908203 ) ( ( 0.0039062509 0 -22.9136924744 ) ( 0 0.00390625 2.5917005539 ) ) "textures/rock/skysand1" 0 0 0
  ( 0.9701424241 -0.2425358891 0 3870.8686523438 ) ( ( 0.0039062505 0 1.0004595518 ) ( 0 0.00390625 1.75 ) ) "textures/rock/skysand1" 0 0 0
}
}


this is a brush in one of my levels. the brush points are first & the texture points are in the end.

Plus, for all my levels primitive 0 is worldspawn. isn't it in yours?

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Sun Nov 27, 2005 2:38 am 
Offline
has joined the game

Joined: Mon Oct 24, 2005 6:31 pm
Posts: 28
Location: Sweden
These are just theories, the math used calculating the resulting geometry is way beyond my abilities, and I have read nothing about the Doom3 map format.

I believe each line in a brush primitive is a plane with texture coordinates.
Here's a sample:
( 0 0 1 -64 ) ( ( 0.015625 0 0 ) ( 0 0.00390625 0 ) ) "textures/canyon/antenna_sprite"

The first 3 numbers is a normal, a threedimensional direction.
The fourth number is a length, away from the 0 0 0 point of the map. Using these values we get a plane, an infinite flat surface in a threedimensional space. I believe the normal faces into the brush.
The fifth and sixth aswell as eighth and nineth numbers define the texture scale and rotation.
The seventh and tenth numbers define texture offset, x and y respectively.

If you manage to read all that stuff, don't flame me, because they're just my own theories.

_________________
- Thermal Fusion


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 27, 2005 3:43 am 
Offline
Very Senior Forum Poster
User avatar

Joined: Sun May 29, 2005 10:02 pm
Posts: 6006
Location: Here, not there.
i would of thought something simular, but some brushes seem to have more numbers (like the one I pointed out).

Has anyone looked in the D3 wiki yet? It might be there. :)

_________________
Fuzzy Logic Inc
PAINTBALL DOOM 3!!!!
Check out my Q2 server! q2server.fuzzylogicinc.com :D
Doom 3, Paintball! d3server.fuzzylogicinc.com


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Sun Nov 27, 2005 8:15 am 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8550
Location: Orlando, FL
Nope. I've been very active on the wiki since we started it and I don't recall seeing any details on the map file format.

However, if and when this is sorted out, it would be a welcome addition.

Here's my contribution...

We start with a simple map that contains nothing more than one cubic brush floating in the void. It's dimensions are 128x128x128 and it's located at 0,0,0 in the world...

Code:
brushDef3
{
  ( 0 0 -1 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 0 1 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 -1 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 1 0 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 1 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( -1 0 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
}


So, let's do some guesswork.

We have a six line definition for a cube. Either each line defines a vertex or a side.

Let's extend one side of the brush 64 units to see what happens...

Code:
brushDef3
{
  ( -1 0 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 1 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 1 0 0 -128 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 -1 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 0 1 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 0 -1 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
}


The first group of numbers has changed. All other elements have stayed the same. Perhaps these numbers are coordinates of some sort?

Let's compare just the first group since those are the only elements that change...

Code:
  Before                After

  ( 0 0 -1 -64 )        ( -1 0 0 -64 )
  ( 0 0 1 -64 )         ( 0 1 0 -64 )
  ( 0 -1 0 -64 )        ( 1 0 0 -128 )
  ( 1 0 0 -64 )         ( 0 -1 0 -64 )
  ( 0 1 0 -64 )         ( 0 0 1 -64 )
  ( -1 0 0 -64 )        ( 0 0 -1 -64 )


Hmmm. Several things indicate that each line defines one side of the brush...

The first three values always are in the range -1 to 1. Perhaps these three numbers represent the normal of a face?

The fourth value appears to represent the location of a face. Note, -64 units from zero or -128 units from zero.

Also note that the fourth value on line three, and only line three, has changed to -128. This coorisponds with amount that the brush was extended aswell as the fact that only one side was moved.

Okay, let's extend the same face another 64 units but this time we'll clip the brush along this face so that it's at a 45 degree angle...

Code:
  Before                After

  ( 0 0 -1 -64 )        ( 0 0 -1 -64 )
  ( 0 0 1 -64 )         ( 0 0 1 -64 )
  ( 0 -1 0 -64 )        ( 0 -1 0 -64 )
  ( 1 0 0 -64 )         ( 0 1 0 -64 )
  ( 0 1 0 -64 )         ( -1 0 0 -64 )
  ( -1 0 0 -64 )        ( 0.7071067691 -0.7071067691 0 -90.5096664429 )


Hmmm...

The first three values are still in the range -1 to 1.

The last line has changed this time. Strange.

Notice on the last line that the first and second value are both exactly the same aside from one being negative? This coorisponds with the first three values of the group representing a normal because those two values could represent a 1:1 slope. In other words, a 45 degree angle, like the one cut with the clipper tool.

Okay, one more thing. Let's extend this clipped side 64 units and compare it to the previous clipped brush...

Code:
  Before                                                After

  ( 0 0 -1 -64 )                                        ( 0 0 -1 -64 )
  ( 0 0 1 -64 )                                         ( 0 0 1 -64 )
  ( 0 -1 0 -64 )                                        ( 0 -1 0 -64 )
  ( 0 1 0 -64 )                                         ( 0 1 0 -64 )
  ( -1 0 0 -64 )                                        ( -1 0 0 -64 )
  ( 0.7071067691 -0.7071067691 0 -90.5096664429 )       ( 0.7071067691 -0.7071067691 0 -135.7644958496 )


Only the last line has changed and of that, only the last value of the group has changed.

This also coorisponds with the first three values of the group representing the normal because only the position of the angled face has changed, not the angle itself.

The last value of the group has changed by 45.2548294067 but I moved the face 64 units. This value has changed with the position so it likely does represent position but it may not be reflected in units.

So, a short summary of what I think is going on so far...

  • Each line of a brushDef coorisponds with a face of the brush.
  • The first three values of the first group represent the normal of a face.
  • The last value of the first group appears to represent the position.


It looks like Thermal Fusion is on the right track.

More to come as I think of new things to test.

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 27, 2005 11:09 am 
Offline
Divine Eternal
User avatar

Joined: Sun Aug 08, 2004 9:37 pm
Posts: 2376
Location: I am in a world of trigger_hurt
I seem to remember that brushes are defined as a series of infinite clipping planes from some old Q2 era article, I guess the syntax could've changed but id brushes are still id brushes, I bet.

_________________
Image Staff
http://www.modwiki.net - wiki resource for all Doom 3 engine-based games.


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Sun Nov 27, 2005 4:02 pm 
Offline
has joined the game

Joined: Mon Oct 24, 2005 6:31 pm
Posts: 28
Location: Sweden
That's what I was saying. The lines define an infinite clipping plane.
One plane for each side, or face if you so like, of a brush.
I'm pretty sure the first three numbers define a normal. And the fourth defines the distance from the origin at which the plane extends.

I'll be back soon with a couple of images to explain my theories.

_________________
- Thermal Fusion


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 27, 2005 5:19 pm 
Offline
has joined the game

Joined: Mon Oct 24, 2005 6:31 pm
Posts: 28
Location: Sweden
The fourth value is infact in units.
On a square axial brush it is quite obvious.
Take a look at the picture below:
Image
This shows a brush like this one:
Code:
brushDef3
{
  ( 0 0 -1 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 0 1 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 -1 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 1 0 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( 0 1 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
  ( -1 0 0 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0
}

As you can see, the plane is offset 64 units along the normal originating from the center of the map.

The same thing goes with the angular brush:
Image
This is very much like the first angular brush rich_is_bored showed.
As you can see in the image, the plane is offset 90.509... units along the normal.
You can use this mathematical rule to find this value: a²+b²=c²
This means c=sqrt(a²+b²). Therefore we get sqrt(64²+64²)=90.509...

So what happens when we extend the angular face 64 more units?
Image
As you can see, you can still find the value if you use the mathematical method above. Only this time the point I measure from is outside the brush. But since the fourth value is the distance from the center of the map along the normal, this is where the plane's "center" would be.
sqrt(96²+96²)=135.764...

These things also kind of show why a brush must be convex, because otherwise the engine/compiler wouldn't know how to build a volume from all the planes.

_________________
- Thermal Fusion


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 4:23 am 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8550
Location: Orlando, FL
Okay. That explains the first grouping of values.

What about the second?..

Quote:
( 0 0 -1 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0


Has anyone noticed what actions in the editor change these values?

I'm thinking possibly UV coordinates since this group contains two sub-groups.

However, if that's the case, what do the four values in each sub-group represent?

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 5:27 am 
Offline
Captured the Flag
User avatar

Joined: Sun Aug 29, 2004 11:39 pm
Posts: 1825
rich_is_bored wrote:
Okay. That explains the first grouping of values.

What about the second?..

Quote:
( 0 0 -1 -64 ) ( ( 0.125 0 0 ) ( 0 0.125 0 ) ) "_emptyname" 0 0 0


Has anyone noticed what actions in the editor change these values?

I'm thinking possibly UV coordinates since this group contains two sub-groups.

However, if that's the case, what do the four values in each sub-group represent?


Yeah, like I posted above; the ( 0 0 -1 -64 ) is the texture placement in relation to 0 0 0 of the world (create a cube 128 in size with an origin dead center and check it, it'll have values of 64 and -64 here).

The rest of the data is the texture scale "( 0.125 " and rotation on the face " 0 0 )


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 6:51 am 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8550
Location: Orlando, FL
No. Read the last few posts.

Especially my last post where there are examples of these values changing. None of which are the result of manipulating texture alignment, scale, or rotation.

The "( 0 0 -1 -64)" is the declaration of an infinite plane.

"0 0 -1" defines the normal of the plane and "-64" is the distance along this normal that the plane rests from the origin.

At anyrate, I've toyed with texture settings a bit and here's what I believe the second group is...

Code:
( (HS ? HA ) ( ? VS VA ) )


HS = Horizontal Scale
HA = Horizontal Alignment
VS = Vertical Scale
VA = Vertical Alignment
? = Rotation

However, the scale values appear to be tied somehow to the rotation value. Changing the rotation of a texture also alters the resulting scale values even though the actual size of the texture hasn't visually changed.

Before I noticed that anamoly I thought the scale values were related to how many times a texture would tile per unit.

For instance, when you apply a texture to a 128x128 face and fit it you end up with the value 0.0078125 which coorisponds with...

1/128 = 0.0078125

Or in english...

Tile 1 time per 128 units.

Apparently it's a bit more complex than that.

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 7:48 am 
Offline
a gun & a nice word
User avatar

Joined: Sat Jan 11, 2003 9:30 pm
Posts: 8550
Location: Orlando, FL
Hey, I just had a thought...

QRadiant is D3 compatable meaning someone knows the details and needs to share.

_________________
Image Staff
Learn something today? Why not write an article about it on modwiki.net?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 4:10 pm 
Offline
Captured the Flag
User avatar

Joined: Sun Aug 29, 2004 11:39 pm
Posts: 1825
Well, I can give you some direction at least. Robert Duffy took id's in-house level editor for Quake 2, QE4, and converted it to QERadiant. I normally don't try to bug anyone there because I know they're usually extremely busy so I won't suggest asking hehe.

Anyway, here's a link to the original Quake .map format. Quite a bit outdated (10 years) but the format has changed only slightly to accomodate a cleaner as well as more diverse layout and more features such as curves and better texture handling not to mention the addition of decimals (go below 1 unit). It made a huge change when Quake 3 was released with the addition of curves although it's hasn't changed significantly with the release of Doom 3/Quake 4 (there are changes but nothing on the scale of Quake 1-Quake 3). In any case it should be still somewhat relevant since the basic structure is somewhat the same with a few obviousl modifications and slight layout changes (textures at the end instead of middle for example.)

The best way to learn the map format short of asking John Carmack himself would be to get the GPL source of Quake 3 and rip it apart. There's tons of documentation using code samples from Quake 3 (mostly copied directly out of the q3map2, BSP and VIS compilers) on the net that explain what and how but it doesn't give a diagram of the map file layout itself with explicit descriptions like the link I posted above.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 8:48 pm 
Offline
Quad Damage!
User avatar

Joined: Tue Jun 22, 2004 6:57 pm
Posts: 4779
Location: Green Bay, WI
wow, thanks guys.

happy friar's link above shows that some things have not changed much since the old quake days!

Each brush statement looks like this:

{
( 128 0 0 ) ( 128 1 0 ) ( 128 0 1 ) GROUND1_6 0 0 0 1.0 1.0
( 256 0 0 ) ( 256 0 1 ) ( 256 1 0 ) GROUND1_6 0 0 0 1.0 1.0
( 0 128 0 ) ( 0 128 1 ) ( 1 128 0 ) GROUND1_6 0 0 0 1.0 1.0
( 0 384 0 ) ( 1 384 0 ) ( 0 384 1 ) GROUND1_6 0 0 0 1.0 1.0
( 0 0 64 ) ( 1 0 64 ) ( 0 1 64 ) GROUND1_6 0 0 0 1.0 1.0
( 0 0 128 ) ( 0 1 128 ) ( 1 0 128 ) GROUND1_6 0 0 0 1.0 1.0
}

That's probably just a bit confusing when you first see it. It defines a rectangular region that extends from (128,128,64) to (256,384,128). Here's what a single line means:

( 128 0 0 ) ( 128 1 0 ) ( 128 0 1 ) GROUND1_6 0 0 0 1.0 1.0
1st Point 2nd Point 3rd Point Texture


Now, you're probably wondering what those last five numbers are. I've listed what they do below:

x_off - Texture x-offset (must be multiple of 16)
y_off - Texture y-offset (must be multiple of 16)
rot_angle - floating point value indicating texture rotation
x_scale - scales x-dimension of texture (negative value to flip)
y_scale - scales y-dimension of texture (negative value to flip)

_________________
Don't take the swine flu shot!


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Thu Dec 01, 2005 12:50 pm 
Offline
has joined the game

Joined: Mon Oct 24, 2005 6:31 pm
Posts: 28
Location: Sweden
The brush plane statements have changed a lot though.
And it seems that the "new map format" in q3radiant uses a similar texture definition on planes. That format however, was only experimental back in those days, and was scarcely used by id.

_________________
- Thermal Fusion


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group