Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector3 v = new Vector3(x, y, z) * 2f / gridSize - Vector3.one;
- float x2 = v.x * v.x;
- float y2 = v.y * v.y;
- float z2 = v.z * v.z;
- Vector3 s;
- s.x = v.x * Mathf.Sqrt(1f - y2 / 2f - z2 / 2f + y2 * z2 / 3f);
- s.y = v.y * Mathf.Sqrt(1f - x2 / 2f - z2 / 2f + x2 * z2 / 3f);
- s.z = v.z * Mathf.Sqrt(1f - x2 / 2f - y2 / 2f + x2 * y2 / 3f);
- normals[i] = s;
- vertices[i] = normals[i] * radius;
Add Comment
Please, Sign In to add comment