Shredders
By Ward Dehairs, October 10, 2023
Shredders is our love letter to snowboarding. Created with a “for riders, by riders” ethos, and a nod to all the snowboard gaming greats that came before it, Shredders is to snowboarding games what Skate was in response to the Tony Hawk franchise: a game that renews the emphasis on reality, where your primary focus is shifted from tricks and twists to lines and landings.
I was hired by I-Illusions, primarily to spend time working on complicated graphics requirements and problems of Schredders. I only worked part-time for a handfull of months but still managed to cover a big list of topics:
Splatmaps
Unity's terrain shaders work with splatmaps, a sort of controlling texture that allows us to paint other textures onto the terrain with appropriate fading and interpolation. A texture has 4 channels typically, so this system works with 4 splat textures at a time. Unity has a rather hare-brained approach to allowing more texture, you simply have to run an entirely different shader, the result of which is added on top of the first one. While this works fine for basic cases, it's inherently not compatible with a control texture that impacts tesselation. Tesselation offsets have to be calculated in one pass, so this restricted the game to 4 textures only. I investigated ways we could expand this, by encoding more than 5 splatmap values in one texture. Intuitively, one can use the 32 bits available in a pixel to encode multiple numbers, say 16 2-bit numbers, but we run into serious problem: We are wasting a lot of data since we don't typically mix more than 4 texture at a time, which is especially painful due to a loss in precision. I implemented several different approaches and finally landed on a system that stores an index and a value for 4 textures. With 16 textures, this leaves 5 bit of data per splat-value, for a total of 32 shades of interpolation.
Terrain-tiling
There was a special bug in Shredders where different sections of terrain occasionally had seams or even gaps between them. I was tasked with debugging this problem and managed to solve it. As it turns out this was caused by several factors working together: Firstly, the terrain was being tesselated and undergoing offsets based on the splat maps. This is fine, as long as the splat maps exactly correspond at the edges, which was not the case. Second problem was that the terrains were using custom normal maps. While these maps where actually continuous, they suffered from the problem that the shader does not interpolate between 2 different textures. To avoid additional sampling cost the normal maps were simply constrained to be exactly the same at edges that meet each-other, thus removing the need for interpolation entirely.
Stochastic sampling
Stochastic sampling basically means to randomize the appearance of a repeating textures. Repeating textures are of course ubiquitous in video games, so a general approach to randomize such a texture can greatly help in creating realistic environments.
This can be achieved by overlaying several random patterns that are sampling the same texture. Randomization is typically done via linear offsets or rotations. In our case, we went for linear offsets, since this allows us to create a shader function we can re-use troughout complex shader scripting used in Shredders, wherever needed.