Game
Floating Sandbox
6 years ago

Z-Buffer Work Is Finally Complete


Finally, after 21 days of work and 34 commits, the re-design of the depth management subsystem is complete!

Depth management in previous versions was exclusively based on depth sorting: ships were being drawn connected component by connected component, from the furthest to the nearest. This worked fine for a small number of connected components, but it caused a lot of lagging whenever a ship would be reduced to smithereens. The following screenshot is from 1.8, showing the FPS rate right after an anti-matter bomb has exploded on the RMS Titanic (the normal RMS Titanic FPS rate on my 2010 laptop is ~21):

5d0935f19848f.png

As you can tell, the large number of connected components - and thus the large number of OpenGL batches - caused the FPS rate to almost get halved, down to ~10 FPS.

The new depth management strategy makes instead heavy use of OpenGL’s depth test. Each vertex is assigned a “plane ID”, which is simply a sequential integer starting from zero and incremented for each connected component. Plane ID’s of vertices are then passed to the shaders, which use them as Z coordinates. This way I can now render all connected components in a single pass! Here’s the same screenshot from before, but from the upcoming 1.9.0:

5d0935f322053.png

The FPS rate is now ~22 - even faster than when the Titanic was whole :-)

I’ll now switch to working on a few low-hanging thinghies, before packing and publishing a shiny new 1.9.0 release. Stay tuned!



6 comments

Loading...

Next up

1.12 Screenshot #1

Sneak Peek at the New Water Flood Algorithm

Just as Pecaminosa's musicians #improvise this rendition of #LittleSunflower 🌻, so do we improvise with this post you're reading. 😂

What's coming out of your own improvs? 🤔

#Pecaminosa | #IndieDev | #OST | #Jazz

"Thanks guys for endless hours of fun." 👍

(My first fan art. Read the article, please.)

#sonic #mario #photoshop

Heya there! I really wanted to show you all a little gameplay preview of the first boss fight i'm currently working on i hope you like it ^^

Runestones: from concept to in-game model🗿

"Our work is never over" they said.

Back in my art school days I used to ride the 710 COPSA line from Parque Del Plata to Montevideo almost everyday. This is the Marcopolo Viaggio G4 Mercedes Benz model from the late 80s, one of the older bus models that was running on the line.

If you have more of an acquired taste, the restaurants in Niravasi have you covered! Maybe skip the salad bar, though.

Made my first ever animation.