jorio / OttoMatic

Pangea Software’s Otto Matic 🤖
https://pangeasoft.net/otto
Other
141 stars 13 forks source link

Reason for viewDef.view.clearBackBuffer = false? #29

Open orazioedoardo opened 7 months ago

orazioedoardo commented 7 months ago

On 5/10 levels, viewDef.view.clearBackBuffer is set to false. I don't actually know how it works but causes this ugly artifact.

jungle

If I set to true artifacts disappear without any apparent downside, it just shows flat green color outside the cyclorama. Shouldn't true be the default? By the way, it also applies to Nanosaur 2, though it's impossible to see without going out of the map.

jorio commented 7 months ago

In a nutshell, clearing the framebuffer used to be expensive, so you avoided doing it if you could get away with it.

In 2002 I was playing Otto Matic on a clunker with a GeForce2 MX400, which allegedly had a pixel fill rate of 400 million pixels per second.

At 1280x960, a common res back then, the framebuffer would be 1.2 million pixels. So, it might take a whopping 3 milliseconds to clear it. 3 ms is a lot of time if we're aiming for 60 FPS – nearly 20% of a 16 ms budget!

So, if geometry is supposed to cover the entire frame, you could eke out a few extra FPS by not clearing the frame. (Of course, the perf implications of glClear are different now.)

The issue with Pangea games from that era is that they didn't expand the terrain geometry very far outside the playable bounds, sometimes causing the "hall of mirrors" effect that you're seeing.

In an ideal world we'd keep this off and flesh out the terrain a bit – but I guess we could enable it by default (except in level 5 where this gives a ghostly quality to the edges of the floor).

orazioedoardo commented 7 months ago

In a nutshell, clearing the framebuffer used to be expensive, so you avoided doing it if you could get away with it.

I suspected it was due to performance reasons.

The issue with Pangea games from that era is that they didn't expand the terrain geometry very far outside the playable bounds, sometimes causing the "hall of mirrors" effect that you're seeing.

It used to scare me back in the PowerPC days, I thought a computer virus was corrupting the Mac.

foote-darrell commented 7 months ago

That Hall of Mirrors Effect.