Asked • 05/02/19

3D Game Geometry?

I have a simple game that uses a 3D grid representation, something like: Blocks grid[10][10][10]; The person in the game is represented by a point and a sight vector: double x,y,z, dx,dy,dz; I draw the grid with 3 nested for loops: for(...) for(...) for(...) draw(grid[i][j][k]); The obvious problem with this is when the size of the grid grows within the hundreds, fps drop dramatically. With some intuition, I realized that: - Blocks that were hidden by other blocks in the grid don't need to be rendered - Blocks that were not within the person's vision field also don't need to be rendered (ie. blocks that were behind the person) My question is, given a `grid[][][]`, a person's `x,y,z`, and a sight vector `dx,dy,dz`, how could I figure out which blocks need to be rendered and which don't?

1 Expert Answer

By:

Patrick B. answered • 06/02/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.