Guest User

Untitled

a guest
Jan 18th, 2018
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. Vector3 v = new Vector3(x, y, z) * 2f / gridSize - Vector3.one;
  2. float x2 = v.x * v.x;
  3. float y2 = v.y * v.y;
  4. float z2 = v.z * v.z;
  5. Vector3 s;
  6. s.x = v.x * Mathf.Sqrt(1f - y2 / 2f - z2 / 2f + y2 * z2 / 3f);
  7. s.y = v.y * Mathf.Sqrt(1f - x2 / 2f - z2 / 2f + x2 * z2 / 3f);
  8. s.z = v.z * Mathf.Sqrt(1f - x2 / 2f - y2 / 2f + x2 * y2 / 3f);
  9. normals[i] = s;
  10. vertices[i] = normals[i] * radius;
Add Comment
Please, Sign In to add comment