Page 2 of 3

Posted: Sun Jul 23, 2006 11:52 pm
by HDL_CinC_Dragon
Ive had a long past few days especailly with out sleep in the past 3... and to illustrate that i must revert to an image that we all have seen at least 100 times:

Image

im going to bed for a while... gnight folks, i might wake up tomarrow around 6pm EST lol

Posted: Mon Jul 24, 2006 2:28 am
by Green Beret
Wow 4 post in a row, Do u ever edit a post....j/k :P

Posted: Mon Jul 24, 2006 11:23 am
by HDL_CinC_Dragon
yaaaa I do but i didnt feel like it at the time :D

Posted: Mon Jul 24, 2006 1:14 pm
by HDL_CinC_Dragon
ok, im looking at prefab files i have made in MOHrad and im trying to figure out what all the numbers correspond with, heres what a prefab file for a single 64 x 64x 64 brushlooks like:
{
"classname" "worldspawn"
// brush 0
{
( 88 16 0 ) ( 48 16 0 ) ( 48 -16 0 ) common/origin 0 0 0.00 1 1 16777216 2176 0 surfaceColor -1.000000 -1.000000 -1.000000
( 48 -16 64 ) ( 48 16 64 ) ( 88 16 64 ) common/woodclip 0 0 0.00 1 1 536870912 16544 0 surfaceColor -1.000000 -1.000000 -1.000000
( 32 0 216 ) ( 72 0 216 ) ( 72 0 16 ) common/ladder 0 16 0.00 1 1 0 136 0 surfaceColor -1.000000 -1.000000 -1.000000
( 64 0 216 ) ( 64 32 216 ) ( 64 32 16 ) common/metalclip 0 16 0.00 1 1 536870912 32928 0 surfaceColor -1.000000 -1.000000 -1.000000
( 40 64 216 ) ( 0 64 216 ) ( 0 64 16 ) common/playerclip 0 16 0.00 1 1 65536 2193 0 surfaceColor -1.000000 -1.000000 -1.000000
( 0 64 64 ) ( 0 0 0 ) ( 0 64 0 ) common/caulk 0 16 0.00 1 1 0 160 0 surfaceColor -1.000000 -1.000000 -1.000000
}
}

it couldnt just be like each vertice has the 3 coords or something it had to be some confusing slop of numbers and brackets so i dont know how long it will take me to figure out all the numbers relevance, ive only figured out 11 so far but it gets harder as it goes... so thats just an update for you guys... Ill keep working on this for a long while sooooo yea...


UPDATE=======
= figured out - 14
Numbers not figured out = 40
NUMBERS THAT MAKE NO SENSE!!!! - 22


{
"classname" "worldspawn"
// brush 0
{
( 88 16 0 ) ( 48 16 0 ) ( 48 -16 0 ) common/origin 0 0 0.00 1 1 16777216 2176 0 surfaceColor -1.000000 -1.000000 -1.000000 //BOTTOM
( 40 -16 64 ) ( 40 16 64 ) ( 80 16 64 ) common/woodclip 0 0 0.00 1 1 536870912 16544 0 surfaceColor -1.000000 -1.000000 -1.000000 //TOP
( 32 0 216 ) ( 72 0 216 ) ( 72 0 16 ) common/ladder 0 16 0.00 1 1 0 136 0 surfaceColor -1.000000 -1.000000 -1.000000 //SOUTH
( 64 0 216 ) ( 64 32 216 ) ( 64 32 16 ) common/metalclip 0 16 0.00 1 1 536870912 32928 0 surfaceColor -1.000000 -1.000000 -1.000000 //EAST
( 40 64 216 ) ( 0 64 216 ) ( 0 64 16 ) common/playerclip 0 16 0.00 1 1 65536 2193 0 surfaceColor -1.000000 -1.000000 -1.000000 //NORTH
( 0 64 64 ) ( 0 0 0 ) ( 0 64 0 ) common/caulk 0 16 0.00 1 1 0 160 0 surfaceColor -1.000000 -1.000000 -1.000000 //WEST
}
}

ive got a 64 x 64 x 64 brush compltely zeroed on the axis's so that some of the sides of the brush have a coord of 0, its not in some random location. SO WHERE THE HELL DOES 216 AND CRAP NUMBERS LIKE THAT COME FROM!?!?!

Posted: Mon Jul 24, 2006 2:47 pm
by HDL_CinC_Dragon
from now on, all updates will be posted only on the front page so yea...

face

Posted: Mon Jul 24, 2006 7:48 pm
by tltrude
A face is made of two triangles, so some of the numbers are probably angles.

Posted: Mon Jul 24, 2006 8:29 pm
by lizardkid
you cant save them as obvious numbers because the file ends up being HUGE, first rule in programming is save space. these are probably matrices or something.

jv can tell us!

...when he finds this thread.

Re: face

Posted: Mon Jul 24, 2006 9:58 pm
by HDL_CinC_Dragon
tltrude wrote:A face is made of two triangles, so some of the numbers are probably angles.
but if it were angles and such for two triangles, wouldnt therte only be 2 bracket sets instead of 3?
lizardkid wrote:these are probably matrices or something.
but how would a matrix apply to the brush faces though? and arnt matrices all in one bracket instead of broken up?

[quote="lizardkid], first rule in programming is save space[/quote]
I know :D
lizardkid wrote:jv can tell us!
Yes he can :)

Posted: Tue Jul 25, 2006 12:01 am
by lizardkid
on second inspection it looks like the vertice formation for a brush, each coord refers to a vert in ( X Y Z ), and since a regular brush has only 6 verts and there's six sets of numbers composing brush 0 i'd say thats it, each set of () () () has XYZ coords for a vertice.

and theres the surface texture data to be put on the brushface connected to that vert after that and the color, etc.

as for the 216 stuff remember that any of that (especially on the Z axis) could be relational to other vertices or that that vert could be offset enoguh to have achieved 216... because you only centered one vert on 0 0 0.

now i see why heightmaps were made.

Posted: Tue Jul 25, 2006 12:31 am
by HDL_CinC_Dragon
it sitll dosnt make sense though, i tried to rationalize the number of verts with coords of XYZ but that doesnt add up with the three brackets, and the 216 and stuff like that doesnt make sense becuase my brush doesnt exceed 64 as a coordinate or a size value... it just comes out of no where apparently

Posted: Tue Jul 25, 2006 7:32 am
by jv_map
Yay :) Quake3 brush format = way fun as the numbers don't seem to make any sense at first glance. These numbers do not represent vertices, or angles. Instead, they define 3 'virtual' points per face. These 3 points uniquely define a plane in 3d space. The plane extends to infinity, so the extents of each face are not contained in the definition of each face.

When mohradiant or q3map reads the brush data, it simply calculates the intersections between two planes. The result is an infinitely long line. The only case when 2 infinite planes don't intersect is when they are parallel.

Having determined these infinitely long lines (there will be 12 for a regular (box) brush), the intersections of these lines are determined. Two lines intersect if they are not parallel and lie in a single plane. The intersections of these lines give the brush vertices, and the finite line between them becomes and edge. Voil?, a brush :)

Note that the virtual points that define each plane are rather arbitrary: if you translate them within the plane they define, they still define the same plane. Huh :?. Well, say we're talking about the top plane, and it were defined as:

( 48 -16 64 ) ( 48 16 64 ) ( 88 16 64 ) common/woodclip 0 0 0.00 1 1 536870912 16544 0 surfaceColor -1.000000 -1.000000 -1.000000

You can easily see it is a horizontal plane, as all z-coordinates are equal. This means that you can add any 2 numbers to the x and y coordinates and still get the same plane (and thus the same brush). Note that you have to add the same two numbers to each vectors, otherwise the shape of the virtual triangle changes. Example:

( 0 0 64 ) ( 0 32 64 ) ( 40 32 64 ) common/woodclip 0 0 0.00 1 1 536870912 16544 0 surfaceColor -1.000000 -1.000000 -1.000000

And you still have the same brush :)

Things to watch out for:
  • If the three virtual points lie on one line, a plane cannot be defined. This is called a degenerate plane.
  • If you swap the order of the points, you also swap the direction of the plane. This means the face which was initially facing out, is now facing in. q3map will report this as a bad normal.
So what is the right order to use? This is determined by the right-hand rule, which is somewhat cumbersome to explain in text. Fortunately, wikipedia has a nice article on it :)

http://en.wikipedia.org/wiki/Right_hand_rule

The 'x' and 'y' axes are determined by taking the difference between point [2 and 1] and [3 and 1] respectively. So that:
x = point2 - point1
y = point3 - point1

If you are familiar with vector mathematics:
normal = -x x y

Where 'x' denotes the vector cross product.

The '-' appears because, for some reason, radiant uses a left hand rule rather than a right hand rule. This is identical to swapping x and y axes, so that:

normal = -x x y = y x x

Applying this to the top face above:
x = ( 0 32 64 ) - ( 0 0 64 ) = (0 32 0)
y = ( 40 32 64 ) - ( 0 0 64 ) = (40 32 0)

normal = y x x = (40 32 0) x (0 32 0) = (0 0 1280) [calculator]

What we have now is a vector pointing straight up, which means the face under consideration (the top plane), is actually a top plane :)

Hope this helps a bit, if not I'll try again :)

Good luck. 8-)

Posted: Tue Jul 25, 2006 9:07 am
by lizardkid
I'm in awe. thats GENIUS, saves brush data by 3x at least, as well as filesize. John Carmack is a god.

You just inspired my mathematics education jv.

Posted: Tue Jul 25, 2006 10:09 am
by PKM
holy crap, my brain just took a dump out of sheer awe and terror. understanding quantum theory is easier but damn if jv didn't make you think there was the possibility that you could understand it while reading it.

Posted: Tue Jul 25, 2006 10:40 am
by Ophisâ„¢
I read the first line and my head started to hurt, im gonna go lie down.

Posted: Tue Jul 25, 2006 11:43 am
by lizardkid
jv has spoken, and he used list.

tremble before him.