Voxel Grid Visibility
cod.ifies.com·13w·

Background #

Suppose you’re making a game full of cubes in a voxel grid. To start, you simply render every cube with twelve triangles, two for each face. Helpfully, the GPU discards triangles that are facing away from the camera.

vistri=facingCamera \text{vis}_{\text{tri}} = \text{facingCamera}

Many faces are invisible because of an adjacent cube, so you stop rendering them.

vistri=neighborIsNotSolid∧facingCamera \text{vis}_{\text{tri}} = \text{neighborIsNotSolid} \land \text{facingCamera}

Drawing triangles individually is slow, so combine all the visible triangles in a 16×16×16 16 \times 16 \times 16 section into a buffer and render them together as a single mesh. To start, all sections are…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help