Procedural Planet Generation
Unity Engine | C# & Shader Graph | Tutorial-Based Project
About The Project
This project is a deep dive into procedural generation, focused on creating unique, detailed planets from scratch within the Unity engine. Following a comprehensive tutorial series by Sebastian Lague, the goal was to implement the complex mathematical and graphical systems required to generate a sphere with dynamic terrain, realistic lighting, and a customizable appearance.
Media Showcase










My Role & Technical Contributions
As the sole developer on this project, I was responsible for interpreting the tutorial's concepts and implementing them in a modern Unity environment.
-
Core Generation Algorithm: I implemented the fundamental planet generation logic in C#. This involved creating six distinct planes to form a cube and then mathematically "inflating" them into a sphere. This method ensures a much more even distribution of vertices than a standard UV sphere, which is critical for consistent detail across the entire surface.
-
Shading & Visuals: I created a custom shader using Unity's Shader Graph and the Universal Render Pipeline (URP) to control the planet's appearance. This included calculating surface depth relative to the planet's core to create realistic color gradients for oceans, beaches, and varied land elevations.
-
Custom Editor Tooling: To streamline the creation process, I built a custom inspector window within the Unity Editor. This tool exposed all the key generation parameters, allowing me to adjust settings like resolution, color palettes, and noise values, and see the planet update in real-time without needing to enter play mode.
Lessons Learned
-
Forward-Thinking Design & Optimization: A key takeaway from Sebastian Lague's methodology was the importance of building systems with future improvements in mind. This mindset encourages writing cleaner, more modular code. I also learned to be mindful of performance, optimizing function calls where possible to handle the complex calculations efficiently.
-
Adapting to Evolving Tools: The original tutorial used Unity's old Lightweight Render Pipeline (LWRP). Because I was working with a modern version of Unity, I had to independently learn and adapt the concepts to the newer Universal Render Pipeline (URP). This was a practical lesson in navigating documentation and understanding how rendering pipelines have evolved, reinforcing the need for adaptability as a developer.
-
The Power of Community Support: When I encountered challenges, particularly with API changes between Unity versions, the tutorial's comment section was an invaluable resource. The shared solutions and collaborative troubleshooting from the community were instrumental in overcoming roadblocks and successfully completing the project.
Future Improvements
This project has laid a strong foundation for a more ambitious simulation. Future plans include:
- Latitude-Based Biomes: Create distinct climate zones (e.g., polar caps, temperate regions, equatorial deserts) based on their latitude on the planet.
- Planet Randomizer: Implement a feature to generate a completely new, unique planet with a single click.
- Procedural Solar System: Expand the project to generate an entire solar system, with multiple, varied planets orbiting a central star.