News for hackers. Stuff that matters.
Re:Pico3D: Open World 3D Game Engine for the PicoSystem (RP2... by ggambetta on Sunday April 16, 2023 @10:09AM (#35590160)
Very impressive, and very fun :)

I wish I had the time to do this, but it looks like it would be relatively simple to modify render_rasterize.cpp [0] to do perspective-correct texture mapping [1]. I also wonder if going for a scanline approach [2] would be faster than iterating over the whole screen calculating barycentric coordinates?

[0] https://github.com/bernhardstrobl/Pico3D/blob/main/engine/re...

[1] https://gabrielgambetta.com/computer-graphics-from-scratch/1...

[2] https://gabrielgambetta.com/computer-graphics-from-scratch/0...

Re:Pico3D: Open World 3D Game Engine for the PicoSystem (RP2... by bstrobl on Sunday April 16, 2023 @10:22AM (#35590270)
I used some of your pages for my thesis so thanks for that :)! It is likely that a scanline rasterizer is more performant, but some of the triangles are really small on a 120x120px display, so just the sorting of up to 1500 triangles for each scanline may have its own drawbacks if many are tiny. One of the other reasons (aside from needed implementation time) for the current approach is also the hope that future microcontrollers might simply have more cores to throw at the problem so rendering could be parallized a lot faster simply by splitting rendering areas. Definitely plenty of room for improvement everywhere but time is sadly always a factor, hence why I hope others may be able to help ^^.
Re:Pico3D: Open World 3D Game Engine for the PicoSystem (RP2... by ggambetta on Sunday April 16, 2023 @04:53PM (#35594177)
Oh, that's very nice, we've come full circle :)

What do you mean by "sorting 1500 triangles"? You mean sorting their vertices? I believe you already do that in a couple of places; since you're using a depth buffer, I don't think you need to sort them back-to-front, so I'm not sure what you mean.

True that a 120x120 display is tiny, but that also means that you can get away with two static arrays of 120 elements for the left and right sides of the triangle, no need to do any allocation or use tons of memory.

Re:Pico3D: Open World 3D Game Engine for the PicoSystem (RP2... by bstrobl on Sunday April 16, 2023 @05:27PM (#35594428)
By scanline rasterizer I assumed a system similar to the original Quake scene rasterizer best described in Michael Abrash's Graphics Programming Black Book.

The method allows saving substantially on any overdraw since fillrate is really the primary bottleneck here.

I did a quick check on your page and it seems the implementation describes a per triangle setup vs the more complicated solution by Carmack and his team? Could still work well for larger triangles, maybe with a check on triangle size to avoid really small ones.

Quake did after all utilize 3 different rasterizers to optimize performance depending on use case.

Re:Pico3D: Open World 3D Game Engine for the PicoSystem (RP2... by benj111 on Monday April 17, 2023 @03:21PM (#35605242)
>we've come full circle

Triangle, surely...

Re:Pico3D: Open World 3D Game Engine for the PicoSystem (RP2... by throwaway5947 on Sunday April 16, 2023 @08:07PM (#35595335)
Currently writing my own software rasterizer, some interesting stuff I came across:

Fine grained visibility determination (span, coverage buffers, etc) https://www.flipcode.com/harmless/issue01.htm

Tom Forsyth, How To Draw Ugly Lines Fast https://cohost.org/tomforsyth/post/648716-how-to-draw-ugly-l...

Ned Greene, Hierarchical Polygon Tiling with Coverage Masks https://www.cs.princeton.edu/courses/archive/spring01/cs598b...

This UC Davis lecture video explains rasterization rules really well: https://youtu.be/z3fWd7G3mrU