Elin Gammelli

Generalist Programmer and Technical Artist

Lanthera

Features of the computeshaders, shaders, and gameplay integration,

This was a very exciting project for me, as this was the first time I got to work with, and learn, shaders and compute shaders. The project lasted just under four weeks, with a proof of concept needed within 2 weeks. The GDC talk for "Kena bridge of Spirits" was a great source for inspiration of implementation. To make this easier for designers and programmers to use, I made video tutorials to help them. To achive the effect of light spreading, I used a texture, which represented the propogated light in the red channel in argb2101010 texture, light height in the blue channel, and lightsource in the alpha channel. A game object was responsible for calculating the XY world position as well as the Z wolrd position for the texture, also to follow the player. As the player moves, the offset also has to move with the player, this requires the texture pixels to move aswell. Therefore, the offset only moved if the player had moved sufficiently far away from previously calculated position. To transfer data to my shaders for monochrome, visible, and invisible effects, I created a shader manager game object, which transfered this data to each material of those shaders. Then, in the shaders I compared the fragment world position with the propogated light texture world position to determine alpha, alpha clipping, and if the texture should be monochrome or not. The shader manager was also responsible to update and validate the game object light sources(which handeled their initial registration by themselves). The light delegates similarly registered themselves to the shader manager, which then kept track of them. These performed asynchronous GPU read backs every few frames, to then delegate a read light value in the world, and forwarded it to linked light sources. Since the world z height was tracked, and mapped in the texture, I could calculate, to some degree, how much light/color should be spread upwards (or technically limit the height). Of course, this causes issue if multiple lights are close by, which could be resolved in multiple ways.

View more on Itch.io