G
G
G Solomatin2020-01-28 19:29:51
OpenGL
G Solomatin, 2020-01-28 19:29:51

OpenGL and C++. What is the best way to sort polygons?

I have a hobby, writing a game engine in C++ and OpenGL. There are several hundred polygons in the scene. I learned how to detect collisions with polygons. I was also able to sort the polygons into groups to check for collisions first with the group and then with each polygon. But this is not the best option. Is BSP sorting suitable, or is there something better? And where can I read in Russian, maybe someone knows?

Screenshot of the game:

5e30609082e62992412192.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Shatunov, 2020-01-29
@MarkusD

To be honest, it's strange to see a question about OpenGL in the title and tags, and about collisions and, possibly, physics in the body of the question.
Visible space and collisional space are two absolutely different, but simultaneously existing spaces. The vertices of the visible space are extremely redundant for working in the space of collisions, the vertices themselves for high-quality transmission of visual information require many times more than is necessary for accurate simulation of collisions. For high-quality collision simulation, vertices must have completely different attributes, which in the same way will unnecessarily overload the size of the vertex for the render space. And OpenGL has nothing to do with the topic of collision simulation.
You need to have two sets of vertices. One is a set of vertices for object visualization. The second is a set of vertices to simulate its physics, not just collisions. And there can be many such sets. For simulating damage and deformations, for skinning, for hitboxes, for building paths, for sounds...
BSPs are more suitable for clipping visible geometry. Nowadays, this approach does not justify its costs, it is not used. QTrees, OTrees, or KD lists are better suited for efficient collision simulation.
You can start reading from here: Study path for game programmer . Your section: 9. Game Physics and Animation.
Next, here you are: https://gamedev.ru/code/articles/?physics
Yes, game dev is still alive, although it no longer belongs to Seryoga Vatkin.
It's better to go to Habr next: [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ].
Fabien Sanglard has a set of articles on the internals of DOOM 3 and Quake 3 , and there's material on collisions as well.
At this point, you should already have an idea of ​​the domain of collision simulation.

S
Svirex, 2020-01-31
@Svirex

I can recommend the book Game Programming in C++: Creating 3D Games: Creati... , chapter 10. Collision detection basics plus links to what to read for immersion.
Not in Russian, but in Russian, you will collect up-to-date information bit by bit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question