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 Discussion / Frustrum Culling

Author
Message
Chief Voyager
23
Years of Service
User Offline
Joined: 20th Mar 2003
Location: United States
Posted: 17th Apr 2003 07:54
I was looking over some tutorials on Frustrum Culling in OpenGL and i saw that it is a technique used to only draw 3d objects if they are in the current scene. i'm new to c++ and i was just looking ahead to OpenGL when i saw this and was wondering if something like this could be done in DB (just to try it out). can it be done, and how could it be done? the primary advantage of it is speed in the "drawing process", but is DB capable of this? thought that I would ask.
You're ate up like a soup sandwich.
bitJericho
23
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 17th Apr 2003 08:13
it was my understanding db did this automatically, unless you turned it off with SET OBJECT command, unless db is using a different culling technique....

The 3D Modeler's Group : http://groups.yahoo.com/group/3dModeler/
The Unofficial DB Newsgroup : http://groups.yahoo.com/group/DBMag/
Hell IVIonkey
23
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 17th Apr 2003 09:04 Edited at: 17th Apr 2003 09:06
DB does it, but it's not precise. You can use math to check if the object is outside of the visible range, then HIDE OBJECT # if this is so. Of course you'll need to take into consideration the object origin versus the bounds of the object when deciding whether to hide it.

If you were talking about hiding an object that's fully behind another, DB does it, but very inaccurately. Look to DB Pro for BSP support, which, thanks to octrees, will cull virtually perfectly.
Danmatsuma
23
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 17th Apr 2003 09:11
This does it for me


ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
Hell IVIonkey
23
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 17th Apr 2003 11:57
That's handy.

However, it's still quite true that objects entirely blocking visibility to others will not accurately result in hiding the others. The only way to do this correctly is with some type of 3d format (like BSP) that has portal calculations.
Richard Davey
Retired Moderator
24
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 17th Apr 2003 14:00
Frustum culling is not for hiding objects, that is not its purpose.

Its purpose is to control how many polygons are drawn in the given range using the near and far values and resulting clipping planes and DB does do this very accurately.

If it did hide objects automatically you'd have a right mess on your hands - imaging a camera range of 2500 and an object of 4000 - surely you'd want to be able to see the first 2500 units of it?! If the frustum did what you're assuming it should, the whole object would vanish.

Oh and it's frustum, not frustrum!

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
Hell IVIonkey
23
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 17th Apr 2003 22:18 Edited at: 17th Apr 2003 22:20
You're right, but I still have an argument as to how accurate it is. I agree that the internal DB algorithm is good, but in my particular situation, it's slight inefficiencies are magnified (due to my strange video errors).

I use statistic(1) to measure the poly count. I'm assuming this is an accurate measure; if not then my argument goes out the window. If you load up my color test demo and position the camera past the last row of blocks, or to the right/left of the blocks so that none are on the screen, the count is at most hundreds at times. However, manually hiding the object (which will cull ALL the faces of it) when the camera is in the same position as the first trial results in some, but not nearly as many polys being counted.

Oh yeah, and I know frustum culling is only for the visible area, but I thought I'd put in a good word for BSPs. They're so shiny and precise! Octrees! *drools* Portals (though these can be inaccurate too)!

Login to post a reply

Server time is: 2026-06-11 21:23:23
Your offset time is: 2026-06-11 21:23:23