Loading maps or bsps

Loading maps or bsps

Post by Timo Wingende » Mon, 28 May 2001 16:35:59



How can I load map or bsp files from worldcraft into my open gl
Programm??!!??!!??

In in the map file are only planes with three edges. How can I display them
as 'normal' vertices with four edges?
Example: This should define a cube which  64 units width, height and depth

( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

I've tried to load it but then I got some triangles and not a cube

I don't know how to load the binary .bsp files.

Or can anyone give me an othe world editor???

 
 
 

Loading maps or bsps

Post by erik robso » Tue, 29 May 2001 11:38:20


On Sun, 27 May 2001 09:35:59 +0200, "Timo Wingender"


>How can I load map or bsp files from worldcraft into my open gl
>Programm??!!??!!??

>In in the map file are only planes with three edges. How can I display them
>as 'normal' vertices with four edges?
>Example: This should define a cube which  64 units width, height and depth

>( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
>( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
>( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
>( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
>( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
>( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

I don't *really* know much about this, but I do know that Quake
editors represent geometry in terms of plane equations rather than as
vertices and meshes.

Hope it helps...

 
 
 

Loading maps or bsps

Post by V-ma » Tue, 29 May 2001 14:18:08


And then the game engine does what with the plane equations?
Spend 5 minutes figuring out intersection lines and points to figure out
what the
actual vertices should be?

V-man


> On Sun, 27 May 2001 09:35:59 +0200, "Timo Wingender"

> >How can I load map or bsp files from worldcraft into my open gl
> >Programm??!!??!!??

> >In in the map file are only planes with three edges. How can I display them
> >as 'normal' vertices with four edges?
> >Example: This should define a cube which  64 units width, height and depth

> >( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
> >( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
> >( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
> >( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
> >( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
> >( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

> I don't *really* know much about this, but I do know that Quake
> editors represent geometry in terms of plane equations rather than as
> vertices and meshes.

> Hope it helps...

 
 
 

Loading maps or bsps

Post by Mathias Heye » Tue, 29 May 2001 17:11:49


Quote:> In in the map file are only planes with three edges. How can I display
them
> as 'normal' vertices with four edges?
> Example: This should define a cube which  64 units width, height and depth

> ( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
> ( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
> ( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
> ( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
> ( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
> ( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

What you see here are always 3 points together that define each of the 6
planes for your cube. What you now have to do is
1. turn the 3 points into a real plane (the plane normal should point
outwards the cube)
2. make a huge polygon (preferably a rectangle) for each plane
3. split each side-polygon with each other plane, keeping the part that lies
on the backside of the plane and throwing away the rest

voila! You have 6 polygons that you can render.
For more in-depht information have a look into Quakes tool sources, where
all this is done.

Mathias

 
 
 

Loading maps or bsps

Post by Frank Henr » Tue, 29 May 2001 17:58:00


would you inform me when you get it going?

thanks!

gruss

Stephan-Frank Henry
----------------------------------



Quote:

> How can I load map or bsp files from worldcraft into my open gl
> Programm??!!??!!??

> In in the map file are only planes with three edges. How can I display
them
> as 'normal' vertices with four edges?
> Example: This should define a cube which  64 units width, height and depth

> ( 0 0 -64 ) ( 0 0 0 ) ( 0 -64 0 )
> ( 64 -64 -64 ) ( 64 -64 0 ) ( 64 0 0 )
> ( 0 0 -64 ) ( 0 -64 -64 ) ( 64 -64 -64 )
> ( 64 0 0 ) ( 64 -64 0 ) ( 0 -64 0 )
> ( 0 0 0 ) ( 0 0 -64 ) ( 64 0 -64 )
> ( 64 -64 0 ) ( 64 -64 -64 ) ( 0 -64 -64 )

> I've tried to load it but then I got some triangles and not a cube

> I don't know how to load the binary .bsp files.

> Or can anyone give me an othe world editor???

 
 
 

Loading maps or bsps

Post by Tony Savesk » Wed, 30 May 2001 06:55:26


No...the quake utilities do this when they create the bsp files...they have
polygons defined in them not planes. I can't remember where all the bsp file
format details were but I remember finding them easily with a standard
search engine.

I think there's also an open source project called Aftershock... they can
load quake levels and walk around in them.

Tony


Quote:

> And then the game engine does what with the plane equations?
> Spend 5 minutes figuring out intersection lines and points to figure out
> what the
> actual vertices should be?

> V-man

 
 
 

Loading maps or bsps

Post by Timo Wingende » Thu, 31 May 2001 03:49:01


Quote:> What you see here are always 3 points together that define each of the 6
> planes for your cube. What you now have to do is
> 1. turn the 3 points into a real plane (the plane normal should point
> outwards the cube)

turn into a real plane??? Isn't it a real plane??? How to do it???

Quote:> 2. make a huge polygon (preferably a rectangle) for each plane

How can I make a polygon from it??? It musnt be a rectangle, it could also
be an triangle or an polygon with x edges(or I'm wrong there???)

Quote:> 3. split each side-polygon with each other plane, keeping the part that
lies
> on the backside of the plane and throwing away the rest

Why have I to split it with the other planes?

Thankx for the information but it doesnt helps me much. I simply want to
display a map file in my OpenGL Programm!!!

 
 
 

Loading maps or bsps

Post by Mathias Heye » Thu, 31 May 2001 04:42:31


Quote:> turn into a real plane??? Isn't it a real plane??? How to do it???

Ok, maybe I expressed it wrong. Each three points define the plane they are
lying on.
All points that lie on a plane satisfy this equation:

x*nx+y*ny+z*nz = d;

where (x,y,z) is a point, (nx,ny,nz) the normal of the plane and d the
distance of the plane from the origin along the normal of the plane (in
units of ||n||).

So how to build a plane with three given points that lie on that plane?
let x1,x2,x3 be these three points.

v1=x2-x1;
v2=x3-x1;

v1 and v2 are two (non colinear) vectors that lie on the plane;
to finally get the normal, just do a crossproduct of v1 and v2:
n=v1^v2;

better normalize the normal now...

n=Normalize(n);

all what is still left is d;

which can be calculated:

d=x1.x*n.x+v1.y*n.y+v1.z*n.z;

Quote:> How can I make a polygon from it??? It musnt be a rectangle, it could also
> be an triangle or an polygon with x edges(or I'm wrong there???)

yes, it could be any (convex?) Polygon that is large enough. But rectangles
cover a large area and are easy to produce.
I really advice you to have a look into Quakes Tool sources!

Quote:> Why have I to split it with the other planes?

This is too hard for me to explain in English :-(
Just imagine a cube. You have created really big side-polygons. They have
already the right position but are so big that they do intersect each other.
Now imagine you cut away all parts that hang over the cube. What you did was
to split away all parts of each side-polygon that were lying in front of the
plane of each other side!

Here some pseudo-code:

 for (int bs=0;bs<num_brushsides;bs++)
 {
      face=FaceForPlane(brushsides[bs].plane); // create the oversized
rectangle
      for (bs2=0;bs2<num_brushsides;bs2++)
     {
           if (bs2==bs) continue;
          SplitFrontPart(brushsides[bs2].plane,*face); // cut away
everything that lies in front of the other brushside, keeping the back-part
      }
      RenderFace(*face); // you should store your final face somewhere
 }

I hope this helps a bit. And again, have a look into quakes tool sources!

Mathias

 
 
 

Loading maps or bsps

Post by Timo Wingende » Thu, 31 May 2001 05:16:44


I think this will help me

Kanst mir auch in Deutsch schreiben;-)

 
 
 

1. Good Resources for learning BSPs and/or Portals?

I'm not looking for just web sites, but mainly for printed material.  Are
there any good books that discuss the topics?

Web sites are always good resources, because they can remain up to date, but
books are easy to thumb through and you don't need to be in front of a
computer to do the research.  You Dad's out there probably know what I mean.
:)

Thanks.

2. gold fill

3. PVS, mirrors in bsps

4. SPURTING BLOOD ALGORITHM

5. BSPs and 3-sided polygons....

6. colors

7. subpixel accuracy, BSPs & Direct3D

8. Quake2 BSPs

9. If not BSPs, then what ?

10. BSPs and selecting the partition plane

11. BSPs: tjunctions post-process elimination

12. Best Way of building up BSPs...