If you see my shadows, please send them home!
by FruitBatInShades · in · 12/08/2004 (12:09 pm) · 16 replies
I've just noticed that the interiors are not casting shadows on the terrain! Am I missing something or is there a shadow thief about?


#2
12/08/2004 (12:48 pm)
The building casts shadow fine under torque with no LP, but not in the torque with LP. I guess I've missed a setting somewhere!
#3
Max
12/08/2004 (1:58 pm)
Does the player cast shadows? Because if id does then it would surley be a setting problem.Max
#4
12/08/2004 (4:17 pm)
The image isn't loading, but I think I know the problem. Both TGE and the Lighting Pack share the same terrain directional lighting and shadowing code. This code stops working if the casting object is not rotated and the sun's azimuth is at an angle of 0, 90, 180, or 270 degrees. This is reproducible in TGE. I work around it by setting the sun's azimuth at a number safely away from those numbers (I think the TGE demo is set at 120).
#5
I hadn't rotated the buildings so there was no shadow, just roated them a few degrees and the shadow get generated :) Thats a strange little bug.
12/09/2004 (1:11 am)
Thanks again John :)I hadn't rotated the buildings so there was no shadow, just roated them a few degrees and the shadow get generated :) Thats a strange little bug.
#6
12/09/2004 (6:30 am)
Is this the same for all shapes? - i.e. You have to rotate them a little. If so - why is this??
#7
12/09/2004 (7:00 am)
Yes. Because it's a bug in TGE's directional lighting and shadowing code.
#8
12/09/2004 (7:01 am)
It's the same for all shapes, so far as I know. Why do you have to rotate them? Well, you don't if your sun's azimuth (like John stated) isn't 0/90/180/270. Why does this happen? It's a side effect of the way the mathematics work in the game. Note that you can approach these angles just fine, 1deg or 89, or 179, etc...will work just not the EXACT ones listed.
#9
12/09/2004 (7:40 am)
Sorry to be thick! What does the suns azimuth actually mean and how does it affect the lighting?
#10
12/09/2004 (9:05 am)
The azimuth is the vertical sun arc angle. Change the azimuth and you'll change where the sun rise from. The bug at right angles might be math related.
#11
azimuth--Angle between the north direction and the projection of the surface normal into the horizontal
plane; measured clockwise from north. As applied to the PV array, 180 degree azimuth means the array faces due south.
So to translate from the technical language, I mean 'nomenclature', :-) azimuth is the direction or compass heading of the sun. In TGE I suppose it's calculated from the center of the terrain block. And elevation is your other sun position value which is just the angle above the horizon of a flat terrain.
When you do trig functions on 0, 90, 180 or 270 you can end up with a zero return value. Try sin(0) or cos(90) in your calculator. Depending on how you handle these in code you can have problems. At least that's how it's been with my trigonometry code. :-) Try cos(270) and you'll get zero again. So it can be a little hard to keep track of where you're actually pointing. This is why you seen quaternions used to do math on the rotation of obects about three axes. You avoid these potential lockups on the four cardinal points.
12/09/2004 (9:22 am)
From a reference found online:azimuth--Angle between the north direction and the projection of the surface normal into the horizontal
plane; measured clockwise from north. As applied to the PV array, 180 degree azimuth means the array faces due south.
So to translate from the technical language, I mean 'nomenclature', :-) azimuth is the direction or compass heading of the sun. In TGE I suppose it's calculated from the center of the terrain block. And elevation is your other sun position value which is just the angle above the horizon of a flat terrain.
When you do trig functions on 0, 90, 180 or 270 you can end up with a zero return value. Try sin(0) or cos(90) in your calculator. Depending on how you handle these in code you can have problems. At least that's how it's been with my trigonometry code. :-) Try cos(270) and you'll get zero again. So it can be a little hard to keep track of where you're actually pointing. This is why you seen quaternions used to do math on the rotation of obects about three axes. You avoid these potential lockups on the four cardinal points.
#12
Steve
12/12/2004 (5:50 pm)
I have set the azimuth to 269 - as funny enough my azimuth was 270... but i still get no shadows rendered. On my trees even though i wanted more elaborate shadowing, i am happyu for now to just have the trunk cast a shadow, via its collision box - but no matter how i set the azimuth i get no shadows????Steve
#13
Try 250.
12/12/2004 (8:48 pm)
"I work around it by setting the sun's azimuth at a number safely away from those numbers"Try 250.
#14
12/13/2004 (1:27 am)
I changed the setting as requested - but still no shadows. On my larger items such as rocks, i do notice a bit of discoluration on the terrain around them, but no line shadow effects for the tree trunks? as i can do in the original demo that comes with the lightpack. I have altered the lighting settings i have to accomodoate all different settings to see if i had set something up wrong - but no - still no shadows...
#15
"There are several reasons why the collision boxes are used, efficiency is one of them, however the main reason is that the terrain uses one 512x512 light map that's stretched across the equivalent of a square mile. You could add tons of detail to your objects, but the light map won't be able to show the detail. Often the level of detail that you can achieve with 9 collision boxes is far more than the terrain can show, so adding extra won't help."
Shadows Thread
12/13/2004 (11:59 am)
How large are the trees, are they similar in size to the TGE demo trees? It sounds like the objects are too small and are not capable of casting a shadow onto the terrain's low detail light map. I addressed this before:"There are several reasons why the collision boxes are used, efficiency is one of them, however the main reason is that the terrain uses one 512x512 light map that's stretched across the equivalent of a square mile. You could add tons of detail to your objects, but the light map won't be able to show the detail. Often the level of detail that you can achieve with 9 collision boxes is far more than the terrain can show, so adding extra won't help."
Shadows Thread
#16
And maybe temporarily try a different terrain texture for debugging if you're having trouble seeing any shadows.
12/14/2004 (8:33 am)
What's your sun elevation? I've had a 10-15deg elevation set and get these long shadows. Maybe your sun is overhead?And maybe temporarily try a different terrain texture for debugging if you're having trouble seeing any shadows.
Torque Owner Max Thomas
Max :/