Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Culling Pieces of a Level Object

Author
Message
Hockeykid
DBPro Tool Maker
18
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 8th Apr 2011 04:26
Is there any technique of culling pieces of a single level object when the objects are not within the camera's frustum? Also what are some other efficient culling techniques to use for high poly levels?

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 9th Apr 2011 14:28
Quote: "when the objects are not within the camera's frustum"

in dbpro when object aren't winthin the camera frustum they are already culled ->it's called frustum culling

Quote: "Is there any technique of culling pieces of a single level object"

are you asking for a specific technique within dbpro or in general?

Quote: "Also what are some other efficient culling techniques to use for high poly levels?"

occlusion culling

kaedroho
18
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 9th Apr 2011 15:17 Edited at: 9th Apr 2011 15:19
Theres lots of ways to do frustum culling. DBPro automatically does it for each object, but this is not good when your entire level is the same object as it will only cull things if the entire level is not in view.

The method your looking for is BSP. This splits your object into smaller pieces and cull those instead. BSP is a method to do this quickly.

To do BSP you first need to check if the entire level is either

Completely in view (draw everything)
Completely out of view (draw nothing)
Some in view and some out of view

When theres only some in view and some out of view then you cut your level into 2 parts and do the above check over again on each of those pieces. You keep chopping it down until either the chunk is completely in view or out of view. If you chop it down very far (so theres only just a few triangles per chunk), just draw the chunk anyway.

DBPro has an implementation of the above, I think its used in FPSC. However, I think you need to build the BSP tree yourself.



Like frustum culling, theres loads of ways you can do occlusion culling, one method is by using portals.

Portals split each room into individual objects. Each room has a list of rooms which it can see. For example, Room 1 can see Corridoor 1 but not Room 2. So when the player is in Room 1, Room 2 will be culled. Like BSP, there is a DBPro implentation of this too (but its slow at building portals and sometimes it can cull/not cull at the wrong times).

Your signature has been erased by a mod please reduce it to no larger than 600 x 120.
Lost in Thought
22
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 9th Apr 2011 15:42
I don't really program in DBP any more, but that is precisely what this code was done for: http://forum.thegamecreators.com/?m=forum_view&t=67369&b=6

I have no idea if the code works with the current version of DBP or not though 0_o

Hockeykid
DBPro Tool Maker
18
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 9th Apr 2011 18:44
Quote: "in dbpro when object aren't winthin the camera frustum they are already culled ->it's called frustum culling"


Yes, but as kaedroho said it will only cull the level object if it' not in view at all.

Quote: "To do BSP you first need to check if the entire level is either

Completely in view (draw everything)
Completely out of view (draw nothing)
Some in view and some out of view

When theres only some in view and some out of view then you cut your level into 2 parts and do the above check over again on each of those pieces. You keep chopping it down until either the chunk is completely in view or out of view. If you chop it down very far (so theres only just a few triangles per chunk), just draw the chunk anyway.

DBPro has an implementation of the above, I think its used in FPSC. However, I think you need to build the BSP tree yourself."


Do you happen to know if there are any examples of this floating around?

Quote: "Portals split each room into individual objects. Each room has a list of rooms which it can see. For example, Room 1 can see Corridoor 1 but not Room 2. So when the player is in Room 1, Room 2 will be culled. Like BSP, there is a DBPro implentation of this too (but its slow at building portals and sometimes it can cull/not cull at the wrong times)."


Would this be able to work in an outdoor, city environment?

Quote: "I don't really program in DBP any more, but that is precisely what this code was done for: http://forum.thegamecreators.com/?m=forum_view&t=67369&b=6"

I had seen this a while back, but I didn't think it could be use for whole level objects.

Lost in Thought
22
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 9th Apr 2011 23:35
It was designed to be used to cull the limbs of an entire object because DBP wouldn't. That example code is one huge object with lots of cubes for it's limbs. Though some people used it to cull animated objects as a whole as DBP didn't at the time.

sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 10th Apr 2011 03:35
Hey, Lost in Thought how are you? If you are not using DBP, what are you using? I still play with DBP, I was by your web site and not much going on there, like mine, just done have time.
renny

Life is not fair, so deal with it.
http://www.gusroundtable.com/
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 10th Apr 2011 03:44
Quote: "I had seen this a while back, but I didn't think it could be use for whole level objects."


If you're using a single object for the entire level you're doing something wrong.



Support a charitable indie game project!
Lost in Thought
22
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 11th Apr 2011 01:54
It depends on how his game is setup and that he's using for collision/physics. NGC and Paul's seems to work better with fewer, larger objects as opposed to many small ones. That's why I ported the culling code over in the first place. If it's a rediculously huge level then yes ... you are doing something wrong I know my code needs updating to use the new exclude limb command to make it more efficient, but as I said I don't use DBP anymore so someone else will have to do it. That's why it was made open source

And to Sadsack: I don't really wanna hijack his thread so email me instead. But I don't have time to code any more, but when I start back I'm using Nuclear Basic instead. It's kinda setup just for me Once the docs are done and it's fully released I'll make time to use it

Login to post a reply

Server time is: 2026-07-17 13:58:57
Your offset time is: 2026-07-17 13:58:57