libretro / flycast

Flycast is a multiplatform Sega Dreamcast emulator. NOTE: No longer actively developed, use upstream repo for libretro from now on - https://github.com/flyinghead/flycast
http://reicast.com
GNU General Public License v2.0
155 stars 78 forks source link

Cannon Spike compatibility [$10] #27

Closed inactive123 closed 6 years ago

inactive123 commented 6 years ago

Apparently Reicast still has several graphical issues with this game.

Graphical glitches can be seen here -

https://github.com/reicast/reicast-emulator/issues/898

The goal of this bounty is to be able to play this game without these severe graphical glitches.

--- Did you help close this issue? Go claim the **[$10 bounty](https://www.bountysource.com/issues/58466197-cannon-spike-compatibility?utm_campaign=plugin&utm_content=tracker%2F49543223&utm_medium=issues&utm_source=github)** on [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F49543223&utm_medium=issues&utm_source=github).
blackman91 commented 6 years ago

So, how do I donate to this bounty?

inactive123 commented 6 years ago

I added $10 to the bounty. In order to add your own money, go to Bountysource, take the URL from this issue, input it into the bar below the text 'Paste any URL to post a bounty.'. From there you can then add money if you are already signed on. You can also sign on there using your Github account.

blackman91 commented 6 years ago

Apparently this fixes all the Cannon Spike graphics bugs: https://github.com/reicast/reicast-emulator/issues/1144

Depth Buffer Fixes On the Dreamcast, vertices are submitted for rendering in screen space, with the z component being equal to 1/w. These values are not normalized to any particular range, which is fine for the PowerVR's 32-bit floating-point depth buffer. When rendering in OpenGL, these vertices must be converted back to normalized device coordinates. While unprojecting the x and y components is trivial, getting a z value that maintains the same depth ordering is not. Originally, redream linearly scaled the z-component to the range of [0.0, 1.0] with the equation z = (z-zmin)/(zmax-min) and passed it off to the depth buffer. This worked ok for many games, but some games had an extremely large z range (e.g. zmin of 0.000001 and zmax of 100000.0) which caused a serious precision loss when normalizing, especially after the value was quantized to a 24-bit integer to be written to OpenGL's depth buffer. After writing a small tool to measure the accuracy of the results of different normalization methods, the previous linear scaling was replaced with the logarithmic equation z = log2(1.0 + w) / 17.0. Using this method, the accuracy of the depth ordering went from as low as 30% to 99% in every problematic scene I could get my hands on.

inactive123 commented 6 years ago

This is fixed now in latest master.

blackman91 commented 6 years ago

Any way you could fix it in standalone reicast too?

blackman91 commented 6 years ago

Any chance you could you transfer the bounty to: https://github.com/reicast/reicast-emulator/issues/898

Now that they have bounty support that would be cool. The issue is still present in standalone reicast.