OpenSWE1R / openswe1r

An Open-Source port of the 1999 Game "Star Wars Episode 1: Racer"
https://openswe1r.github.io/
GNU General Public License v2.0
313 stars 26 forks source link

Implement fog #135

Closed JayFoxRox closed 6 years ago

JayFoxRox commented 6 years ago

This PR adds Z-based fog. The fog depth is reconstructed from gl_FragCoord in the pixel shader. The used formula was not compared to actual hardware or against a D3D6 reference renderer. However, it's "good enough" for now.

Further testing in the future should be done to confirm these formulas. There are also other methods to reconstruct depth, some of which do eye-relative depth which D3D6 also supports (given a compatible ProjectionMatrix). An issue about this will be created after merge.

Ando Prime after

More screenshots / comparisons:

Closes #64