• 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
Gorwooken

GJK Algorithm

4 posts in this topic

I'm in the process of implementing the GJK algorithm, there are a couple of things that I'm unclear of. I understand that i'm just calculating the points of the minkowski difference on the fly using supporting points two meshes. The objects i'm working with are convex so say I wanted to initialize the algorithm with simplex of 4 points from the minkowski difference of mesh A and B, can I pick a point on mesh A and normalize the vector and then use my supporting point method in the opposite direction of the point on mesh A? Also what is the best way to init a simplex in R3, should I just start with one point and begin the algorithm? For determining the smallest simplex i need to compare barycentric coords, I don't believe that I need to calculate them because I already know if the point is on a face a vertex or an edge. I can grasp this much better in R2 than R3 so say I had a tetrahedron simplex and i wanted to reduce the simplex when i calculate the closest point to the origin on the tetrahedron, say the point lies on a face of the tetrahedron, would the simplex simply be the triangle that the point lies on? I've got pretty much everything else done so if someone could give me a hand with this it'd be much appreciated.
0

Share this post


Link to post
Share on other sites
I think the simplex used in GJK is of one lower dimension than the one the convex objects exist in. In the 2d version, it is a line segment. In the 3d version it would be a triangle.

When they talk about finding the smallest simplex or whatever, they are just trying to state in very non-ambiguous mathematical terms that you choose the points that form the simplex that contains the point closest to the origin. So that would be the triangle which contains the point closest to the origin.

There's no need to start with any points in the simplex at all. You can just start with an empty set of points for the simplex, and keep adding new points to it until it gets to the size where you need to calculate which point to remove at each iteration.

You can initialize the algorithm by choosing an arbitrary direction. That direction gives you the first point, then the next direction is opposite the vector between the origin and the point. That direction produces the second point. Now the simplex is a line, and you find the closest point to the origin on that line, choose the next direction by negating the vector to that point, and that produces the third point. Now you find the closest point on the triangle to the origin, then negate that vector to get the next direction and the fourth point. At this point the simplex contains 4 points, but a subset of that simplex consisting of a simplex of only 3 of the points will contain the point closest to the origin. So you eliminate the point that is not part of that triangle. Then any more iterations look just like the last one...
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Gorwooken
Also what is the best way to init a simplex in R3, should I just start with one point and begin the algorithm?
A frequent approach is to start with the simplex from the previous call to the algorithm (for the given pair of objects). The first time around just use one point.

Quote:
say I had a tetrahedron simplex and i wanted to reduce the simplex when i calculate the closest point to the origin on the tetrahedron, say the point lies on a face of the tetrahedron, would the simplex simply be the triangle that the point lies on?
Yes, you drop the points in the support set that are not needed to express the point that lies on the feature and is closest to the query point. For example, you have four points in the set, forming a tetrahedron. If the closest point lies on one of the faces of the tetrahedron, you keep the three vertices of that face and discard the fourth. If the closest point lies on one of the tetrahedron edges, you keep the pair of points determining the edge and discard the other two. Et cetera.
0

Share this post


Link to post
Share on other sites
Quote:
The objects i'm working with are convex


If you find GJK to be too much trouble for convex objects, you can use SAT, or a host of other, possibly more optimal, solutions for convex/convex testing. You probably already know that, but I figured I'd mention it.
0

Share this post


Link to post
Share on other sites
Thanks to AP for the post, you answered most of my questions, I should be able to finish this implementation in the next few days and to Christer, your notes and Slideshow from Siggraph 04 have been a huge help to me and your book on real time collision detection is in the mail :P

hplus0603, I've already got an implementation of the SAT for use with my Oriented Bounding Box Tree class. Thus far I'm quickly able to calculate if two objects are intersecting and i'm in the process of implementing GJK for determination of the penetration distance when two convex polyhedra collide
0

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