Friday, August 3, 2012

Still Cannot Make a Gladius Skybox

‹prev | My Chain | next›

Up tonight, I would like to get my Gladius avatar running around an island. As of last night, I have a green, island-like thing. Tonight I need a sea and a horizon.

The sea is easy enough. I put a larger blue plane underneath the small green plane:
        space.add(new engine.Entity("sea",
          [
            new engine.core.Transform([0,2.7,0], [Math.PI/2,0,0], [10,10,10]),
            new cubicvr.Model(resources.plane_mesh, resources.blue_material)
          ]
        ));

        space.add(new engine.Entity("island",
          [
            new engine.core.Transform([0,2.6,0], [Math.PI/2,0,0]),
            new cubicvr.Model(resources.plane_mesh, resources.green_material)
          ]
        ));
That looks pretty decent:


If I rotate 45° around, the sea horizon is no longer quite flat:


I can probably live with that, but I would like to get a skybox (or more properly a skysphere) in place. CubicVR.js has its own, built-in implementation of SkyBox that might be ideal; however it is not yet support in Gladius. So let's see if I can do the next best thing.

The next best thing, in Three.js was to surround the entire scene with a sphere. To get that to work, I had to flip the faces so that the normal, the side pointing "out" was flipped to point to the center of the scene.

So I try doing the same in Gladius:
        skyMesh = resources.sky_mesh;
        skyMesh.flipFaces();
        skyMesh.prepare();
        space.add(new engine.Entity("skybox",
          [
            new engine.core.Transform([0,0,0], [0,0,0], [44,44,44]),
            new cubicvr.Model(skyMesh, resources.sky_material)
          ]
        ));
I know that my skyMesh object supports flipFaces() because (a) I am not getting any errors and (b) I can call it from the debugger:


And yet nothing happens. My sphere is still facing out when small:


And becomes completely invisible when it outgrows the scene. Bummer.

Like I said earlier, I can live without a skybox. For now. Especially if the CubicVR.js SkyBox is eventually exposed. So I call it a night here. I hope to play with collision detection tomorrow. I still doubt that I have the best Three.js solution. Hopefully Gladius has something better for me.

Day #467

No comments:

Post a Comment