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 / Determining which cubes are visible to the camera

Author
Message
Michael P
20
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 24th Dec 2010 13:46
This is quite a tough problem IMO, so I appreciate any help I can get! I want to do this without DBP commands for the calculations (just using mathematics).

I have a number of cubes which are the same size with the same rotation and do not overlap with each other. There is a fixed viewing distance so rendering stops after a set distance.

I want to determine which cubes are on screen and should be rendered.

So this excludes all cubes which are not within the view port, and any cubes that are directly behind other cubes such that they are completely obscured.

BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 24th Dec 2010 23:44 Edited at: 24th Dec 2010 23:52
Quote: "I want to do this without DBP commands for the calculations (just using mathematics)"

I don't understand why you don't want to use the DBPro solution when it is right there for you.

You could calculate if a bounding box for the farther object is visually within the bounding box of the closer object, adjusting for the angle from the camera each object is positioned
Kind of like simulating the cameras FOV and object culling
Compute the view frustum in world coordinates and then determine if the bounding volume intersects it or not.
Here is a link that might help
http://www.gamedev.net/community/forums/topic.asp?topic_id=589338
Michael P
20
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 25th Dec 2010 00:18
I need to be able to run the simulation with no graphical back end (i.e. in another language), and it needs to be done efficiently.

I am working on a solution which involves creating a square based pyramid, where the tip of the pyramid originates from the view point. From there everything that is within the pyramid is visible to the camera. I will post more details if/when this is finalized.

Login to post a reply

Server time is: 2026-07-21 20:35:25
Your offset time is: 2026-07-21 20:35:25