Log In  

Cart #realtime_render-1 | 2021-02-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Hi! I've been working for the past two weeks in implementing a realtime rendering engine for pico-8. It really is just meant to be a tech demo. The performances when a lot of the screen pixels are filled are quite bad, but it works well if the objets are not too close to the camera :). I have simple directional lighting working at the moment and plan on adding more soon, starting with omni lights and spot lights.

Tell me what you think or if you have any optimization suggestions! :)

PS: I first started off as a usual rtr pipeline where all vertices were shaded, then used the vertex fragments into a rasterization pass, then processed the pixels fragments. The issue was that the memory cost for holding the pixel fragments was too great and the pico-8 would just run out of memory very quickly. By fully processing one triangle at a time, I ended up with much better cpu and mem performance.

Cheers!

edit: v1 Added render modes (triangle draw, pixel draw (old version), wiremesh. Also added point light support. The new triangle draw was inspired by other examples and the triangle draw method was borrowed from "cornell box" @freds72. The performances are now realtime, for real! :p

P#87494 2021-02-11 03:16 ( Edited 2021-02-15 03:45)

Welcome to 3d pico ;)

3d on pico is definitely doable but you need to adapt to the platform.
For ex, the barycentric rasterization technique is good but not in the context of pico8 (or at least not for realtime).
Same for the z-buffer (?) using pget, that's totally trashing performance.

Fast 3d on pico requires as few operation per vertex and as few operations per pixel.
e.g. using rectfill/line to draw a line of pixels is much faster than using pset.
Most of the literature you'll find assume a very fast cpu and a slow display system.
Pico is a different beast, learn the limits (ex: https://pico-8.fandom.com/wiki/CPU)

See: https://www.lexaloffle.com/bbs/?tid=35282 for a solid example.

P#87498 2021-02-11 06:47 ( Edited 2021-02-11 07:06)

Thanks for your reply @freds72! The example you suggested is indeed very impressive. I will definately look into it to improve my approach :)

P#87506 2021-02-11 12:02

hmm, for some reason, the new revision (v1) cart is timing out in my browser, but is working fine in pico-8. Can you people play the cart in your browsers?

P#87657 2021-02-15 03:48

[Please log in to post a comment]