indigo
indigo copied to clipboard
Spike: Variable precision to allow non-pixel-art graphics
No idea if or when I might get around to this, but I wonder about it from time to time so I thought I'd capture it.
This ticket is just to spike through the problem and find out how much work it is. In case anyone is feeling adventurous, here is what I think it looks like.
Assumption: You're going to render pixel art or smooth graphics. Not both at the same time.
Although I make you all work in integers, taking a simplistic view, there is a moment in the rendering pipeline where everything is a Float
(during scene processing). This is because a) graphics cards all deal in floats, and b) JavaScript has no idea what an integer is anyway. Therefore there are two things to investigate:
- The Scala side - what is a nice way to expose the option of using
Vertex
andBoundingBox
in place ofPoint
andRectangle
everywhere, and how do we signal to the engine which mode we're in? (So that it can choose the right types and the right set of shaders and so on...) - The WebGL bit - the shaders do work to draw everything on the pixel, but not-on-the-pixel is what WebGL does by default. What does generating shaders in the different modes look like? There are are other gotcha's too, like a) the fact that we actually render everything at 1:1 and upscale that would need an alternate approach in 'smooth' mode, and b) things like the shapes do not know how to render non-pixel-art (but if you're rendering in sub-pixels that might turn out to be a non-issue - who knows!).