public override double2 GetTexCoord(IntersectData data) { double3 n = GetNormal(data); n = ModelMatrix.Transform(n); double asin = Math.Asin(n.y); double ty = (asin + Math.PI / 2) / Math.PI; double atan = Math.Atan2(n.z, n.x); double tx = (atan + Math.PI) / (2 * Math.PI); double2 t = new double2(tx, ty); // Scaling //t.x *= 0.5; //t.y *= 1; return(t); }