• Create Account

## sphere vs isometric frustum collision

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1zaneski13  Members

104
Like
0Likes
Like

Posted 03 April 2012 - 12:19 PM

So I'm in the process of developing a 3D Isometric game in c++ and opengl. I'm currently working on the lighting system. Basicly I have a max number of lights that can be viewable at one time, but the level has no bounds of how many lights can exist. So I need to filter out the lights that are not viewable.

some valuable information:

EVERY LIGHT IN THE SCENE IS A POINT LIGHT, so a sphere...

The camera frustum is ISOMETRIC 3D. Its positioned about 30 feet above the character, and rotated 45degrees down X and 135 degrees Y (this may change)

I have a function implemented that casts rays from each corner of the screen. For each ray I calculate the x and z value when the y value is 0.
this is because the game is 2.5 D, no terrain to worry about. Ground is always at y = 0

So with these 4 points I can figure out how much of the level is in view (how many ground tiles i have to draw)

Each light has a 3D position and a radius.

Using that information, how can I figure out which lights in the level are visible at a given time?

Any help is appreciated. Thanks!

### #2FLeBlanc  Members

3133
Like
1Likes
Like

Posted 03 April 2012 - 01:36 PM

Iterate the lights and test the center of each sphere against the six planes of the frustum, to determine if it is inside the frustum. If so, the light is visible. If not, iterate the planes of the frustum and find the point on each plane that is nearest the light. Calculate the distance between that point and the center of the sphere. If it is less than the radius of the sphere, then the light is visible.

### #3zaneski13  Members

104
Like
0Likes
Like

Posted 03 April 2012 - 05:14 PM

How would one go about finding the 4 planes of the isometric 3D camera? The 4 planes being left, right, top bottom. Dont really care about near and far because its a 2.5 D isometric game so lights wont be above the camera or below the floor.

The camera data I have access to in my engine is the position, rotation, modelview matrix, projection matrix.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.