Tuesday, June 12, 2012

Tiny Spherical Projections

‹prev | My Chain | next›

I have a nice (well, mostly nice) procedurally built sphere in Gladius. Tonight, I would like to explore mapping material onto that sphere.

My ultimate goal would be to project a rectangular map of the Earth (or other planet) onto the sphere. For now, I'll settle with projecting my silly example image:



To accomplish this, I am going to need UV projection mappings for each of the faces that I built yesterday. As I found, my faces have to be triangles, so I need to map triangular uv projections:
  var uv = [];
  for (var i=0; i<faces.length; i++) {
    uv.push([ [1, 0], [0, 0], [0, 1] ]);
  }

  var mesh =
  {
    points: points,
    faces: faces,
//    wireframe: true
    uv: uv,
    uvmapper: {
      projectionMode: "cubic",
      scale: [1, 1, 1]
    }
  };

This results in the following:



That is not quite what I was hoping for. Instead of projecting the image once on the entire shape, I have only succeeded in project the same image onto each face. The effect is interesting, but not what I want.

No matter what I try, however, I cannot get this projection to behave as I like. I try alter the scale property, the size of the UV points. I even try futzing with CubicVR.js properties to no avail.

Day #415

No comments:

Post a Comment