Jen, came in to see what incredible things the engineers and artists had come up with. Everyone was staring at a television set hooked up to a development box for the Sony Playstation. There, on the screen, against a single-color background, was a black triangle.

Ever since I've read the diary about the black triangle, I've been thinking about filling a polygon at the assembly level, something "I feel like I know how to do" but never actually attempted. :triangle:

Let's give this a try, first finding the poly's bounds to see which points are inside, and which points are outside the lines.

I have it pretty much figured out, it was a matter of using signed routines, but I've realized something here, if I try and fill 20-30 polygons on the screen at once and move them around, uxn crawls to a halt. It might just be too slow to handle that sort of thing, I'm wondering if maybe I shouldn't consider a polygon painting port in the screen device to get native-like speed on that front, instead of uxn-space implementation of complex graphics which will just be too heavy for most platforms.

@neauoire that is a wonderful expression, thank you for finding and sharing it :)

@akkartik @neauoire i guess a broader term might be a “hello world” but different contexts all demand different types of hello world. so we have black triangles, fibbonaccis, and my own personal in joke, pongs (the minimal viable full game)

@zens @neauoire Ha, funny you should mention _that_. I built pong for the first time last might, and it was just a screen of code:

@zens @akkartik @neauoire Except, "hello, world" is meant to be the simplest you can do.

I think a black triangle is sort-of a hello world written on top of complicated jungles of code :P

@pixelherodev @akkartik @neauoire depends on what you’re calling code and which platform you’re on. i’d wager on psx back triangles is waaaay simpler than “hello world”- it’s jungles of code if it were something like opengl, sure. but the jungliest it gets on psx was poorly documented firmware routines

@pixelherodev @akkartik @neauoire to get to “hello world” on psx you’d need 20 black triangles, a font, a texture converter and so e routine to get the 20 triamgles on screen in the right order, hook them up to the right uv’s, and some functions to convert ascii to uv coordinates

Haha, that's a really good point :)

Hello, worlds aren't really simple; all the complicated "show stuff on a screen" is just taken care of for us these days...

@pixelherodev well… i mean, where we started were typewriters we had coaxed into typing in reaction to ascii codes. the machinery to do that was not simple but once it was built, typing hello world and getting the computer to say it back is about the simplest thing

@pixelherodev hello world started getting more complicated as software once we had to build a software typewriter first

@zens That's a good way of looking at it, yeah! I like that perspective :)


@neauoire I've been trying to think of good ways of drawing curves from very basic parameters, so eventually I can have something that draws a scalable fonts for things like puzzle game tiles 😊

Obviously there's lots of Bresenham stuff going on, but when it comes to things like quadratic/cubic splines the numbers get very precise and floating-point 😥

So I'm trying to come up with something that can boil down to 𝘹=𝘈𝘺²+𝘉𝘺+𝘊, with support of big magnitude changes for the constants… I think…


@alderwick nice! I've only got as far as drawing circles,

I'd like to dive into that stuff this winter :)

@neauoire In terms of your quest to fill polygons, then ear clipping is what I ordinarily recommend. I've not attempted that in 16-bit numbers before though 😉

@ruby0x1 Oh! I've skimmed through this a few years ago but didn't need it at that time, now this is very relevant, I'll try and follow their object structure and replicate.

@neauoire yea the basics are pretty much unsurprising but there’s fun nuance to be fast

@neauoire you can also check out the pico8 community for lots of good material on approaches

@ruby0x1 thanks :) I think the tinyrenderer is going to be perfect for this, I'm more familiar to translating C code to RPN than lua.

Should we be expecting PotatoDraw 3D libraries soon? 😁

@neauoire That might be a good idea.

Filled polygons are something that, AFAIK, basically every host should be able to do --- even if it's implemented over a software framebuffer by the host, it still avoids a lot of overhead in the emulation.

@neauoire that's what I did for the first vm I started on - pretended there was a PPU to do that. I'd bitten off more than I was capable of re: fixed precision 3D, but it's a nice way to do it.

if you add some options to the fill (e.g. I would use fill with charset pattern, or dither patterns for alpha), you'll wind up with a unique look to it.

@whtrbt It might be quite primitive, the principal use of this would be to clear specific areas of the screen, and draw large shapes that don't quite fit in spritesheets.

@neauoire yes. This is definitely a better way to handle this sort of thing imo - move stuff into a device and get it right once and don't waste rom space on rendering stuff.

I've been thinking about a gpu rendering device for uxn for a while haha. Super counter to a lot of the ethos but also, hardware 3d graphics in a 64k forth.

Software rendering is cool and portable so hey could implement a software raster backend for it too, but it's a short hop from there honestly

@maxc I was looking at the VM for Another World and it has a couple of vector drawing routines.. I wonder if there should be a specific device for this, and pack some other shape drawing things in there..

@neauoire @akkartik Pico8 uses that approach too, and has gradually extended the amount of drawing routines as folks did more 3d stuff (eg textured line with uv coordinates at each end so that textured tris can be rasterised quickly)


> Everyone was staring at a television set hooked up to a development box for the Sony Playstation. There, on the screen, against a single-color background, was a black triangle.

Was this playing in the background?

@vanderZwan @neauoire
I tend to think of great moments in coding history more along the lines of

@RL_Dane @neauoire Hah! :D

(I was referring to the moment in 2001 when the apes see the black monolith)

@vanderZwan @neauoire

Ahh, that's right. I was thinking it was from a later scene in the movie.

Sign in to participate in the conversation

Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.