Creating Fantasy Crystals in Unity

Going over how I made the shaders and scripts for fantasy crystals in Unity

Objective: Explain how I created some floating, fantasy crystals in Unity

The Functionality

To get the effect seen above, I utilized both C# scripts and ShaderGraph. To start things off, the main chunk of code I created to get the crystals to float as shown above is as follows:

I plan to modularize the script above in the future, but I will leave things like this for now. I also created a simple rotation script to handle rotation on any GameObject I attach this script to.

With these scripts, I then went ahead and created the ShaderGraph which gives the crystals the look they have. The ShaderGraph is as follows:

Lastly, I went ahead and created some particle effects and added some lights to fully create the look seen in the results below.

Results

These are just a few examples of what can be done with the shader and scripts I created. That’s all for today! Thank you for reading today’s article. In the next article, I will be starting a new 2D Mobile Game project!