This was a two part project for my Intermediate Graphics and Animation Programming class. There were two main steps for the project, the snowball shader and the procedural icicles. I worked with Zach Phillips, a systems and tools designer on the project. The following chart is a breakdown of our contributions in regards to the snowball shader:
Our first goal was to create a shader that looked like a snowball. We were heavily inspired by an AMD talk about procedural content in which the speaker created an ice shader (Link). Giving us a guide for the project, we wanted to try to recreate it ourselves in Unity. Following the presentation, we organized it into a UML diagram.
Once we figured out the layout of out program, we started writing it in HLSL in Unity. Zach worked on normal and height maps for the shader to determine where ice or snow is located on the surface of the model while I worked on the ice and sparkle layers. This was our final version:
Once I finished the base of the snowball shader, I started work on the procedural icicle generator. From the beginning, I wanted to create this program having seen a paper about it written by Jonathon Gagnon and Eric Paquette when I was doing research for the initial snowball shader. This itself is not a shader and is handled in C# in Unity 3D instead of in Unity's HLSL shaders due to the calculations performed and the data needed from each vertex. As it stands, it is a procedural icicle location generator and lacks the actual modelling and creation of the icicles.
A plane, called the source surface is placed above the model that icicles will form on. Random points on the source surface are chosen and cast raycasts straight down, simulating rain. On the model, at each vertex, the water coefficient, or the amount of water at each vertex is calculated, keeping in mind where the rain fell onto the model, the vertex's position on the model, and the max angle before a drop would fall. With these parameters, drip points are created as the locations where icicles would form on the model. The calculations performed on just a sphere take about 5 seconds to load. Below, the red indicates the waterfall from the source surface and the blue indicates to location of icicles.
I'm really proud of the overall results of our work. While the shader doesn't look realistic, I think it has a really cool style that could be implemented into a game. Moving forward with the shader, I would like to test it on different shaped models. We had tested it on the sphere, seen in the videos, and on a plane which did not have the same detailed look as on the sphere.
The algorithms for the procedural icicle generator were at times difficult for me to grasp, but I was able to complete all of the calculations up until actually forming the models for the icicles. In the future, I would like to optimize the calculations, maybe see if I can get them to a point that could be used in a game. Additionally, following the paper, the next steps are to form the icicle models using metaballs. I hope to revisit this project someday and learn the algorithm for creating metaballs and officially make procedural icicles.