Creating a sphere out of six planes

Hello,

I want to create a sphere from six planes (to use normal maps on them).
But I have problems with the math.
I got the math from here

Converted it to a formular I want to use in unity

     var mesh : Mesh = GetComponent(MeshFilter).mesh;
    var vertices : Vector3[] = mesh.vertices;
    var normals : Vector3[] = mesh.normals;

   for (var i = 0; i < vertices.Length; i++)
   {
        vertices *+= 	Vector3(Mathf.Sqrt(*

_ 1-(Mathf.Pow(vertices*.y,2) / 2)_
_ - (Mathf.Pow(vertices.z,2) / 2)
+ ((Mathf.Pow(vertices.y,2) * Mathf.Pow(vertices.z,2)) / 3)),
Mathf.Sqrt(
1-(Mathf.Pow(vertices.z,2) / 2)
- (Mathf.Pow(vertices.x,2) / 2)
+ ((Mathf.Pow(vertices.z,2) * Mathf.Pow(vertices.x,2)) / 3)),
Mathf.Sqrt(
1-(Mathf.Pow(vertices.x,2) / 2)
- (Mathf.Pow(vertices.y,2) / 2)
+ ((Mathf.Pow(vertices.x,2) * Mathf.Pow(vertices.y,2)) / 3)));
}
mesh.vertices = vertices;
Im fairly sure I did something wrong with the formular , im really not good in mathematics.
Thats how it looks like that:
![alt text][1]
You see its just wrong :slight_smile:
Its like its shrinked, it is not flat, its a little “rounded”, but its not like I want it, also much much too low poly (I tried it with a from 3ds max imported high poly cube, same result)
I used that formular from the website:
![alt text][2]
[1]: http://desmond.imageshack.us/Himg850/scaled.php?server=850&filename=cubej.png&res=medium*_

[2]: http://farm1.staticflickr.com/18/24013697_73e20d567a_o.jpg

Some thoughts: You should only need to deform one plane (Unity’s default plane has 10 x 10 cells, if you need more, use Blender to make one, or generate it from scratch). Make sure you are deforming in the correct direction for that plane.
Also you probably want to use = instead of += to assign the new values

okay i may have found out the problem although i am not sure, simply have:

var amount : float = 1.0f;
var refresh:boolean = false;
function Start () {
tryu();
}

at top then this
function Update () {
if(refresh){
tryu();
refresh=false;
}
}

//you be able to see once u keep pressing refresh it begins to turn into a sphere, although not perfectly atm, and thanks for sharing, p.s first time postin so sorry if its already anwsered