Game Development Community

Shadow Problem in Torque advanced

by Viren Thambidorai · in General Discussion · 05/26/2007 (4:41 am) · 19 replies

Hi guys,

first of all am newbie to torque so my question may sound stupid ...
actually , am facing problem with shadows ...

the problem is, so far i have understood is "dif" objects can be casted with the shadows but "dts" objects cannot , correct me if am wrong :)

i have created a level in which terrain is in "dif" & there is one more huge mesh say like train tracks which is in "dts" format... now the problem is, actor x casts shadow properly onlto terrain which is in "dts" format but when he walks onto train track made in "dts" ...shadow disappears!!!

Is there any specific reason that we cant shadows onto "dts" objects???
Also is there any way by which ( say by making changes in engine code ) i'll be able to get shadows onto "dts" object???

i undstd this is very macro level question, but am really looking fwd hear on this issue :)
Thanks folks!

#1
05/26/2007 (5:16 am)
Hello,

Yes, it is possible to cast dynamic shadows onto dts objects. It requires a very simple code change to one line of [TGE]. And the effects are very good, in my opinion. Max Thomas posted the fix in this private engine thread . . .

http://www.garagegames.com/mg/forums/result.thread.php?qt=29546

From your profile, it doesn't look like you have the engine SDK yet, but when you do, that link will be the place to find the shadows fix. It casts the shadows onto your DTS object's collision meshes, not the detail object meshes. But again, with a little planning, the effects can look very good.

[Edit: removed de-railing content and clarified one point]
#2
05/27/2007 (10:33 pm)
Hey Hi,

dat was real quick!

first of all, thx for the so quick response. Now mving mak to topic,

The solution given by u wrks absolutely fine with Torque 1.3 but am using Torque advanced.
also Torque advanced is written using DirectX 9 unlike torque 1.3

am kinda confused, coz i made changes specified in the thread given by simply cheking the similar file names n making changes , then later recompiling whole thing....but it dint wrked out!

mayb there is some other procedure to b used for Torque Advanced... can i get to know about it??

am i posting threads in proper area??
also, am wondering y my profile shows tht kinda info coz i do have torque advanced SDK licence with me.
mayb something left from my side....

waiting for reply...

Thanks :)
#3
05/28/2007 (5:49 am)
Yes, the pics I posted are from TGE, not TGEA. However, the lighting between the two engines may have enough similarities for you to migrate the TGE DTS shadows fix into the TGEA code.

Since I haven't seen a direct solution to this problem for TGEA, porting the code from TGE might be the only solution at the moment. It probably won't be easy or fun, but it *just* might be possible.

Now that I think about it, I really should have given that disclaimer and the extra info in my first post.
#4
05/28/2007 (5:59 am)
@Aaron - how did you get parallax mapping into tge?
#5
05/28/2007 (7:03 am)
[Edit: Removed de-railing content]
#6
05/28/2007 (10:44 am)
Aaron, that's really impressive. At first I thought you were using relief mapping. What kind of performance do you get when using real geometry?
#7
05/29/2007 (10:18 am)
[Edit: removed de-railing content]
#8
05/29/2007 (10:25 am)
I dont know if its just me or what; but that shadow quality(from Aaron's vid link above) looks like total butt! Is there any way to improve it more? I would rather NO shadow then have shadows that make my blind grandmother wish to poke her eyes out...
#9
05/29/2007 (2:11 pm)
Soft shadows are probably the best answer, I haven't looked at any implimentations though.
#10
06/01/2007 (5:07 am)
Hey fellas,

i have been still trying cast shadow on DTS objects in TGEA!
was quite successful with same effort in TGE 1.5 with simple FLAG addition :)

well, as per my understanding so far.... DTS means... TSStaic & DIF means Interior object related classes.. ( correct me if am wrong )

Now, i've been wandering arond everything to find the check where shadow casting algorithm decides,,,whther its a DTS object or DIF object to cast a shadow...

In SceneObject.cpp i found smthing like this....

if ((chain->object->getType() & mask) != 0 && chain->object->isCollisionEnabled())
 {
       if (chain->object->getWorldBox().isOverlapped(box) || chain->object->isGlobalBounds())
        {
             (*callback)(chain->object,key);
        }
  }

NOw this " mask " variable decides what kind of object it is... & this was the only change wht made shadow getting casted in TGE 1.5 , but same is not wrking with TGEA ?!?!?!

am confused dat for where else to look now... wht am doin at the moment is trying to see wht makes DIF object different from DTS object wrt shadow ...

IS any help available on this???

Thankx :)
#11
06/01/2007 (7:15 am)
@Viren Thambidorai

I apologise for de-railing the thread. It's way too late, but I've removed the pics and links.
#12
06/03/2007 (10:17 pm)
No probs :)
unless u giv me solution :D :D
#13
06/04/2007 (11:51 pm)
Yupppieeeeeeeee!!!! :D

after almost 10 days of research i got shadow wrking on DTS objects...

here's the procedure...

1. ..\engine\lightingSystem\sgObjectBasedProjector.cc

chnage from ...
gClientContainer.findObjects((AtlasObjectType | TerrainObjectType | InteriorObjectType ), sgShadowProjector::collisionCallback, this);

TO

gClientContainer.findObjects((AtlasObjectType | TerrainObjectType | InteriorObjectType | StaticShapeObjectType | StaticObjectType ), sgShadowProjector::collisionCallback, this);

2. ..\engine\game\shadow.cpp

from

U32 Shadow::smShadowMask = AtlasObjectType |TerrainObjectType | InteriorObjectType;

To

U32 Shadow::smShadowMask = AtlasObjectType |TerrainObjectType | InteriorObjectType | StaticShapeObjectType | StaticObjectType;


basically we r changing mask values for the castRay function which detects which type of surface it is...n it supports shadows for DTS now as well

3. I dnno it really helped me or not...but while trying i made these changes as well in script file of the dat DTS which was suppose to recieve shadow...infact i added this flag...

shadowEnable  =  true;

thx guys for all ur support
cheers!
#14
08/27/2007 (2:58 am)
Where and how is that last step done? The shadowEnable = true;

I have gotten steps 1 and 2 to compile and link and I am simply trying to get the cube, spheres, and blobs in the demo to cast shadows.

How do I go about doing that?
#15
08/27/2007 (12:19 pm)
I guessing you put it in the datablock of the dts you want to recieve the shadow.
#16
08/27/2007 (1:04 pm)
This does not fix the issue of DTS objects not casting a shadow onto terrain? That is actually what I was trying to get them to do.
#17
08/27/2007 (2:22 pm)
Researching a bit I am learning the specifics of which types DTS objects cast specific types of shadows.

I am also looking into Data Blocks. What I need to know is how to get these DTS objects to cast dynamic shadows on the Terrain.
#18
08/29/2007 (12:51 am)
Ok, so far adding a collision mesh to the box I tried to place on outside terrain did not cast a shadow. So, I am looking into the Data Blocks as a solution.

Anyone have any ideas on how to get DTS object placed into the game engine to cast dynamic shadows on outside terrain in TGEA?
#19
08/29/2007 (5:31 pm)
The original poster was trying to get dts objects to cast dynamic shadows on other dts objects.

DTS dynamic shadows already cast onto interiors, terrain, and Atlas from ShapeBase derived objects (Player, Vehicle, StaticShape, Items, ..., but not TSStatic which is a different type of object that casts static shadows onto interiors and the terrain).

For more info check out TDN'a lighting system section:

DTS Shadows

TGEA's DTS Dynamic Shadows