Ok a little update I managed to figure out a few things now the flat version I found quite simple to get working , but I am aiming for the spherical version and I am stuck on the code for the matrix generation if anybody can give me a little insite in to what im doing wrong. At the moment I am using this code, but I am sure it dosent work properly as I only get a broken up sphere , so is there something im doing wrong do I need to construct the matrix in a different way.
Vector3 ux, uy, uz, oo;
if (radius == 0)
{
// flat ocean
ux = Vector3.UnitX;
uy = Vector3.UnitY;
uz = Vector3.UnitZ;
oo = new Vector3(camtolocal.X, camtolocal.Y,0);
}
else
{
// spherical ocean
uz = Vector3.Normalize(camtolocal);// unit z vector of ocean frame, in local space
if (oldcamtolocal != Matrix.Identity)
{
ux = Vector3.Normalize(Vector3.Cross(new Vector3(oldcamtolocal.M21, oldcamtolocal.M22, oldcamtolocal.M23), uz));
}
else
{
ux = Vector3.Normalize(Vector3.Cross(Vector3.UnitZ, uz));
}
uy = Vector3.Cross(uz, ux);// unit y vector // negate this ??
oo = uz * radius; // origin of ocean frame, in local space
}
Matrix localtoocean = new Matrix(
ux.X, ux.Y, ux.Z, -Vector3.Dot(ux, oo),
uy.X, uy.Y, uy.Z, -Vector3.Dot(uy, oo),
uz.X, uz.Y, uz.Z, -Vector3.Dot(uz, oo),
0.0f, 0.0f, 0.0f, 1.0f);

Find content
Not Telling