Skip to main content
gamedev.net
🔒 Locked

BSP to Octree

Started by user0 May 18, 2012 at 5:06 PM 7 replies 3.5k views
Original Post
user0
user0
I am trying to make a very simple engine and I love the idea of octrees they work in my head so I want to go with them altough I know they probably arnt the fastest for what im doing but I think its a great place to start.

The problem im running across is there doesnt seem to be a way to take a map out of an editor and save it as a octree?

Is there any way to convert maps of any type bsp, obj, map, 3ds whatever into a octree?
user0
user0
How is that a stupid question more like that was a stupid answer. I have content already in bsp format I also dont know of an editor for octrees so thats what I am trying to figure out. I know that octrees and bsps are very different in the way data is stored and theres probably not a easy way to convert between them but there has to be something that can do it I dont care if it has to process for a week.
swiftcoder
swiftcoder
What ____ is (rather antagonistically) getting at, is that there is no need to have an editor that outputs octrees. You can just create the octree on-the-fly, as you load in the level geometry.
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
user0
user0
So I could load up a bsp and create an octree from it on the fly? That would be cool but I have several issues I have no clue how that would even be done and that requires me to know more and Im just starting out and chose octrees for simplicity.

Is there a engine or any thing that does this already that I can look at?
Erik Rufelt
Erik Rufelt
It should be very simple to create an octree, just start with a big box containing every polygon in your level, which is the root box.
Then you divide this box on the X, Y and Z axis so you have 8 new smaller boxes that fits inside the big box. Go through all the polygons in the big box and assign each one to the one of the 8 boxes that it is inside. It should be easy to check whether a polygon is inside a box.
Then you recurse and divide each of those 8 boxes into 8 smaller boxes, and assign each of the polygons in the parent box to one of the smaller boxes.

Then you have your octree.
marvel_magnum
marvel_magnum

It should be very simple to create an octree, just start with a big box containing every polygon in your level, which is the root box.
Then you divide this box on the X, Y and Z axis so you have 8 new smaller boxes that fits inside the big box. Go through all the polygons in the big box and assign each one to the one of the 8 boxes that it is inside. It should be easy to check whether a polygon is inside a box.
Then you recurse and divide each of those 8 boxes into 8 smaller boxes, and assign each of the polygons in the parent box to one of the smaller boxes.

Then you have your octree.


Nice work man. You have put it down it such a simple way that it almost sounds like a school project.tongue.png
But yeah, thats the whole idea.
jbadams
jbadams

It should be very simple to create an octree [...]

That's a pretty good basic explanation. You can also find a very basic tutorial here.

If this is still going over your head you might want to stick to something more basic for a little while first. smile.png
- Jason Astle-Adams
L. Spiro
L. Spiro
I would suggest going with .MAP files as they are fairly easy to load and manage.

But they do not store vertex data. You need to generate the vertices for each solid.
I just wrote a tutorial on how to do that here: http://lspiroengine.com/?p=400



L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.