Developed over 5 weeks during two separate periods in late 2024 and early 2025 (100% worktime)
Work: Shaders (HLSL)
I became curious of how shaders worked and decided to learn more during a course called "Spelprogrammering 3" where I made a interactive snow shader where a player could walk in the snow and leave a trail. I didn't quite like how it turned out and in next course called "Fördjupningsarbete inom spelutveckling" where we get to explore and deepened our knowledge in a field associated to game development I decided to take up the project again in order to develop it further.
Github project link: SnowShader
Version 1
The first time around when I begun to delve into shaders it was more about learning the basics and getting comfortable working with HLSL. But the course it was made for also had optimization aspects to it so I desided to learn a bit about that aswell with how tesselation could help to keep the visuals the same or better and also improve performace. This lead me to create a interactive snow shader with tesselation using ShaderLab and HLSL.
I wasn't too thilled about the results of this project, it worked okey and had interaction but didnt look great. I also had trubble getting shadows to work properly since I didn't make it from a surface shader but instead used a Unlit shader as base and thus had to add shadow manually. The biggest problems that came with shadow was the fact that I deformed the surface of the plane, deformation information I couldn't get shadowpass to aggnolage.
Something I did get out of this project was knowlege, both about shaders and HLSL, but also about the performace aspect of tesselation and that it accually had a pretty big impact
Version 2
This time around I already knew the basics and had a start to begin form so I had a lot more going for me this time around. One of the first changes made to this project was how interaction was captured.
The first version used a combination of two cameras and rendertextures. The first camera looking down on the plane with the shader only regestering things with a certain layer and drawing that to a rendertexture. The second camera looked at a plane projecting the rendertexture the first camera drew to and in turn drew what it saw to a different rendertexture. That rendertexture inturn saved what was drawn on it and removed it over time, giving it a fade away look.
The second version of this project used Unitys particle system istead and spawned particle of a certain color and layer which a ortographic camera the looked at. The fact that I used the particle system meant that I only needed one camera instead of two because the particles themselfs took care of the fade out effect through despawning settings.
The second version of this project used Unitys particle system istead and spawned particle of a certain color and layer which a ortographic camera the looked at. The fact that I used the particle system meant that I only needed one camera instead of two because the particles themselfs took care of the fade out effect through despawning settings.
Somethingells I also added to this version was deformation though a noice texture which can modify the aplitude and sampling from the texture. I also added different types of deformations though different colors on particles, this version has two different types of deformation: green and red. Green is the basic one, deformes a beneth the player to a changeable depth. Red deformes upwards instead and can be comined with the green in order create a kind of mound around the player to make it seem like snow is being pushed aside.
One other thing that was added in this version was flickering reflective spots on the snow to give the illusion that sun was hitting it and reflecting back. The spots are more concentrated where the directional light hits and there are no spots where the is shadows. The spots themselfs also moves positions between flickers in order to sell a more realistic environment. The reflectionspots are highly customizable with how big they are, how fast they flicker, how bright they are etc.
Lasty we have shadows which I had the same problems with as in version 1, I could not get the shadowpass to aggnolage the deformation of the plane which led to shadow that still don't look great around deformations. But I did some tweeking to the height of the pass which made it a bit better but the camera still need to locked so that it can't go below the height of the pass for it to look okey. Outside of shadow casted onto the plane I also had some internal shadow this time because of the deformations, there are some customizeable setting for these aswell in the shader.