EverEnding(?) DevBlog, February 2021: FX Machina

As usual, everything has taken longer than expected.

I started with creating the blur and outline effects. There are lots of tutorials and examples for effects like this out there, but none of them were entirely suitable – they tended to have certain assumptions about what resolution and distance the effect would happen across. In the end, I referred to these but ended up adapting them heavily. The real challenge came with the question of what to do when both effects are enabled.

Why would anyone ever enable both effects? I don’t know. Does it even make sense to make them compatible? No, not really. Wouldn’t this allow the user to use settings which cause absolutely ruinous performance hits? Sure would! In tandem, the effects add a cubic factor to the number of texture samples require to display a pixel. Still, I did it – and, now that I’m describing it in these terms, I suspect I may undo it before release, and try to rework things in a way that makes more sense for a reasonable person trying to do reasonable things with the shaders… and yet, so much of what I want to achieve with this project is enabling people to do unreasonable things! To quickly and easily create new, weird, and completely unprecedented visual styles – well, I’ll decide on that one in a few days. In the meanwhile, it works, along with a little performance report I added to the interface to give some idea how catastrophically inefficient whatever set of parameters the user currently has set are.

Speaking of UI, last month I was pondering the idea of overwriting the normal UI for the standard SpriteRenderer to make the interface for all the new stuff I was adding as intuitive as possible to access. I determined that while this was probably possible it was, in fact, a very stupid idea. This is because the UI can’t actually store data, so in order to do it I’d have to store all of the shader data in some secondary location. This would be a pretty fragile setup – it would probably break if the user copied/pasted the sprite object; it would definitely break if they moved it to a different project, where the sneaky background data object wasn’t even present. It was a fun idea to think about, but completely impractical – which is, to me, a far more satisfying resolution than it being something I couldn’t figure out at all, because now I at least have closure. In the end, I just took everything I’d learned and considered and applied it to the existing settings script, significantly improving its interface and usability.

A little while ago Derek Yu, creator of Spelunky among other things, shared a post describing different ‘Indie Archetypes’ – common reasons different people find finishing projects difficult described through archetypical characters. I immediately and strongly recognized myself in the ‘burrower’ archetype, the person who always prioritizes finding interesting solutions to interesting problems over ever actually finishing anything – in fact, this whole sprite shaders project is a classic ‘burrow’! In retrospect, choosing the name ‘Problem Machine’ may have been a clue that I would run into this issue. It’s become clear to me that I have something of a fixation on… not quite perfectionism, but on correctness. Things must be done correctly, accurately, precisely, or I experience discomfort and avoidance – or perhaps it’s more that they must not be done incorrectly, inaccurately, or imprecisely. In many ways I think this is an asset – it allows me to think deeply about what a thing’s purpose is, whether its form is suitable to that purpose, and how to make it more so. More often it has harmed me, led me to avoid situations where I’m not sure what correct looks like so I hesitate to do anything at all. To be clear – this isn’t a know-it-all thing, I don’t need to be right, to have claim to some kind of authority, I just need to know that what I’m doing is fundamentally appropriate – by some obscure hidden standard. This is part of why I keep adding features – because it seems like a moral failing somehow to release an asset that isn’t literally the best of its type that I can imagine… and I am very imaginative. The project still isn’t there, isn’t the best I can conceive of and presumably never will be, but it’s getting closer. I think soon it will be close enough that I can just release it and call it version 1.0 – you know, without getting weird about it.

I also, after a day of increasingly stressed brainstorming, finally came up with a name I like for the project – one which, unlike my earlier attempts, doesn’t seem to be already taken. Going forward, all of my Unity Asset Store projects are going to be branded as FX Machina – with this, the first, being FX Machina Sprites. I’ll probably add a bit more to the end of that in the store listing to signify that these are also for special effects and particle effects, but that’s going to be the official name.

Here’s where the project stands in terms of complete features, features in progress, and potential post-release features:

Complete

  • Depth/Shadows (with dithered transparency)
  • Blend Modes
  • Lighting w/ Normal Mapping (and alternate normal spaces)
  • Color Transformation w/ Masking
  • Displacement w/ Mapping
  • Vertex Transformation w/ Mapping
  • Mix-In Texture
  • Modifier Sprite
  • Vertex expansion for special effects
  • Pixel Snap/Scale
  • Blur
  • Outline

In-Progress

  • Documentation
  • Fire Demo/Tutorial
  • Portal Demo/Tutorial
  • Water Demo/Tutorial
  • Grass Demo/Tutorial
  • Dissolve Demo/Tutorial
  • Glitch Demo/Tutorial

Undetermined

  • Separate Source/Destination Displacement Maps for Modifier Sprites
  • Map for Blur Effect
  • Outline/Blur Mutual Exclusion

Post-Release (maybe)

  • Texture rotation
  • Texture value curve
  • Blur angle rotation
  • Normal Beveling
  • Deferred Rendering
  • Fog support
  • Smoothness/Metallic/Emission maps
  • Vertex Expansion for SpriteShapes
  • Vertex Scale Report
  • More Efficient Vertex Expansion for Rotation Displacement

It will probably take a week or so to finish the remaining planned features and demo effects, as well as fix whatever bugs I notice testing them out. I don’t know how long it will take to create the trailer, tutorials, and store page though – I’ve never done it before. All I can do is once again say that, goddamn, I hope this is the last update entirely about the sprite shaders.

Leave a Reply

Your email address will not be published. Required fields are marked *