• 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
3TATUK2

Potentially Visible Set?

12 posts in this topic

So, I've been thinking about how to start a PVS implementation, and it essentially amounts to something like this:

 

For each base octree node/spatial grid cube . . .

For each of 6 camera view frustum directions . . .

Render each individual triangle wrapped in an occlusion query . . .

If the triangle passes, then add it to the list of "visible triangles" in that 1/6 frustum section for that octree node/spatial grid cube

 

Then. . . during runtime, determine which octree node/spatial grid cube the camera is in... intersect the camera frustum with the 6 view directional frustums to get (i guess) at most which 3 frustums are potentially visible, then render all triangles in the "visible triangles" lists of the frustums which are intersected . . .

 

Feedback appreciated, please especially post any good PVS implementation related material you may have.

0

Share this post


Link to post
Share on other sites

In that case my suggestion may be less relevant...

 

A simple PVS could be made by logically dividing everything in the world (terrain, buildings, and all other static objects) and assigning each item a unique 3 byte ID - you then render everything from a given area and draw the 3 bytes to R, G, and B channel. Simply read back which 'colours' are rendered to obtain a PVS for each reachable location.

Edited by mark ds
0

Share this post


Link to post
Share on other sites

this sounds like an interesting concept, i could have the 'ID' be the index of individual triangles... and then instead of doing an occlusion test and render for each individual triangle, render the whole scene. . . but, then you have to read back every pixel so i'm not sure whether it would be faster than an individual test+render per triangle.

0

Share this post


Link to post
Share on other sites

A PVS is not what you want for this type of application—it is good for indoor environments but very unsuitable for outdoor environments, especially in light of its shortcomings when dealing with dynamic objects and addition to better structures available that handle both dynamic objects and specifically terrain much much better.

 

Updating a PVS in real-time is not practice, so you would not be putting dynamic objects into it.  Meaning only the terrain and buildings would be relevant choices, and both can be done better.

 

 

Terrain should be rendered using either GeoMipmaps or GeoClipmaps.  GeoClipmaps is the fastest but takes some work to implement.

 

After that, the rest of the world should be subdivided into an octree or a hybrid between an octree and a quadtree (my suggestion).  This will handle all the static objects besides the terrain as well as dynamic objects inside the game world.  Standard frustum culling would be applied here.

Then PVS’s would only be applied to the interiors of buildings.

 

There is no one-fits-all solution to a game world.  Each part is best served by a specific structure or algorithm.

 

 

L. Spiro

1

Share this post


Link to post
Share on other sites
The PVS algorithm in the OP won't work. It's easy to imagine a case where, with the camera at he centre of cell 'A', you can't see cell 'B' at all, but with the camera near the edge of cell 'A' you can.
The chance of these errors occurring is proportional to your cell size. To be error free, you need infinitely small cells!

Most precomputed PVS systems will use the world geometry to define the empty/movable space, and then decompose these empty spaces into a set of polytopes (convex shapes). The faces that are shared between two polytopes become portals. For each "sector" (polytope), for each portal, you can then construct a frustum of the potentially visible area through that portal. You can then step into the adjacent 'sector', and recursively apply the same process, but ignoring any portals outside of this frustum, and when stepping through the next portal, you use the union of the current frustum and the new frustum (basically clipping so, when looking from sector A to B to C, you only check for what's inside the A->B frustum AND inside the B->C frustum).
1

Share this post


Link to post
Share on other sites

darn thanks for pointing that out, i never thought of that. that's crazy, makes it sound just that much more complex

0

Share this post


Link to post
Share on other sites

It sounds a bit simpler if you describe it with planes (instead of frustra like I did), and draw it out in 2D.

e.g. here's a top-down view of a level with one room connected to two corridors. The level has been compiled into a BSP-tree, which is binary tree (each node has two children) where each node defines a plane that splits the world in half.

Originally, Quake1 chose to use BSP trees because they allow you to quickly sort your polygons from back-to-front, so they could render without a z-buffer! However, they turned out to be pretty useful besides that, and many indoor renderers still use them.

Each of the red lines in the picture is a plane from the BSP tree. The letters are then the sectors that are formed after the world has been split by these planes.

If we want to build the PVS for sector A, first we add A to the list (A can see A wink.png), then we iterate through it's portals (planes). It's only got one portal in this example, which leads to B. We add B to the list, because it's directly connected via this portal, so it's obviously visible. Now we iterate through B's portals -- it has one to D and one to C. We check each of those portals against the planes we've already crossed -- so far we've only crossed from A into B. The portal from B to D is behind (or parallel with) the portal from A to B, so we can skip it! The portal from B to C is in front of our plane, so we add C to our visible list.

In the diagram, C has no further portals, but if it did, we'd check that they were in front of the A->B plane, and in front of the B->C plane.

t9egmmU.png

2

Share this post


Link to post
Share on other sites

Speaking of Quake 1, it's worth noting that it also used it's PVS for reducing client/server communication (only potentially visible entities need be sent) and for visibility tests in combat.  That's something you might want to consider and which could influence your choice of what technique you use for this.

1

Share this post


Link to post
Share on other sites

Okay, thank you a lot for the explanation Hodgman but it's a bit "restricted" to specifically BSP implementation... I'm having trouble trying to mentally/visually "translate" this into working for a "basic" octree/quadtree..

 

We can start with an example, as a quadtree top-down view:

 

 

[attachment=18642:t9egmmU.png]

 

Could you maybe explain how this could be applied in a case such as this?

 

In your BSP example, I kind of understand how you can check whether another plane is "behind" or "in front of" a given plane, but in a quad tree... you'd have to check 4 planes for a given section, in all four directions, so wouldn't every other section technically be "visible" by this procedure?

Edited by 3TATUK2
0

Share this post


Link to post
Share on other sites

If you use a finer grid in that example, and if you first determine which cells are completely empty, then it works wink.png 

Still perform the same recursive algorithm where you step through each portal into the neighboring cells (ignoring empty cells), adding the planes you've crossed to a stack as you traverse the cells. It should work just the same as in the BSP-tree example, except with BSP you can have a bit more control over where these splitting planes are placed (often the level designers / map makers can manually place these portals as well as relying on the BSP-compiler to create them automatically). To get decent results, your cells will have to be small enough so that you get some empty cells between rooms/corridors.

 

Grey cells are empty (no geometry, so don't treat them as being neighbours that you can traverse).

Starting at the green cell in the centre picture, when we step downwards from there, we add the orange line to our stack of planes. When traversing further from there, we can never step back up over that orange line, so the corner ends up functioning as an occluder.

ahgjyQy.png

In a more complex level it ends up looking like this (Starting at "A", green is visible, grey are empty cells, white are not visible for "A")

pQoKwhE.png

Edited by Hodgman
1

Share this post


Link to post
Share on other sites

Grey cells are empty (no geometry, so don't treat them as being neighbours that you can traverse).


I think this only holds for "outside" cells. Otherwise you might have a floating object in a room, that the PVS compiler deems invisible because it is completely surrounded by grey cells.
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