Game Development Community

Skybox not showing (T3D 1.0.1 Mac 0S X) - RESOLVED

by Teifion Swift · in Torque 3D Professional · 04/20/2011 (12:11 pm) · 3 replies

Hi,

First real post here and I'm looking for help :(
I've been trying to get a skybox going & can't seem to get it to render at all.

I've followed the basic sky tutorial in the docs and everything seems to work ok except for the skybox. My feeling at the moment is that inexperience with Torque is leading me to miss something horribly obvious.

The cubemap seems to be showing up in the material editor though.

a quick piccy of the problem from the world editor - the skybox cubemap is shown on the right and part of the sky (which is really just black with a little sun glow) is on the left.

s1199.photobucket.com/albums/aa463/icckleblackcat/?action=view&current=NoSky...

The dml file (named sky_skybox.dml) contains just these lines:

space2_front
space2_back
space2_up
space2_down
space2_left
space2_right
space2_up

and the material file (material.cs) contains:


singleton CubemapData(space2Cubemap)
{
	cubeFace[0] = "./space2_right";
	cubeFace[1] = "./space2_left";
	cubeFace[2] = "./space2_front";
	cubeFace[3] = "./space2_back";
	cubeFace[4] = "./space2_up";
	cubeFace[5] = "./space2_down";
};

singleton Material(space2Material)
{
	cubemap = space2Cubemap;
};

Lastly, the mission file contains the following (which is to say - not a lot, just a ground plane, sun & skybox):

//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
   canSaveDynamicFields = "1";
      enabled = "1";

   new LevelInfo(theLevelInfo) {
      nearClip = "0.1";
      visibleDistance = "1000";
      decalBias = "0.0015";
      fogColor = "0.6 0.6 0.7 1";
      fogDensity = "0";
      fogDensityOffset = "1000";
      fogAtmosphereHeight = "0";
      canvasClearColor = "0 0 0 0";
      advancedLightmapSupport = "0";
         canSaveDynamicFields = "1";
         desc0 = "The Nadir Port";
         enabled = "1";
         LevelName = "Nadir";
   };
   new SimGroup(PlayerDropPoints) {
      canSaveDynamicFields = "1";
         enabled = "1";

      new SpawnSphere() {
         autoSpawn = "0";
         radius = "5";
         sphereWeight = "1";
         indoorWeight = "1";
         outdoorWeight = "1";
         dataBlock = "SpawnSphereMarker";
         position = "0 0 2";
         rotation = "1 0 0 0";
         scale = "1 1 1";
         canSaveDynamicFields = "1";
            enabled = "1";
            homingCount = "0";
            lockCount = "0";
      };
   };
   new GroundPlane() {
      squareSize = "128";
      scaleU = "12";
      scaleV = "12";
      Material = "BlankWhite";
      position = "0 0 0";
      rotation = "1 0 0 0";
      canSaveDynamicFields = "1";
         enabled = "1";
         scale = "1 1 1";
   };
   new Sun(Sun) {
      azimuth = "0";
      elevation = "35";
      color = "0.8 0.8 0.8 1";
      ambient = "0.2 0.2 0.2 1";
      brightness = "1";
      castShadows = "1";
      coronaEnabled = "1";
      coronaTexture = "core/art/special/corona";
      coronaScale = "1";
      coronaTint = "1 1 1 1";
      coronaUseLightColor = "1";
      flareType = "SunFlareExample";
      flareScale = "1";
      attenuationRatio = "0 1 1";
      shadowType = "PSSM";
      texSize = "512";
      overDarkFactor = "2000 1000 500 100";
      shadowDistance = "400";
      shadowSoftness = "0.15";
      numSplits = "4";
      logWeight = "0.91";
      fadeStartDistance = "0";
      lastSplitTerrainOnly = "0";
      splitFadeDistances = "10 20 30 40";
      representedInLightmap = "0";
      shadowDarkenColor = "0 0 0 -1";
      includeLightmappedGeometryInShadow = "0";
      position = "0.0152232 100.017 3.68072";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      canSaveDynamicFields = "1";
         Direction = "1 1 -1";
   };
   new SkyBox(skyboxSpace1) {
      Material = "space2Material";
      drawBottom = "1";
      fogBandHeight = "0";
      position = "0 0 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      canSaveDynamicFields = "1";
   };
};
//--- OBJECT WRITE END ---

If I place a diffuse map on the material the skybox shows that but obviously thats a static image. Any help at this juncture would me most appreciated :)

About the author

Recent Threads


#1
04/20/2011 (3:43 pm)
OK.. let me answer my own issue.

It seems this required a code change to set the normals correctly on the skybox, in the process it undoes a fix in the basic code.

environment/skyBox.cpp: function SkyBox::_initRender(): line 349 onwards

for ( U32 i = 0; i < vertCount; i++ )
{
      // Uncomment these lines to set the normals
      tmp = tmpVerts[i].point;
      tmp.normalize();
      tmpVerts[i].normal.set( tmp );

line 367:

// Comment out this line which sets all of the normals to 0
      tmpVerts[i].normal.set( Point3F::Zero );
}

Now the skybox displays as expected.
[/code]
#2
04/21/2011 (5:57 am)
As a note, this fix appear to work with T3D 1.1 Preview as well though I've only tested it in a Win 7 x64 VM on VMWare Fusion running on a Mac OS X 10.6.7 host.
#3
09/20/2011 (2:08 pm)
Is there any way to get this working with the fix they intended to implement by zeroing the normals?