Game Development Community

Player shadows with and without terrain??

by Jackie Hayes · in Torque Game Engine Advanced · 01/07/2008 (8:43 pm) · 13 replies

I have checked this against TGEA 1.0.2 and TGEA 1.0.3 clean build with and without polysoup. The problem is if you take out the terrain block from your mission and just use StaticShape, tsStatic or interiors (although interiors seem to work correctly) you get way to many shadows on your shapes.

Without the terrain in mission....

www.igysoft.com/gg/screenshot_001.jpg
With terrain in mission....

www.igysoft.com/gg/screenshot_002.jpg
I know things are way different in TGEA but this makes no sense?? Does anyone have any idea on how this can be fixed? I have been diggin through code for the past 4 days and can't find anything causing this.

Any help????? GG?????

Thanks!!!

#1
01/08/2008 (9:07 am)
Well....I still cannot understand why this is happening. I have been up most of the night digging through things and still cannot find figure it out.

Does anyone have any ideas or maybe if GG monitors this they could make a comment.....

Thanks!
#2
01/09/2008 (1:02 pm)
I'm still digging....:) Had to back off for a while, started makeing me get a headach.

Still asking if anyone has any thoughts.

Thanks!
#3
01/10/2008 (3:46 pm)
OK! This is getting extremely frustrating!! I got a CLEAN build of TGEA 1_0_3. Made NO changes! The problem still exists if do not use the TERRAIN BLOCK in your mission. I even tried it with ATLAS:

www.igysoft.com/gg/screenshot_003.jpg
You still get MULTIPLE SHADOWS on ALL StaticShape() objects from the player!

In player.cs the shadow code looks like this:

className = Armor;
   shapeFile = "~/data/shapes/spaceOrc/player.dts";
   cameraMaxDist = 3;
   computeCRC = true;

   shadowSelfShadow = true;
   shadowDTSShadow = true;
   shadowSize = 256;
   shadowProjectionDistance = 64;
   shadowMaxVisibleDistance = 50;
   shadowSphereAdjust = 1.5;
   shadowBias = 0.001;
   shadowAnimationFrameSkip = 0;

   canObserve = true;
   cmdCategory = "Clients";

Can SOMEONE at least tell me if they are having the same problem!

...... standing on roof fixing to jump ......
#4
01/11/2008 (10:02 am)
Jackie,

I ran some tests as you requested since I am pulling my hair out on an crossbow animation bug for TGEA.
Now I don't have the mission file you have nor the exact same shaped but here are my rough results.

//Fred on top of a box
development.virtra.com/fred1.jpg
//Fred jumps for joy at the multitude of bugs in TGEA!
development.virtra.com/fred2.jpg
(Notice the crossbow string *sigh*)
#5
01/11/2008 (11:49 am)
Thanks Chris...It has to be something else. This is from a newly downloaded TGEA1_0_3 with NO changes. This is what I did. I created a new mission and placed two simple cubes. One a StaticShape() and one a TSStatic(). I removed the TERRAIN BLOCK and replaced it with the ATLAS BLOCK from the Terrain_Water_Demo. The Atlas Terrain works great but as you see on the StaticShape() on the left there are the multible shadows. The DTS's are the same. It's just one is used as a ShapeBase Object and the other is a stardard TSStatic Object. I got the shadows working on TSStatics but I started having this problem so I am using a fresh download. It also does not matter if you set CastsShadows in the Sun Datablock to true or false. The shadows still get cast. It looks like there were a ton of changes made but know one knows that much about them (at least that is what I have found out). This is what I get now:

www.igysoft.com/gg/screenshot_004.jpg
This is my Mission File:
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
   canSaveDynamicFields = "1";

   new ScriptObject(MissionInfo) {
         name = "New Mission";
         desc0 = "A simple new mission template.";
         descLines = "1";
   };
   new MissionArea(MissionArea) {
      canSaveDynamicFields = "1";
      Area = "-360 -648 720 1296";
      flightCeiling = "300";
      flightCeilingRange = "20";
         locked = "true";
   };
   new Sky(Sky) {
      canSaveDynamicFields = "1";
      position = "336 136 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      materialList = "~/data/skies/sky_storm.dml";
      cloudHeightPer[0] = "0.349971";
      cloudHeightPer[1] = "0.3";
      cloudHeightPer[2] = "0.199973";
      cloudSpeed1 = "0.0005";
      cloudSpeed2 = "0.001";
      cloudSpeed3 = "0.0003";
      visibleDistance = "500";
      fogDistance = "300";
      fogColor = "0.1 0.1 0.1 1";
      fogStorm1 = "0";
      fogStorm2 = "0";
      fogStorm3 = "0";
      fogVolume1 = "0 0 0";
      fogVolume2 = "0 0 0";
      fogVolume3 = "0 0 0";
      windVelocity = "1 1 0";
      SkySolidColor = "0.1 0.1 0.4 1";
      useSkyTextures = "0";
      renderBottomTexture = "0";
      noRenderBans = "0";
      renderBanOffsetHeight = "50";
      skyGlow = "0";
      skyGlowColor = "2.34181e-038 1.29488e-038 8.26519e-039 2.57139e-039";
         fogVolumeColor2 = "128.000000 128.000000 128.000000 0.000000";
         locked = "true";
         windEffectPrecipitation = "1";
         fogVolumeColor1 = "128.000000 128.000000 128.000000 -222768174765569860000000000000000000000.000000";
         fogVolumeColor3 = "128.000000 128.000000 128.000000 -170698929442160050000000000000000000000.000000";
   };
   new Sun() {
      canSaveDynamicFields = "1";
      azimuth = "115";
      elevation = "145";
      color = "0.1 0.1 0.1 1";
      ambient = "0.4 0.4 0.4 1";
      CastsShadows = "1";
      useBloom = "0";
      useToneMapping = "0";
      useDynamicRangeLighting = "0";
      DRLHighDynamicRange = "0";
      DRLTarget = "0.5";
      DRLMax = "1.4";
      DRLMin = "0.5";
      DRLMultiplier = "1.1";
      bloomCutOff = "0.8";
      bloomAmount = "0.25";
      bloomSeedAmount = "1";
   };
   new AtlasInstance2(NewTerrain) {
      canSaveDynamicFields = "1";
      position = "-585.217 -596.311 184.4";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      detailTex = "~/data/terrains/details/detail1";
      atlasFile = "~/data/terrains/arcticBlended.atlas";
      lightmapDimension = "256";
   };
   new SimGroup(PlayerDropPoints) {
      canSaveDynamicFields = "1";

      new SpawnSphere() {
         canSaveDynamicFields = "1";
         position = "-53.7055 -89.0546 131.5";
         rotation = "1 0 0 0";
         scale = "0.940827 1.97505 1";
         dataBlock = "SpawnSphereMarker";
         Radius = "10";
         sphereWeight = "1";
         indoorWeight = "1";
         outdoorWeight = "1";
      };
   };
   new SimGroup(ClientMissionCleanup) {
      canSaveDynamicFields = "1";

      new GameBase() {
         canSaveDynamicFields = "1";
         position = "0 0 0";
         rotation = "1 0 0 0";
         scale = "1 1 1";
         dataBlock = "PlayerFoamDropletsEmitter";
      };
      new GameBase() {
         canSaveDynamicFields = "1";
         position = "0 0 0";
         rotation = "1 0 0 0";
         scale = "1 1 1";
         dataBlock = "PlayerFoamEmitter";
      };
      new GameBase() {
         canSaveDynamicFields = "1";
         position = "0 0 0";
         rotation = "1 0 0 0";
         scale = "1 1 1";
         dataBlock = "PlayerBubbleEmitter";
      };
   };
   new StaticShape() {
      canSaveDynamicFields = "1";
      position = "-118.948 -90.644 121";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      dataBlock = "testBox";
      receiveSunLight = "1";
      receiveLMLighting = "0";
      useCustomAmbientLighting = "0";
      customAmbientLighting = "0 0 0 1";
   };
   new TSStatic() {
      canSaveDynamicFields = "1";
      position = "-118.048 -106.564 121";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      shapeName = "~/data/shapes/tdp/testBox.dts";
      receiveSunLight = "1";
      receiveLMLighting = "0";
      useCustomAmbientLighting = "0";
      customAmbientLighting = "0 0 0 1";
         usePolysoup = "0";
   };
};
//--- OBJECT WRITE END ---

This is the testBox DataBlock:
//begin script

datablock StaticShapeData(testBox)
{
   category = "Misc";
   shapeFile = "~/data/shapes/tdp/testBox.dts";
   shadowEnable = true;
   shadowCanMove = false;
   shadowCanAnimate = false;
   shadowSelfShadow = true;
   shadowDTSShadow = true;
   shadowSize = 256;
   shadowProjectionDistance = 256;
   shadowSphereAdjust = 1.5;
   shadowBias = 0.001;
   shadowAnimationFrameSkip = 4;

   shadowSelfShadow = true;
   shadowDTSShadow = true;
   shadowSize = 256;
   shadowProjectionDistance = 64;
   shadowSphereAdjust = 1.5;
   shadowBias = 0.001;
   shadowAnimationFrameSkip = 0;
    
};

function Box::onAdd(%this,%obj)
{
    //%obj.playThread(0,"blink");
}

function StaticShapeData::create(%block)
{
    %obj = new StaticShape()
    {
       dataBlock = %block;
    };
    return(%obj);
}

//end of script

It has to be something else! I emailed John Kabus yesterday since he is the one that did all the sgShadow stuff. I have not heard back from him yet. Hopefully he'll check his email and let me know what he thinks.

I completely agree about the bugs and the c++ code blocks that do absolutely nothing. It gets very confusing very quickly!

I was looking at your crossbow problem. It looks like the string animation sequence it not being triggered. If you look at the weapon in the mission before you pick it up the strings are the same. In TGE1.5.2 and earlier it worked fine. I even copied the weapon.dts from tge1.5.2 to tge 1.0.2 and tgea 1.0.3 and the strings did not animate. Did you look at how it was being handled in TGE 1.5.2 or earlier? I'll see if I can't look around for you a little. Sometimes if you get more than two eyes looking at something it can be found faster.

Thanks again for responding!
#6
01/11/2008 (12:38 pm)
Chris...I checked all the way back to April 2006, when it was TSE. The Crossbow string did not animate even back then. Which is telling me that it was never implimented. It has to be in the engine because it works fine in TGE1.5.2 and before. I'll keep looking.

Jackie
#7
01/11/2008 (4:28 pm)
Jackie can you zip and send me your entire scenario I have not been able to reproduce it with just the above. Also there are additional clipping issues with items too! I have tracked the crossbow string down to a rotation issue in the dts animations and is tangled somewhere in the tsShapeInstance/tsThread mess. For some reason the rotation does not get updated overtime on the string nodes because there are actually 4 string nodes! TGE references the nodes as "left string 200", TGEA references the "left string" there does not appear to be much change in the shape stream loading code though. As for your issue it looks to me like the texture pipeline isn't being reset properly but its hard to check into without replicating it!
#8
01/11/2008 (6:38 pm)
Chris...I have it zipped up and ready to go. It's about 20meg. You don't have an email address in your profile so let me know what it is and I will send it to you.

Thanks!
#9
01/11/2008 (9:29 pm)
Chris...What is your email address?
#10
01/14/2008 (8:32 am)
Sent you an e-mail with an FTP sorry for spamming your thread don't know how my browser was resubmitting the post data without prompting me!
#11
01/14/2008 (9:28 pm)
Ok, found a bug, but I can't imagine that it ever worked this way before (though it did work), so it might have been removed for causing problems elsewhere.

The fix; in engine/lightingSystem/sgObjectBasedProjector.cc line 792 add the following code:

// need to set these in case of fast partition rendering...
	GFX->setTextureStageMagFilter(0, GFXTextureFilterPoint);
	GFX->setTextureStageMinFilter(0, GFXTextureFilterPoint);

	[b]GFX->setTextureStageAddressModeU(0, GFXAddressClamp);
	GFX->setTextureStageAddressModeV(0, GFXAddressClamp);[/b]

	sgShadowShader->shader->process();

And at line 854:

GFX->setTextureStageMagFilter(0, GFXTextureFilterLinear);
	GFX->setTextureStageMinFilter(0, GFXTextureFilterLinear);
	[b]GFX->setTextureStageAddressModeU(0, GFXAddressWrap);
	GFX->setTextureStageAddressModeV(0, GFXAddressWrap);[/b]
	GFX->setTextureStageColorOp(0, GFXTOPDisable);
#12
01/16/2008 (3:40 pm)
Thanks John...Worked like a charm!

Chris..Since John fixed this I did not send you the files. If you still wanted to see them I'll send them to you.
#13
01/16/2008 (4:15 pm)
No need! Nice to see they actually got back with a solution for the texture pipeline. I hope they do the same with the DTS crossbow animation!