Game Development Community

Player shadow distance help

by Torbjorn Leksell · in Torque Game Engine · 01/26/2006 (4:27 pm) · 8 replies

I'm just wondering how you edit the distance on which the shadow of the player model is rendered (Onto .dif's) As it is now the shadow disappears at a fixed distance and I would like to increase it so that you can see it from farther away.

Anyone who knows?

#1
01/27/2006 (7:26 am)
Hi Torbjorn,

Are you using TLK 1.3.5 or 1.4 (the solution is different for each)?

-John
#2
01/27/2006 (12:57 pm)
@John: Im using TLK 1.4
#3
01/27/2006 (2:37 pm)
Cool, if you open up the TLK file "sgShadow.h" and go to line 83 you should see this:

F32 shadowLen = [b]10.0f[/b] * mShapeInstance->getShape()->radius;
	Point3F pos = mShapeInstance->getShape()->center;


You can increase the "10.0f" to make the shadows longer.

Let me know if this helps!
#4
01/28/2006 (12:42 am)
@John: Oh, I can see now that I have been unclear in my question. I was not referring to the shadow cast distance but rather to the camera render shadow distance. The problem for me isn't that the shadows don't stretch long enough but that they rapidly fade away and completely stop to draw when the camera is getting to far away from the player model (Or any other dts object that casts shadows). This does happen in the standard 1.4 version, but at a much greater distance. Sorry for not being specific enough with my question :/
#5
01/28/2006 (2:24 am)
Hehe, no problem. :)

Ok, this is a slightly more complex problem. The shadows in TLK are technically set to fade out at the same rate, however they were made a little dimmer because there are multiple of them (when around lights that affect DTS objects).

There are a couple of ways to handle this; disable multiple shadows by setting "$pref::TS::sgMultiDynamicDTSShadows" to false in the console, darken the shadows by increasing the value of "SG_DYNAMIC_SHADOW_INTENSITY" (found in sgLighting.h), or adjust the shadow "fog" effect, which is more complicated, I recommend trying one of the other two first especially if the stock 1.4 shadows seemed to fade at a good rate.
#6
01/31/2006 (5:03 am)
Once again, thanks for the reply John. I found the solution to my problem and it was in prefs.cs where I changed the $pref::TS::detailAdjust to a larger value. Now the shadows draws fine at a greater distance. :)
#7
02/01/2006 (8:53 pm)
I have a similar problem... is there a way to set the shadow detail for individual objects? I have some objects in my game (signs, rocks, etc) that I want the shadow to fade out when you are only a meduim distance (maybe 10 meters), but with objects like the player or enemies, I want the shadows to be visible for a longer distance. Any way to do this (I hope this isn't taking over the topic, just thought it was related)?
#8
02/03/2006 (6:31 am)
Hi Steve,

You can use the code I posted above, but instead of changing the constant you can multiply in a new shape base variable that you can change through the mission editor.

-John