- Home /
How do I set mesh smoothing groups programatically?
So basically, I'd like to create a voxel based game in Unity. A problem that I'd like to solve before I begin is how to create smoothing groups and edit them on a mesh in unity. I'm sure it's possible, since the video I saw of Castle Story - http://www.youtube.com/watch?v=NwZdXRPeYrc - has a voxel system that seems as if it has programatically created smoothing groups on it's hill blocks. I'd like to know how they've achieved this. Thanks in advanced! :D
Additionally, I do know how to create smoothing groups in Maya or 3ds Max and then import them, this isn't what I'm after. I want to know how to edit the mesh's smoothing groups INSIDE Unity.
Answer by brycedaawg · Aug 12, 2012 at 02:54 PM
Okay, so it turns out vertex normals can be used to manipulate the lighting on a mesh's triangles just the same as smoothing groups in 3ds Max or Maya do. A GameObject's mesh's normals can be accessed via a C sharp script using 'GetComponent().mesh.normals'.
Here's a link to the script reference: http://docs.unity3d.com/Documentation/ScriptReference/Mesh.html
and here's a quick explanation of how vertex normals work: http://3dengine.org/Vertex_normal
Your answer
Follow this Question
Related Questions
"Import Smoothing Groups" Broken? 0 Answers
Having trouble getting a smooth collision with dynamic mesh collider 0 Answers
Grouping vertices? 1 Answer
Is there anyway to draw smooth 2d lines? 0 Answers
position change smoothed? 1 Answer