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

Picking a set of vertices

3 posts in this topic

Hi All

 

I'm looking for standard/convenient solution for picking a set of vertices (see attach). Questions:

 

- is glFeedbackBuffer a way to go?

- if so how can I detect vertex indices and (more important) vertex visibility (e.g. it's overlapped by polygon(s)). Solutions based on culling/normals aren't perfect, for example no vertices could be selected on plane turned back. In other hand it looks too expensive to write a raytracer for this task.

 

Thanks

 

Tom

 

[attachment=22962:Vertices.png]

0

Share this post


Link to post
Share on other sites

If you are on GL 4 you can render the teapot and at the same time output selected vertices into a nother buffer just by using a geometry shader with 2 streams. I could try to add example code but unluckily I can't use that feature on my local machine so that will be buggy code.

 

 

For vertex visibility you need to render again outputted vertices (maybe as points?) and check if Z test pass/fail or use occlusion query. If you want indices of those vertices you just have to add a vertex attribute that store the index

Edited by DemonDar
0

Share this post


Link to post
Share on other sites


For vertex visibility you need to render again outputted vertices (maybe as points?) and check if Z test pass/fail or use occlusion query. If you want indices of those vertices you just have to add a vertex attribute that store the index
Thx for your reply

 

- how can I perform this Z test and/or occlusion query?

- should I use GL_PASS_THROUGH_TOKEN to assign index or there is other/better way?

 

Thanks

0

Share this post


Link to post
Share on other sites

Those are basic GL concepts, I could try to explain everything that but that will take too long, I suggest you to look at modern OpenGL books and tutorials (opengl version 3.3 and 4.x). You need to be strong in those concepts before you ever start writing a geometry shader that write to multiple streams :/

 

In short:

 

When GPU draws triangles on the screen it does nothing more than writing color values in "pixels" and Depth values in a Zbuffer (well that's not precise, nowadays all thos values are wrote to a framebuffer object)

 

The reason why if you render a box behind a wall you don't see the box is because of Z test. Basically each frame the Zbuffer is resetted. Each pixel of each primitive, performs a Z test (if Z testing is enabled!), if test fails the pixel is not drawn and some computations are skipped. If test succed the pixel is drawn and a new color and Z value are drawn.

 

When Z testing is enabled rendering order is not important: objects appears in correct order because nearest objects will "overwrite" farest objects, and farest objects will not overwrite nearest objects.

 

Occlusion query allows to query GPU for occlusion => You rendered a box behind a patch of gras and you want to know how much % of the box is visible. The occlusion query allows to know how much pixels are occluded (not rendered because Z test failed). This is a simple task for the GPU but even the most complex physics engine can't do that efficiently. However occlusion query may not be enough for selecting single vertices (most notable use of occlusion query is to show lens flares when sun is visibile in videogames).

 

To assign the index of each vertex to the vertex itself you just need to add the index as vertex attribute

 

Vertices are made of "components" each component have arbitrary values (usually values that make sense to you. not to the GPU)

-Position

-Normal

-Uv

 

The type and value is totally free and dependent only on your needs, for example instead of using 3x32bit floating points for position, you could use a 3x16bit integer if your model is made of cubes, this is up to you.

 

Since every 3D model is made by vertices that are stored in a buffer, those vertices have a implicit index. You must tell to the GPU wich vertices to pick for each triangle,

 

Example (a quad made by 2 triangles => each triangle have 3 vertices, but there are only 4 totale vertices)

 

A -----------B

|    \            |
|         \       |
|              \  |
C------------D

 

Vertices:

ABCD

 

Indices

0,2,3,0,3,1

 

Triangle1:

0,2,3

 

Triangle2:

0,3,1

 

... Since attributes to vertices are totally custom instead of providing a "Vertex Color", you could provide a "Vertex Index"  so that when vertex is wrote to a stream who will read the stream will know wich vertex that was. but that's just because you'll need it.

 

For visible vertices look also at here: https://www.opengl.org/discussion_boards/archive/index.php/t-183434.html

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