Game Development Community

1.5 Lighting/Shadows weirdness

by Faraz Ahmed · in Torque Game Engine · 01/18/2007 (2:26 am) · 6 replies

We're in the process of moving our mission/art assets into 1.5 from 1.4 and things are looking scary with the shadows. Heres a sample screen of abnormal behaviour. The terrain below is an interior object (not the default terrain for the engine).

www.lotustechnic.com/temp/lighting.jpg1) Some shape shadows are cast as if the sun is vertically on top (it is at azimuth 145, elev. 45)
2) Some shape shadows shrink into a tiny size
3) Moving objects around in the mission editor randomly updates the shadow or simply leaves the shadow 'baked' into the terrain
4) Only player shadows behave normally

This is reaally worrying!!

#1
01/22/2007 (10:43 am)
You didn't provide any information on the types of objects and their datablock definitions, so it's hard to tell whats going on.

TSStatics bake static shadows into the terrain and interior light maps using the object's collision mesh, my guess is that the tree is a TSStatic and the collision mesh is relatively small compared to the rendered mesh.

The red object looks like ShadowCanMove is disabled on its datablock.
#2
01/22/2007 (9:10 pm)
Sorry about missing those essential details:

The cylinder is a StaticShape
The tree is a StaticShape
The logo is a StaticShape

The three above items were declared with the exact same datablocks that look like:

datablock StaticShapeData(dbscyl)
{
	category = "Field";
	shapeFile = "~/data/shapes/test/cyl.dts";
};

The player is the default Player datablock

None of the above are TSStatics.

Also note that when I place the same cylinder's dts in the scene with an ItemData datablock, it casts the shadow perfectly.
#3
01/25/2007 (7:49 pm)
This could be related to the shadows not moving, try this:

There's a fix in TGE 1.5 head that was made
after the release which could help - it requires changing
StaticShape::renderShadow to:

void StaticShape::renderShadow(F32 dist, F32 fogAmount)
{
        if(!mDataBlock->shadowEnable)
                return;

        bool allowanimate = mDataBlock->shadowCanAnimate &&
                (!(!mDataBlock->shape.isNull() && mDataBlock->shape->sequences.empty()));
        bool allowmove = mDataBlock->shadowCanMove;

        shadows.sgRender(this, mShapeInstance, dist, fogAmount,
                mDataBlock->genericShadowLevel, mDataBlock->noShadowLevel,
                mDataBlock->shadowNode, allowmove, allowanimate);

}

To get the full effect enable the datablock property shadowCanMove.

Let me know if this helps!
#4
03/15/2007 (1:57 am)
Sorry about the late reply. Didn't get a notification for some reason.

This did infact fix the problem, thanks. However the implementation is shaky where unless you explicitly set the datablock property shadowCanMove = true, you will get the weirdo dwarf shadows.
#5
03/15/2007 (8:01 am)
How do we access the TGE 1.5 HEAD?
#6
03/16/2007 (12:29 pm)
They stopped using the HEAD thing when 1.5 was released.