Commit graph

9 commits

Author SHA1 Message Date
toxieainc 6c24bf7c8f Optimize quad rendering by replacing the double computations for the area computation with the equivalent shoelace algorithm along with kahans algorithm to compute the cross products. In addition pull out the /w to the end, which increases precision even more.
Thus making the result similar to the fp64 version, tested e.g. with harleys first person mode (all artifacts still gone as before).

Improves perf on low end boards (e.g. Intel) dramatically (10fps with harley before, now 70 on my laptop), and even on higher end (e.g. NVIDIA laptop, quads are now faster than tri pipeline on my laptop).
2022-08-16 21:34:31 -07:00
Ian Curtis 6f6c98c671 The translator map seems to work with paletted colour values too, and the result is not clamped. Colours are passed to the GPU as unsigned bytes to multiplying by 16 will overflow, so we do the logic in the shader. If we passed floats we could skip the shader logic. 2020-05-11 09:05:46 +00:00
Ian Curtis 605dad2c02 Fix the sky in harley in first person mode where pixels in the sky are culled when they shouldn't be with the quad renderer. Basically we were running out of precision in a rare corner case. Doing the maths with double precision and casting back to float was enough to fix the issue. 2019-12-27 21:36:46 +00:00
Ian Curtis a5858e635d To calculate the mipmap value the opengl needs to calculate the difference in the texture coordinates between adjacent pixels. If there are no adjacent pixels the hw may need to spawn invisible fragments outside of the visible polygon. Our algorithm was culling these out so the mipamp calculation failed for edge pixels. Anyway this fixes quad rendering looking broken with the latest nvidia drivers. 2019-12-10 11:40:39 +00:00
Ian Curtis 864bb36b5a Technically backface culling should cull polys when the dot product = 0, since when it equals 0 the polys is perpendicular to the camera and thus invisible. When you complete sega rally2 (if you can get that far lol) the champagne is invisible. The reason is because all the face normals are 0. So when multiplied by the model matrix they are still 0 and get culled. Tweaking the condition to only cull polys when greater than 0 fixes this, and allows these 'bad' polys to render as they do on the model3. 2019-01-16 01:07:56 +00:00
Ian Curtis 6075352868 Optimise depth calculation for quad shader. 2018-11-27 20:43:27 +00:00
Ian Curtis 538a714086 Fade out microtextures with higher textures LODs. Fixes incorrectly applied microtextures in LA machineguns. 2018-10-23 00:16:23 +00:00
Ian Curtis 3eeec35e7c Correctly emulate the real3d pro-1000 texture modes in our shader. 2018-10-13 13:29:45 +00:00
Ian Curtis b5f9ad9651 Quad rendering engine. Set QuadRendering = 1 in the ini file to use, or -quad-rendering at the end of the command line to use. 2018-09-13 12:50:34 +00:00