Achieving Infinite Render Distance in my game
IGoByLotsOfNames · 878 words · 4 min read · EN-ORIG

Below is the complete, readable transcript of Achieving Infinite Render Distance in my game by IGoByLotsOfNames on YouTube. Read the full text, copy any part you need, or generate a transcript for any video with our free tool.
Z fighting is what happens when you put two objects at the same location. This happens because the game is unable to tell which object is in front of one another. But Z fighting can also happen when you put objects that are very far away from the camera, even though those objects are far away from each other.
And this is an issue in my sandbox game because I want to display objects that are up to tens of thousands of blocks away from the player. This Z fighting happens because of the same reason. The game is unable to tell which object is in front of the other. But how is that
even possible? First, we have to take a look at how games determine which objects are in front of other objects. But we also need to look at how games transform the world position of objects into pixel coordinates on your screen. Objects in the game are made of a bunch of connected vertices. And the position
of each vertex is represented by its x, y, and z position in the world. Turning this into a screen position involves linear algebra and matrices, which look complicated at first, but it's really just a bunch of addition and multiplication. We multiply the world position with a perspective projection matrix which transforms the position
into a set of four different numbers. The first two numbers represent the position of the vertex on your screen. But these two byproducts of the calculation are extremely important. The third number is the depth which is usually a value between 0 and one. A depth of zero means the vertex is very close to the screen while a depth of one
means the vertex is very far away from the screen. Now that we know the depth of each vertex, we can determine the depth of every pixel that is between each vertex using a bit of interpolation. The depth of each pixel is stored in a separate image called a depth buffer. So that when we draw
Transcribe another video
Paste any YouTube, Instagram or TikTok link to get a free transcript.