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

Generating a bounding quad from a set of planar 3D vertices?

5 posts in this topic

I recently asked a question on clipped portal polygons and the resulting explosion of vertices introduced due to clipping:
[url="http://www.gamedev.net/topic/619754-question-about-portalfrustum-clipping/"]http://www.gamedev.n...ustum-clipping/[/url]

The best response was to generate a bounding quad from the clipped vertices:

[img]http://img39.imageshack.us/img39/2199/portal2a.png[/img]

This turns out to not be trivial. As long as the portals are always axis aligned, this becomes trivial since I can just ignore the axis where the min/max extents are within some epsilon. The issue is that I do not want to restrict the portals to being axis aligned. Looking at the above pic, assume that the portal is rotated 45° along the y (vertical) axis. Even though the resulting projected polygon on screen is an axis aligned quad, the result from testing the minimum and maximum object space extents would yield a 3D bounding volume and not a bounding quad.

I have searched Google and this board to death, but I simply do not know what search terms I should use. All of the results that I have found are for 3D bounding volumes, not planar quads. I'm not sure how to go about this and the lack of information is making it much more difficult. Any searches dealing with calculating a bounding quad turn up methods for calculating a bounding rectangle from 2D points.

I'm hoping that someone can give me some suggestions or point me in the right direction.

[edit] Replaced "rectangle" with "quad". Rectangle implies certain geometric constraints that I was not intending to imply.
0

Share this post


Link to post
Share on other sites
How about just projecting the 3d portals onto the view plane and THEN generating 2d axis aligned quads from the projections? Once again, a bit more conservative, but still will give you most of th benefit.
0

Share this post


Link to post
Share on other sites
[quote name='Crowley99' timestamp='1329592978' post='4914281']
How about just projecting the 3d portals onto the view plane and THEN generating 2d axis aligned quads from the projections? Once again, a bit more conservative, but still will give you most of th benefit.
[/quote]

The problem with that is that a sub-frustum needs to be created from the resulting portal. I'm not sure if that would be possible with 2D projected vertices, especially since the z coordinates will be undefined. I need to do this in object space.
0

Share this post


Link to post
Share on other sites
The depth information is implicit in the order that you traverse the cell portal graph. I.e. You first need to see through the portals of your current cell in order to see through the portals in the next cell. Mathematical induction does the rest.

No subfrustum is needed - just the refined portal in image space which should be the 2D intersection of whichever portals were traversed to get to it.
1

Share this post


Link to post
Share on other sites
[quote name='MarkS' timestamp='1329596147' post='4914293']
... I'm not sure if that would be possible with 2D projected vertices, especially since the z coordinates will be undefined. I need to do this in object space.
[/quote]
If 2 points [sub]2[/sub][b]A[/b] and [sub]2[/sub][b]B[/b] in 2D space give a 3rd point [sub]2[/sub][b]C[/b] due to barycentric weighting
[sub]2[/sub][b]A[/b] * k + [sub]2[/sub][b]B[/b] ( 1 - k ) = [sub]2[/sub][b]C[/b]
then the weight can be computed as
k = | [sub]2[/sub][b]C[/b] - [sub]2[/sub][b]B[/b] | / | [sub]2[/sub][b]A[/b] - [sub]2[/sub][b]B[/b] |
For a vanishing distance between [sub]2[/sub][b]A[/b] and [sub]2[/sub][b]B[/b] also the difference between [sub]2[/sub][b]C[/b] and [sub]2[/sub][b]B[/b] vanishes, so that a k = 0.5 may be used for numerical stability; however, it means that the portal is seen from an almost orthogonal direction and hence probably is already caught in code.

Now, [sub]2[/sub][b]A[/b] and [sub]2[/sub][b]B[/b] are assumed to be the results of projecting [sub]3[/sub][b]A[/b] and [sub]3[/sub][b]B[/b] from original 3D space. Because the points on the 3D line are projected linearly to the 2D equivalent, the same weighting factor k can be used to compute the equivalent of [sub]2[/sub][b]C [/b]in 3D space:
[sub]3[/sub][b]C[/b] := [sub]3[/sub][b]A[/b] * k + [sub]3[/sub][b]B[/b] ( 1 - k )

So reconstructing the point in object (or any other) space is possible although the intersection was computed in 2D.
0

Share this post


Link to post
Share on other sites
[quote name='Crowley99' timestamp='1329640640' post='4914460']
The depth information is implicit in the order that you traverse the cell portal graph. I.e. You first need to see through the portals of your current cell in order to see through the portals in the next cell. Mathematical induction does the rest.

No subfrustum is needed - just the refined portal in image space which should be the 2D intersection of whichever portals were traversed to get to it.
[/quote]

That is brilliant! I have never heard of a screen space portal algorithm before. One thing that always bugged me about traditional portal algorithms is that I would be performing clipping on the CPU for no other purpose than to create a new frustum based on the clipped portal. Once I knew that a portal in the current cell is visible, I would send the entirety of the current cell to the GPU for processing. Since the resulting clipped portals wouldn't be used past the current frame, it seemed a waste of resources.
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