afritz1 / OpenTESArena

Open-source re-implementation of The Elder Scrolls: Arena.
MIT License
915 stars 68 forks source link

Software renderer redesign for 0.15.0 #223

Open afritz1 opened 2 years ago

afritz1 commented 2 years ago

The existing software renderer is a naive 2.5D ray caster and retains several poor design choices from the past few years. Although it has a couple optimizations like multi-threading and per-pixel-column occlusion culling, it was meant only for prototyping new features. I am rewriting it for 0.15.0 so it is actually decent (more importantly: optimizable) and can match Arena's appearance more closely with 8-bit palette colors instead of true color.

Part 1

Part 2

Branch naming convention: sw-renderer-redesign-part-#

afritz1 commented 1 year ago

Revised roadmap as of 1/13/2024.

Part 1

Part 2

Part 3

afritz1 commented 11 months ago

252 is a big enough issue with rain/snow that it should be considered a blocker for finishing part 3.

afritz1 commented 6 months ago

Done with #252.

afritz1 commented 5 months ago

Going to skip harder optimizations like occlusion culling and just optimize the rasterizer and shaders a more conventional way with fewer special cases/algorithms/etc..

Ideally opaque meshes would draw front to back without depth reads and then sky would draw after it with a depth < INFINITY check, but that's too hard to implement, so instead going to draw sky first and then everything else after it.

afritz1 commented 5 months ago

Deciding how to handle tiled rendering with puddles and ghosts, because these two shaders have to read from the frame buffer. I think trying to do multi-pass shading is a good idea instead of coming up with a complex tile scheduler to keep threads from blocking on unfinished tiles.

afritz1 commented 2 months ago

Added multi-threading today but performance is still poor even with very high threads. I think the binning design will need to change so they store much more work for each thread, instead of needing threads to synchronize every 8 or so draw calls.