Surface-Stable Fractal Dither on Playdate

(aras-p.info)

138 points | by atan25 天前

6 comments

  • stuaxo22 小时前
    This was a great read. I'd like to see Elite (or just a scene from it) rendered with this, I reckon that would be pretty interesting on the play date.

    Using the handle to rotate your ship on the way into dock would be very cool.

  • WithinReason1 天前
    This looks bad since the resolution of the dither pattern is too low. Maybe mipmapping it would help?
    • qingcharles1 天前
      This definitely seems like the wrong platform to experiment with this technique. It's a lot of work to have such a poor result when there are other solutions which would produce much nicer results with less effort.

      Plus it is doing a wild amount of per-pixel computation for this.

      I don't wanna knock the author too bad, though. He put the hours in and he documented every step in serious detail, so mad respect for that.

      • gyomu23 小时前
        > This definitely seems like the wrong platform to experiment with this technique

        As an owner of a playdate, it’s kind of the wrong platform for… everything. So in that sense it’s right at home.

        You have to respect the vision, execution, and the commitment to the product - the hardware looks great and feels great.

        The games are all kinda gimmicky and obviously limited by the platform though. Falls squarely into the “I want to love this thing so bad, but I just can’t” camp.

        • mobiledev201418 小时前
          It’s definitely not for everyone but I feel like, of the people who were intrigued enough to buy one, you’re probably in the minority. I would have found it worth it just with the first season of games. It has exceeded my wildest expectations
      • madeofpalk16 小时前
        I'm sure doing it on the Playdate was the point.
      • brianpan1 天前
        His Game Boy Advance was probably out of batteries. Sometimes you gotta make do.
    • diffuse_l22 小时前
      You can estimate mip levels per triangle and subdivde them based on the wanted mip level across z lines, instead of doing the calculation per pixel. It's a bit wonky, but can work, at least for the bigger triangles.

      I've linked some code that does something along those lines for mipmapping [1].

      [1] https://github.com/Gil-AdB/REVIVAL/blob/0da65f18a34b74575a89...

      • WithinReason22 小时前
        yeah I was wondering if you could use blue noise mipmaps, trilinear sample from it, then round to 0 or 1. With the right mipbias it feels like it should look OK.
        • diffuse_l22 小时前
          Trilinear might be possible, but then you'll still need per pixel derivatives, no?
    • bjconlan1 天前
      Yeah I agree. The dithering effects in Everybody wants to crank the world[0] are much more visually satisfying but as you pointed out perhaps it's the levels of the textures that make it feel... Well like textures.

      [0] https://aras-p.github.io/demo-pd-cranktheworld/

    • cubefox20 小时前
      The dither pattern is not really aligned with the screen pixels. So you can't have just one black or white dot per pixel. The alignment is only approximate, so you have dots that are much larger than pixels.
  • amelius15 小时前
    The Playmate might be a cool device for geeks, but I don't see how it appeals to the general population, especially considering that you can get more from a typical smartphone.
    • pezezin6 小时前
      Even as a geek and a lover of retrogames, I don't see the appeal, it is just too weird.

      By the way, it's "Playdate", playmates are the Playboy ladies :P

    • jjj12313 小时前
      It doesn’t appeal to the general population, that’s not its goal.
    • chrisbrandow14 小时前
      That’s not really its purpose. I think it’s makers are generally going for a cool device for geeks
  • montag21 小时前
    This is a cool novel technique for sure, but for some reason I’m just not aesthetically in love with it. The fact that the pattern is surface aligned just…doesn’t add anything over dithering in screen space. And I really loved the dithering in Return of Obra Dinn. Is it just me?
    • Veedrac7 小时前
      The author of the technique has an explanation of why screen-alined dithering is hard in their FAQ. https://github.com/runevision/Dither3D/discussions/12

      Particular, it's hard to deal with anisotropy, and naive approaches to fix this hurt either break the operation as a dither with uniform dot sizes, or struggle to avoid becoming regular at angles.

      I agree with the claim, though, that you lose quite a lot by having the dither pattern stuck to surfaces. There is a charm to it for sure, but a high quality screen space dither would be cool. And so I experimented with some ideas and came up with one. Forgive the jank, I'm learning as I go.

      https://www.shadertoy.com/view/WfBGzK

      Note that this is using a random dither versus a patterned one, which I think hurts the aesthetics a lot, but I am certain this is incidental to the concept. I think there are probably much smarter techniques, and I have an idea for a large rewrite already, but those are details, just take this as a proof of concept.

    • chpatrick21 小时前
      I agree with you, it's technically very cool but Obra Dinn just looks better.
      • turnsout16 小时前
        Thought the same thing when the original Surface-Stable dither link made the rounds. There's just something off about 1-bit dither with perspective applied, but constantly shifting scale on different parts of the model.

        Super interesting thought experiment (and this version is an impressive exercise in optimization), but the aesthetic of Obra Dinn is in another league.

  • sneak1 天前
    TIL playdate has no GPU. i had assumed part of its appeal was being able to do intense modern graphics processing on an otherwise-retro display.
    • karlgkk1 天前
      Its appeal is that you have a target to build simple games against. It’s limiting, but on purpose.
    • ant6n1 天前
      Well it has a 168MHz arm, so assuming 20fps, you got 80 instructions to work with per pixel drawing - that’s a bit tight, but not overly so. In the 90s, games (like Quake) worked with much less.

      But this assumes that wait states of the memory or a funky way to access graphics don’t screw you over. I did a quick search, and couldn’t find detailed hardware specs (like pano docs for game boy, or gbatek for gba / Nintendo das).

      • yzydserd23 小时前
        It has a Cortex M7 180 MHz MCU. No real SIMD. Reasonable memory at 16MB but it is slow to r/w at about 30MB/s. DTCM 30x faster but you don’t get much to address, e.g. the stack is just 10KB. Framebuffer 12KB. System reserves the rest of the 64KB TCM. There’s just a 4KB cache. So the limiting factor is often memory access not cpu. The 400 x 240 1 bit Sharp Memory LCD has to be carefully addressed in horizontal strips of 32 bit words with weird endianness if you want high performance. It’s very possible to work at the maximum 50fps per full frame and do per pixel work and prep for blit in sub 15 percent of CPU. Almost all devs aim for and achieve 30fps. You can have effective 200fps if you like since not all rows need to be refreshed per frame. An interesting situation is the device had an earlier Rev A before the Rev B that 90% of users have, and with Rev A up to 30-50% slower you have to develop for the base device specs if you want to be inclusive. It makes you wonder about Rev C decisions. All that said, most games are written in Lua which runs 50x slower than compiled C on the device, yet many very fun games have been released. You can compile ARM intrinsics/asm but it’s a rare situation if you can beat the compiler. Working within all these constraints is part of the charm of developing for it. It necessitates a discipline of writing tight benchmarked code, even inspecting compiled instructions, if you want to push it.
  • cubefox20 小时前
    Surface-Stable Fractal Dithering - 182 points by bj-rn 29 days ago:

    https://news.ycombinator.com/item?id=42808889