Unity to Godot Part 8: Particle Systems
More into graphics territory. For the last week (and more) I've been proceeding to another part of the port, which is "particle systems". I'm putting that in quotes because the original code started being used for particle systems, but ended up being used for render effects that are not really particle systems. After a bit of work, I ended up with some simple abstractions that allow the flexibility of the previous system, but at the same time trying to manage the tedium of setting up the GPU side of things. What does that entail?
- There's a base class for render effects, that can be configured statically if needed (e.g. which sprite, and other bespoke parameters), but also supporting dynamic data (again sprites, or some central position, or a list of points).
- Derived classes create the uniforms specification for the shader
- I've written a python script to generate GLSL and C# code for std140 layouts representing configuration structures. All the non-texture, non-buffer uniforms go into those structures.
- I've written a few python scripts to assist porting of shaders, e.g. replacing standard stuff from HLSL-like to GLSL (float2 to vec2, etc) or compiling from python for quick turnaround times
- I've now ported 12 such "particle systems", each with its own C# configuration code and shader files. I've got about 6 left
Funny little anecdote: youtube lately recommends my stuff to viewers looking for civilisation 6 or factorio, so I get more viewers than usual (1500 and 1000 for last two videos) and several of them express their confusion, and a few of them are intrigued. Not a bad thing! But due to "failed expectations" from the recommendation algorithm I do get more downvotes too, but that's expected.