Player shadow casting...
by Harvey Greensall · in Torque Game Engine Advanced · 02/23/2007 (2:07 pm) · 17 replies
Hi all, almost finished out TGEA port. It's been a blast.
One problem I've got is my vehicle is not casting a dynamic shadow. I've been going round and round in circles trying to fix this, and then thought maybe it's the vehicle dts itself, not some default.cs thing or whatever.... Dropped the generic Torque buggy instead of the ship, and yes, we have shadows. Dropped my ship model into fps.starter kit ( which uses self shadowing on the player normaly) and, you guessed it, no shadows...
Is it possible in the .dts file to tell it to not cast shadows? I can't remember, it's been so long since I built the models. Can anyone else think of something...They're quite large pirate ships, could this be a problem...
Also, sorry on a sidenote, has anyone seen LODDING working in TGEA yet? or is it just me?
Apart from this, we're rocking! It's an awesome engine !
One problem I've got is my vehicle is not casting a dynamic shadow. I've been going round and round in circles trying to fix this, and then thought maybe it's the vehicle dts itself, not some default.cs thing or whatever.... Dropped the generic Torque buggy instead of the ship, and yes, we have shadows. Dropped my ship model into fps.starter kit ( which uses self shadowing on the player normaly) and, you guessed it, no shadows...
Is it possible in the .dts file to tell it to not cast shadows? I can't remember, it's been so long since I built the models. Can anyone else think of something...They're quite large pirate ships, could this be a problem...
Also, sorry on a sidenote, has anyone seen LODDING working in TGEA yet? or is it just me?
Apart from this, we're rocking! It's an awesome engine !
#2
02/23/2007 (2:28 pm)
Hi Bobby, we're not using Atlas, we're still using the legacy terrain... In my level in our game, we have no shadows off the ships, or self shadowing on them, but if I drop the buggy in instead just by changing the model reference in the vehicle datablock, it casts one, and self shadows... ?? I know, crazy! It's got to be something to do with the model itself, or some .cfg file or something... The ships do have a few alphad objects for the rigging etc. I don't know if this would maybe cause it to not shadow or something...I'm completely stumped!
#3
02/23/2007 (2:29 pm)
Or maybe there's a limit to the amount of polys you can use in a model that's going to shadow? Dunno, I'm just plucking ideas out of the air.... It'll be something really obvious I'm sure...
#4
I think it has to do with the bounding box size in the player.cs
If korg has a bounding box of 2 2 2 ... you get nice crisp shadows
Up it to 5 5 5 , they start getting lighter
up to 10 10 10, lighter still. At 20 20 20, he has none.
Our ships are full size pirate ships at 50 long 10 wide and more like 60 high, so our bounding box in the datablock is also this. I think this is where the problem lies for us....
Does anyone think this could make sense? I'll look into it more...... has anyone got big stuff to cast dynamic shadows?
02/23/2007 (3:16 pm)
Right, I've spent an hour trying stuff out.I think it has to do with the bounding box size in the player.cs
If korg has a bounding box of 2 2 2 ... you get nice crisp shadows
Up it to 5 5 5 , they start getting lighter
up to 10 10 10, lighter still. At 20 20 20, he has none.
Our ships are full size pirate ships at 50 long 10 wide and more like 60 high, so our bounding box in the datablock is also this. I think this is where the problem lies for us....
Does anyone think this could make sense? I'll look into it more...... has anyone got big stuff to cast dynamic shadows?
#5
02/23/2007 (4:07 pm)
Did you try tweaking the shadow projection distance on the vehicle datablock?
#6
The shadow projection distance? ....ahaaar, that sounds interesting...Is that a new TGEA thing? There's no such thing in my datablocks at the moment....my datablocks have:
shadowSelfShadow = true;
shadowSize = 512;
//shadowSphereAdjust = 2.5;
//shadowBias = 0.001;
I commented out the last two to see if it made any difference...It didn't...although upping the shadowspereadjust also makes the shadows lighter. i was hoping it would do the opposite, but a 'shado projection distance' setting could answer my prayers...
02/23/2007 (4:17 pm)
Hi Manoel...The shadow projection distance? ....ahaaar, that sounds interesting...Is that a new TGEA thing? There's no such thing in my datablocks at the moment....my datablocks have:
shadowSelfShadow = true;
shadowSize = 512;
//shadowSphereAdjust = 2.5;
//shadowBias = 0.001;
I commented out the last two to see if it made any difference...It didn't...although upping the shadowspereadjust also makes the shadows lighter. i was hoping it would do the opposite, but a 'shado projection distance' setting could answer my prayers...
#7
shadowSelfShadow = true;
shadowSize = 512;
//shadowSphereAdjust = 2.5;
//shadowBias = 0.001;
shadowProjectionDistance = 20
(please be kind, I'm only an artist)
02/23/2007 (4:23 pm)
This crashes the engine:shadowSelfShadow = true;
shadowSize = 512;
//shadowSphereAdjust = 2.5;
//shadowBias = 0.001;
shadowProjectionDistance = 20
(please be kind, I'm only an artist)
#8
02/23/2007 (5:02 pm)
Does anyone want to be kind to me and tell me how to tweak the shadow projection distance on my vehicle datablock by any chance?
#10
Right then...this is turning into a bit of a blog eh? Due to all your help, I HAVE SHADOWS WORKING !
shadowSelfShadow = true;
shadowSize = 1024;
ShadowQuality = 0;
shadowSphereAdjust = 1.5;
shadowBias = 0.001;
shadowProjectionDistance = 150;
shadowMaxVisibleDistance = 250;
ShadowDetailSize = 0;
The problem I've had is the players are very big, and they need to project shadows 40 meters below them onto seabed if needed, AND the camera can be up to 100 meters above the ships!
The only thing not working at the moment is the self shadowing for some reason. Maybe there's something above that looks dodgy?
02/24/2007 (2:49 am)
Aaargh! Schoolboy error - thanks! Right then...this is turning into a bit of a blog eh? Due to all your help, I HAVE SHADOWS WORKING !
shadowSelfShadow = true;
shadowSize = 1024;
ShadowQuality = 0;
shadowSphereAdjust = 1.5;
shadowBias = 0.001;
shadowProjectionDistance = 150;
shadowMaxVisibleDistance = 250;
ShadowDetailSize = 0;
The problem I've had is the players are very big, and they need to project shadows 40 meters below them onto seabed if needed, AND the camera can be up to 100 meters above the ships!
The only thing not working at the moment is the self shadowing for some reason. Maybe there's something above that looks dodgy?
#11
02/24/2007 (4:14 am)
To see if self-shadowing is really working or not, open the mission editor and toggle the Sun's "cast shadow" property on and off while looking at your model and see if anything changes. Depending on your lighting conditions, the shadows might look too subtle, and there isn't a proper way to make them darker yet.
#12
No, nothing changes. The shadow on the seabed switches off and on, so fine, but nothing at all changes in the model...I've added the shadowDTSshadow element to the datablock, just in case it was something to do with that.
shadowSelfShadow = true;
shadowSize = 2048;
ShadowQuality = 0;
shadowSphereAdjust = 1.5;
shadowBias = 0.001;
shadowProjectionDistance = 150;
shadowMaxVisibleDistance = 250;
shadowDTSShadow = true;
boundingBox = "23 57 90";
02/24/2007 (4:28 am)
Hi Manoel,No, nothing changes. The shadow on the seabed switches off and on, so fine, but nothing at all changes in the model...I've added the shadowDTSshadow element to the datablock, just in case it was something to do with that.
shadowSelfShadow = true;
shadowSize = 2048;
ShadowQuality = 0;
shadowSphereAdjust = 1.5;
shadowBias = 0.001;
shadowProjectionDistance = 150;
shadowMaxVisibleDistance = 250;
shadowDTSShadow = true;
boundingBox = "23 57 90";
#13
I'm really confused. Basically, all I want is my vehicle to cast a shadow onto terain, this it now does thanks to the help you this thread.... BUT, I also need it to cast onto .dts objects too as it passes over them, and idealy it should self-shadow too, as I'm trying to show off how good TGEA is.
So, my vehicle doesn't cast onto DTS objects, and it doesn't self shadow.. I think these two must be related somehow?
Anyone got any ideas?
02/24/2007 (4:55 am)
...and no, that didn't help either.I'm really confused. Basically, all I want is my vehicle to cast a shadow onto terain, this it now does thanks to the help you this thread.... BUT, I also need it to cast onto .dts objects too as it passes over them, and idealy it should self-shadow too, as I'm trying to show off how good TGEA is.
So, my vehicle doesn't cast onto DTS objects, and it doesn't self shadow.. I think these two must be related somehow?
Anyone got any ideas?
#14
02/24/2007 (12:37 pm)
It might have something to do with the size of the models. i would try taking the same model and try exporting a couple of different versions, then bring in each, there should be some noticeable difference. If there is that you problems, and there are a couple of ways to make adjustments. If it is it I'm lost for now, but if you aren't under any Non disclosure then send me the model to my e-mail and Ill be happy to take a look for you, are you by any-chance using any custom shade-rs, or code?
#15
It's a strange one. I've completed a few experiments today, but then I've thrown my hands up in the air and given up so I can be more productive on other things.... What it boils down to I think is that if you have, say, the buggy in the racing kit. Make the buggy self shadow etc. it's fine.
But, the more you increase the Projectiondistance and the MaxVisibleDistance because the camera needs to be say 100 meters away , and as the model isn't sitting on the terrrain, you'll have the effect of making the shadow darker, and darker on the ground as you increase these figures in the datablock. Brilliant so far! You now have shadows casting on the terrain even though you're 40m above it, and the camera is 140 meters above it.
BUT, as far as I can tell, the capacity to self shadow, or cast shadows onto other dts objects diminishes the further away from the terrain you get with the camera, and as the model is also floating on the waterblock 40 meters above the terrain, it's throwing other things in the mix.... I don't know, I suppose the TGEA thing is a bit fresh at the moment, and we're all trying to get our heads around it all. Once I've done it once, it'll be spot on.
I be popping into the studio tomorrow, so can get something together for you to look at, I'd really appreciate it, in a big way. Two heads are better than one and all that !
Big, huge thanks to everyone so far for their input! ...
H.
02/24/2007 (12:59 pm)
Hi Bobby, no, there are no custom shaders or code...It's standard TGEA...It's a strange one. I've completed a few experiments today, but then I've thrown my hands up in the air and given up so I can be more productive on other things.... What it boils down to I think is that if you have, say, the buggy in the racing kit. Make the buggy self shadow etc. it's fine.
But, the more you increase the Projectiondistance and the MaxVisibleDistance because the camera needs to be say 100 meters away , and as the model isn't sitting on the terrrain, you'll have the effect of making the shadow darker, and darker on the ground as you increase these figures in the datablock. Brilliant so far! You now have shadows casting on the terrain even though you're 40m above it, and the camera is 140 meters above it.
BUT, as far as I can tell, the capacity to self shadow, or cast shadows onto other dts objects diminishes the further away from the terrain you get with the camera, and as the model is also floating on the waterblock 40 meters above the terrain, it's throwing other things in the mix.... I don't know, I suppose the TGEA thing is a bit fresh at the moment, and we're all trying to get our heads around it all. Once I've done it once, it'll be spot on.
I be popping into the studio tomorrow, so can get something together for you to look at, I'd really appreciate it, in a big way. Two heads are better than one and all that !
Big, huge thanks to everyone so far for their input! ...
H.
#16
02/24/2007 (1:13 pm)
Especially DTS shadowing only works if self shadowing is enabled and Static objects do not support dynamic shadows yet ... at least if the datas on TDN are still current information on the TGEA shadow and light system.
#17
I didn't know that though, we can't cast a shadow onto a static object? .... But there is an option to enable DTS shadowing ...I've never seen it working, but in the docs. it says add 'shadowDTSShadow = true;' to your players datablock to cast shadows onto .dts models..... So, are you thinking they won't cast shadows onto a static object, but maybe they will onto another dts object that has a datablock, ie. a target, or another AI player or something?
I've got 4 large .dts objects under the water, that I want the ships working shadow to cast upon. It casts on the sea bed at the moment, but not on any static object, like shipwrecks and reefs etc....Maybe I could spawn them as none moving AI or something to get around it if they can't be a static shape? Or make a script for an animated object, and just not add any frames of animation, that kind of thing....Do you think that would work, if that is indeed what you mean.........?
02/24/2007 (1:31 pm)
Yes, self shadowing is enabled in the vehicles datablock...I didn't know that though, we can't cast a shadow onto a static object? .... But there is an option to enable DTS shadowing ...I've never seen it working, but in the docs. it says add 'shadowDTSShadow = true;' to your players datablock to cast shadows onto .dts models..... So, are you thinking they won't cast shadows onto a static object, but maybe they will onto another dts object that has a datablock, ie. a target, or another AI player or something?
I've got 4 large .dts objects under the water, that I want the ships working shadow to cast upon. It casts on the sea bed at the moment, but not on any static object, like shipwrecks and reefs etc....Maybe I could spawn them as none moving AI or something to get around it if they can't be a static shape? Or make a script for an animated object, and just not add any frames of animation, that kind of thing....Do you think that would work, if that is indeed what you mean.........?
Torque Owner Bobby Leighton
Imagn' Games