Procedural Icicle Generator
Updated: Aug 1, 2020
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:

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:
Procedural Icicles
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.


Next Steps
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.

keo nha cai dạo này thấy mọi người nhắc hoài nên mình cũng bấm vào thử cho biết. Mình không đọc kỹ từng bài đâu, chủ yếu xem giao diện có dễ dùng không thôi. Vừa vào là thấy trang nhìn khá thoáng, chữ không bị dồn dập nên lướt một hơi cũng không mỏi mắt. Mình thích kiểu họ chia nội dung theo từng khối rõ ràng, nhìn phát là biết phần nào với phần nào, không phải đoán. Có mấy chỗ trình bày dạng bảng cột nên liếc nhanh là nắm được ý chính, đỡ phải kéo qua kéo lại nhiều. Thanh menu để ngay chỗ dễ thấy nên chuyển mục khá lẹ, dùng vài phút là quen…
Bài viết dễ đọc, ví dụ minh họa thực tế nên mình hiểu nhanh hơn, cảm ơn bạn đã chia sẻ. Mình thì hay xem thống kê XSMB mỗi ngày, cần tra lại cho tiện nên tự gom thông tin vào một trang riêng để khỏi phải tìm nhiều nơi. Bạn nào cũng quan tâm dữ liệu cập nhật theo ngày thì ghé xem thử https://graph.org/Soi-Cầu-XSMB-08-02-2
Mình mua vé số chủ yếu cho vui thôi, kiểu có cái để hóng kết quả mỗi ngày chứ không đặt nặng chuyện đổi đời. Trước đây nghe bạn bè bàn về “cầu kèo” này nọ, mình cũng tò mò thử theo dõi, lúc đầu rối rắm lắm nhưng xem một thời gian thì nhận ra đôi khi có vài mẫu hay lặp. Có hôm mình đọc mấy bài nhận định như https://soicauxsmb.io/phan-tich-xsmb.html rồi tự ghi lại vài ý ngắn, sau đó đem so với kết quả để kiểm tra xem có phải mình đang tự tưởng tượng không. Trúng được chút thì cũng vui, nhưng sai thì sai khá nhiều nên mình luôn tự nhắc đừng tin quá. Nói…
Mình thỉnh thoảng cũng lướt mấy bài phân tích xổ số miền Bắc cho vui thôi, kiểu đọc để xem người ta suy luận thế nào chứ không đặt niềm tin tuyệt đối. Hồi trước toàn nghe bạn bè rỉ tai, bảo “cầu này ngon” rồi ghi theo, nhưng trượt vài lần liên tiếp nên mình bắt đầu để ý hơn tới thống kê và cách giải thích. Có bữa vô tình đọc một bài trên soicauxsmb.pro, mới thấy nhiều “cầu” thật ra chỉ là nhìn dữ liệu theo cảm giác, nên mình tự hạ kỳ vọng xuống. Từ đó mình coi chuyện này như giải trí nhẹ nhàng, có chọn thì chọn ít, thử vận may là chính. Mình…