• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
french_hustler

Frustum culling using a KD-tree

4 posts in this topic

Hello all,

 

I just finished a ray-tracing class and have become more familiar with kd-trees.  We used a kd-tree to acquire the nearest neighbours for a photon mapping technique.  I have read from many places that a kd-tree can be used for frustum culling and am trying to understand how this is done.

 

Say I use a kd-tree implementation similar to the ANN library (http://www.cs.umd.edu/~mount/ANN/).  With such library, you provide it your points and you can query for the N nearest neighbours about a specific point or do a search for the neigbours within a radius at a specific point.  The thing is, how is such a structure useful for frustum culling?  The KD-tree stores points and can acquire nearest neighbours....  To do frustum culling, wouldn't you have to store AABB bounds with each node of the tree and do some sort of intersection with the frustum while traversing the tree structure?  Wouldn't that step away from the purpose of a kd-tree which is to efficiently acquire near neighbors for a given data set of k dimensions?

 

ANN uses "indices" to a vector of points.  So technically, I could somehow store AABB's in another vector with respective indices and pass the center point of each AABB to create the kd-tree.  But I still fail to see how that would help.... I'm assuming that the traversal logic would have to be much different than for looking for nearest neighbors.

 

I'm not sure if the above makes any sense, but in the end, I'd appreciate if someone could point me in the right direction to understand how a kd-tree can help with frustum culling. 

 

Thank you.

0

Share this post


Link to post
Share on other sites

To do frustum culling, wouldn't you have to store AABB bounds with each node of the tree and do some sort of intersection with the frustum while traversing the tree structure?

 

Are the trees in the ANN library in some way different from basic kd-trees? Otherwise keeping track of nodes'/cells' AABBs shouldn't be too hard. You can test those boxes directly against the frustum using basic frustum culling methods. For example a box can be clipped whenever all its corners/vertices fall outside one of the frustum's faces. (transform points into projection space and test against w, or do a halfspace test against the six faces of the frustum.) The same for the individual points stored in the tree.

 

If you don't know the AABBs you can cull one side of a split whenever all the eight corners of the frustum fall on the opposite side of the split's hyperplane.

0

Share this post


Link to post
Share on other sites

Hey, thanks for the reply.  I am still confused angry.png .

 

Say I build the kd-tree from scratch.  I have N entities each with their own AABB bound.  Would I construct the kd-tree using the position of the entities?  Or should each point of the bounding boxes be used?  To me, a BVH makes much more sense for frustum culling as the nodes represent an AABB.  Same goes for structures like octrees for example.  Each node represents an "area" in space.  With a kd-tree a node represents a split in one dimension.

1

Share this post


Link to post
Share on other sites
My take on it is that there are two "types" of kd-trees, one which stores points and another which stores volumes (AABB's, probably). On the former, you do nearest-neighbour searches (kNN search) and on the latter, you do ray-AABB traversals (which probably become ray-triangle queries). You've grasped the first type.

Now the second type uses splits in three dimensions, but the meaning is different from just storing a point, it instead says "in this node, there are no AABB's left (or right) of this split in the given dimension". What this means is that in your traversal code, you only need to examine at most one side of the split.

Take a look at http://www.flipcode.com/archives/Raytracing_Topics_Techniques-Part_7_Kd-Trees_and_More_Speed.shtml which I found is a decent introduction.

Dunno how that would be useful for frustum culling, though. kd-trees are generally used with raytracers which implicitly do not require frustum culling. Edited by Bacterius
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0