Creating Shadows for dts objects...
by Miguel Benitez · in Torque Game Engine · 11/28/2006 (9:51 pm) · 17 replies
I was looking at the demo level that came with the engine and I noticed there trees have soft shadows on the terrain. Im assuming this is done with the collision mesh or something like this. Does someone have an explanation on how to do this in 3ds max to create shadows for trees or any type of static dts objects? Thx.
-Miguel
-Miguel
#2
12/03/2006 (3:42 pm)
What version of TGE are you using? In the case that your using a version lower than TGE 1.5, do you have the Torque Lighting Kit (TLK)?
#3
12/03/2006 (4:47 pm)
I'm using the new 1.5 TGE just purchased it about a week ago.
#4
Oh i just tested my advice, and DTS shadows do not respond to dynamic cast light. But the sun angle and relighting the mission do change the DTS shadows for me. If i recall, when you need a DTS dynamic shadow you need to use a shape from a datablock.
12/03/2006 (5:14 pm)
Just an idea, but have you tried setting the sun (or whatever light) angle to anything but HIGH-noon? Also for the sake of testing, set the lightRadius = to a large number (something like 20) , as found in 'datablock ProjectileData' (going from the crossbow.cs script) ; this way you get a dynamic light that you can control by firing your crossbow (or whatever weapon you have going).Oh i just tested my advice, and DTS shadows do not respond to dynamic cast light. But the sun angle and relighting the mission do change the DTS shadows for me. If i recall, when you need a DTS dynamic shadow you need to use a shape from a datablock.
#5
-Miguel
12/03/2006 (7:58 pm)
My sun azimuth is at 180 and the angle is at 30. The shadows work great coming off the .dif files. Im trying to get shadows from my trees. The shadows from the collision mesh work in the demo level that comes with torque when I put the trees in that level. I am barely starting fresh and worked off that getting started tutorial that comes with torque. So I dont know if that has anything to do with it since I copied the tutorial base folder and renamed it GameOne as it says in the tutorial. So are these files missing something that the demo level has? Thx.-Miguel
#6
Make sure your object is a TSStatic and that it's large enough to cast a shadow on the interior or terrain light maps (try scaling the object up for testing).
12/04/2006 (7:43 pm)
Hi Miguel,Make sure your object is a TSStatic and that it's large enough to cast a shadow on the interior or terrain light maps (try scaling the object up for testing).
#7
How do I make a .dts tree or any static dts into a TSStatic file? I export the tree from 3ds max to .dts. So from here how do I make it into a TSStatic file. Thx.
12/04/2006 (8:34 pm)
Hey John,How do I make a .dts tree or any static dts into a TSStatic file? I export the tree from 3ds max to .dts. So from here how do I make it into a TSStatic file. Thx.
#8
To add a datablock for the DTS, (i still have not checked but im 90% sure this how you get the dynamic shadows from dynamic lights off DTS shapes...) is to:
12/04/2006 (9:29 pm)
I would think, just place it like any other DTS shape, from the editor. My DTS put into the mission from F11 then F4 click static shapes, and pick one to add; work just fine for the 'baked in shadows' (must relight or restart the mission to see them..)To add a datablock for the DTS, (i still have not checked but im 90% sure this how you get the dynamic shadows from dynamic lights off DTS shapes...) is to:
datablock StaticShapeData(NAMEStaticShape)
{
category = "THING";
shapeFile = "~/data/shapes/THINGNAME.dts";
};
#9
Try scaling the objects up to the same size as the demo trees (or larger if the objects have small/thin pieces that might not cast shadows very well), then relight the scene to see if the shadows are visible.
If that doesn't work open the objects up in Show Tool Pro to make sure the collision mesh was properly exported and that it's convex.
12/05/2006 (7:42 am)
Adding DTS objects from the Mission Creator's Static Objects list adds them as TSStatics.Try scaling the objects up to the same size as the demo trees (or larger if the objects have small/thin pieces that might not cast shadows very well), then relight the scene to see if the shadows are visible.
If that doesn't work open the objects up in Show Tool Pro to make sure the collision mesh was properly exported and that it's convex.
#11
-Miguel
12/05/2006 (9:50 pm)
Thanks guys for the reply's and Caylo for the tree. Caylo I exported the tree to my level and still no shadows off the collision mesh. Ive been relighting like crazy using just Alt L and different settings with the Light editor and nothing so far. I just noticed that your tree casts a shadow onto my castle I made which the castle is a .dif file. So why would it cast a shadow on the dif file and not the terrain? -Miguel
#12
12/05/2006 (9:59 pm)
Hmm, now that IS odd. Have you dont much or any C code changes? I can not recall what pref there are for shadows, but that is possibly a place to look.
#13
12/06/2006 (9:14 am)
Hey Caylo can I send you my level I have made see if you can see why?
#14
12/06/2006 (9:31 am)
Sure thing. Should only need the .mis file, i can fill in any missing assets with placeholders.
#15
12/06/2006 (11:21 am)
Sent it to your public email Caylo.
#16
12/08/2006 (9:06 am)
Did you try scaling the objects up?
#17
My observation is to keep the levels at least 0.10 apart to have a noticeable effect.
12/08/2006 (1:15 pm)
Just so other folk can learn also, it was ambient lighting level set to the same as normal light level. The shadows were very faint or someplace didn't appear at all. My observation is to keep the levels at least 0.10 apart to have a noticeable effect.
Torque Owner Miguel Benitez
-Miguel