Game Development Community

Dynamic shadows on DTS objects

by Aaron Clifford · in Torque Game Engine Advanced · 10/19/2006 (9:08 am) · 13 replies

Deja vu....

Fistly I'm an artist, so just a n00b when it comes to any kind of coding..

Okay, I'm trying to do in TSE, what I did in TGE on this thread:

www.garagegames.com/mg/forums/result.thread.php?qt=49973

Make DTS objects cast a dynamic shadow, now when I go through the precedure I did in TGE seen on the other thread, no dynamic shadow apears:

i17.photobucket.com/albums/b81/pankake2005/Enviroment_work/screenshot_014-00002....

so I tried to use the ShapeBaseData datablock:

datablock ShapeBaseData(Water_tank3)
{
   category = "Demo";
   shapeFile = "~/data/shapes/water_tank/Water_tank3.dts";
   
   isInvincible = "true";
   emap = "false";
   
};

But now the object doesn't spawn..
I've been through everything to do with dynamic lighting and shadows on TDN, they just don't explain how to do it, the only way at the moment I can get my DTS shapes to cast dynamic shadows is by using the vehicle code, and that's just silly, because it brings in all the physics and collision stuff that I just don't need, it's really important for the level I'm making for certain meshes to cast a dynamic shadow, lightmaps just won't suffice..

So any help would be much apreciated.

#1
10/19/2006 (9:48 am)
There are some shadow variables that you need to include in the datablock.

shadowSelfShadow = true;
shadowSize = 512;
shadowSphereAdjust = 1.5;
shadowBias = 0.001;

I haven't really played with these all that much, I just copied those out of the player. The most important is setting shadowSelfShadow to true as I believe the engine initializes it to false.
#2
10/19/2006 (9:51 am)
Oh sweet, I'll try these out in a minute.
#3
10/19/2006 (11:53 am)
That worked sorta worked :D, just needed to add:

shadowEnable = true;

so my script file looks like:

datablock StaticShapeData(shape_name)
{
   category = "Demo";
   shapeFile = "~/data/shapes/shape_name/shape_name.dts";
   
   shadowEnable = true;
   shadowSelfShadow = true;
   shadowSize = 512;
   shadowSphereAdjust = 1.5;
   shadowBias = 0.001;
   
};

Lots of the time you won't need self shadowing, that's for the mesh to cast a shadow onto itself, good for big models and characters.

Thanks for the help Scott.
#4
10/19/2006 (1:01 pm)
No problem, I think shadowEnable is initialized to true in the player's datablock on the engine side so I forgot about that one. Thanks for mentioning what selfShadow is for, that will be useful in the future.
#5
10/19/2006 (1:05 pm)
No probs, just encountered another problem though :X

The shadows aren't updating real time, for exaple, if I move the object, the shadow doesn't react, kind of defeats the object and I haveno idea why this is happening because the car and player shadows are working great..

Any ideas?
#6
10/19/2006 (1:32 pm)
Hm, try this:

shadowCanMove = true;

That should probably fix that. There's also a shadowCanAnimate variable, but I don't think you'll need that for a static shape. That is unless you've got it playing an animation.
#7
10/19/2006 (1:34 pm)
Ah yes, that'll work, thanks man.
#8
10/20/2006 (12:08 pm)
Okay, last problem, I promise :D.

models that have nornmal and specular maps are displaying with the "No material" texture when I have dynamic shadows enables on the model, there's something about that in the TDN.

it says:

Quote:
The Feature property determines which of the base material features (diffuse, bump, specular, cube mapping, ...) the dynamic light reproduces, which adds control over the light's visual impact and quality. Reducing features also improves rendering performance (see Dynamic Lighting Performance for details).

The lighting features are:

Full - reproduces the entire base material features
NoCube - reproduces all of the base material features except cube mapping
NoSpecCube - reproduces all of the base material features except cube mapping and specular highlights

I've tried
full = true;

that didn't work, what am I missing?
#9
10/20/2006 (1:24 pm)
Ive tried this with tse (head) and works great, only thing ive noticed so far is that it doesnt cast shadows onto other dts objects, is there another flag to cast shadows on other dts?
#10
10/20/2006 (4:43 pm)
Yeah there is:

shadowDTSshadow = true;
#11
10/23/2006 (6:18 am)
Well, I'm stumped on that one. I haven't found any example using that feature and I don't see a feature called Full anywhere in the code. It could be new though, I haven't downloaded the latest head in a few weeks.
#12
10/23/2006 (7:45 am)
Yeah I found out what was going on there, the full thing is to do with light datablocks, to tell it to effect all of the materials, I've got models with normal maps working but I've just run into a few models that with dynamic shadows enabled on them the materials just disapear, if I disable they re apear again, I really don't know what's happening there...
#13
10/23/2006 (9:35 am)
Try using the same mod directory in a clean download of TSE, and see if the problem persists.

If so isolate the problem object and send over any relevant assets and scrips for testing here and I'll try to address it.