Mental Break Day
Hey Folks! Since I was having a bit of trouble deciding what design feature to add to the space prototype next, I decided to shift gears a bit, and tackle something else I've been wondering about: custom shaders and rendering.
A while back, I commissioned some of Amandine Coget's time to do a project audit, to get a better idea of where the game's problem areas might be. Particularly as it relates to performance, rendering, and other general Unity setup. I wanted to know if I was approaching things sanely, and if there were any opportunities I was missing.
A chunk of her report dealt with the rendering setup I was using, and how that could be improved. Since I used Unity's standard shaders and lighting to render hundreds (thousands?) of lit sprites on-screen, I was likely to hit a performance wall. (And in fact, I kind of already have with some of the larger ships and stations.)
She also pointed out that, from a marketing point of view, rendering is an opportunity to attract attention. Particularly if the style of the game is a sort of calling card.
In my mind, the rendering style I wanted was sort of a top-down, pixel art version of Alien Isolation. That sort of moody lighting and realism mapped onto pixel art sprites. And my first stab at that was to use normal-mapped sprites on quads and cubes, and Unity's standard lights to generate highlights, shadows, and attractive lighting. And this works fairly well as long as the number of items (and especially lights) are low.
It turns out there are some other techniques that look as good, if not better, and are also cheaper to do if you're limited to 2D. It goes by a few different names depending on the author, but is usually some combo like "2D global illumination," "2D radiosity," "ray-marching," or similar.
The best example I've seen so far is Lexi Dostal's. If what he says is true, this allows near-infinite lights, global illumination, shadows, arbitrary light shapes, and performance is really only bound by resolution.
In any case, this is a problem in a different space for my brain, so gives my design brain a bit of a vacation, while still doing something potentially useful. Specifically, learning more about how Unity handles things like render textures, shader passes, off-screen rendering to specific target resolutions, etc. I've already learned a few tricks which I'll likely pull over to the space prototype once I find settings I like.
Today's screenshot isn't anything impressive, unless you know what's going on under the hood. Namely, the game is rendering a 3D scene to a 64x64 texture, passing the scene through some shader processing to isolate geometry from background. The colored gradient you see is the beginning of a signed-distance field to be used for light calcs. And this 64x64 texture is projected onto a surface that another camera points at, which is the one the player sees, upscaled without anti-aliasing for pixel art preservation.
Again, kind of invisible complexity. But some important bedrock for pixel art plus lighting. And more importantly, brain recharging :)