This page looks best with JavaScript enabled

Procedural Mesh Generation in Unity 3D

 ·   ·  ☕ 1 min read

Time to jump into some of the fun sides of 3D Graphics! In this video we’re going to be figuring out how to build a 3D Plane in Unity with a given number of subsections. This will allow us to automatically create a new mesh at runtime to render in Unity.

This has a number of advantages. The biggest being the ability to easily tweak and modify what we are getting based solely on the results of our algorithm. If we know what we want we can build it!

Once we figure out what we’re doing we’ll delve into how to connect up vertices, how different sides of a mesh are culled or not and more. This mesh generation algorithm will form the basis for our deformed mesh simulation that we’ll be working on soon.

Grab the code on GitHub and play with it yourself: https://gist.github.com/runewake2/b382ecd3abc3a32b096d08cc69c541fb

Apologies in advance: I hadn’t designed any of this solution before hand so we had to cut to a quick white board session to figure things out and a lot of time is spent debugging. More than would have been necessary with proper design.

Read more about procedural meshes in the Unity manual: https://docs.unity3d.com/Manual/GeneratingMeshGeometryProcedurally.html


Sam Wronski
WRITTEN BY
Sam Wronski
Maker of things, currently helping build cloud things @ Google. World of Zero is a personal project disconnected from my professional work. Lets make something awesome together!