Tree help
by Adam Beer · in Torque Game Engine Advanced · 01/19/2008 (10:08 am) · 9 replies
I made a tree with a datablock and added these values to it:
shadowEnable ="1";
shadowCanMove="1";
shadowSelfShadow ="1";
shadowDTSShadow ="1";
shadowSize ="1024";
shadowMaxVisibleDistance ="50";
shadowProjectionDistance ="50";
When the shadow appears, it doesnt take into account the alpha of the leaves and just renders the shadow as a big rectangle like this:

How do I make it so the shadows use the alpha maps?
shadowEnable ="1";
shadowCanMove="1";
shadowSelfShadow ="1";
shadowDTSShadow ="1";
shadowSize ="1024";
shadowMaxVisibleDistance ="50";
shadowProjectionDistance ="50";
When the shadow appears, it doesnt take into account the alpha of the leaves and just renders the shadow as a big rectangle like this:

How do I make it so the shadows use the alpha maps?
About the author
Adam is the owner of Ignition Games, an indie game and software development company.
#2
These are no "problems", alpha shadow cast is just not featured by the shadow casting shaders ... they only cast shadows from polygons.
01/19/2008 (2:59 pm)
There is no help to that.These are no "problems", alpha shadow cast is just not featured by the shadow casting shaders ... they only cast shadows from polygons.
#3
01/19/2008 (9:11 pm)
Has anyone got alpha shadow casting working?
#4
I think adding support for Fetch4, create Shadow Mapping (Jason Mitchell's example on ati.com) and render on terrain will create the effect, but it is a hard work.
Find ShadowMapFetch4.pdf
dev is our GFX
01/21/2008 (8:36 am)
It is not easy to create that one right now.I think adding support for Fetch4, create Shadow Mapping (Jason Mitchell's example on ati.com) and render on terrain will create the effect, but it is a hard work.
Find ShadowMapFetch4.pdf
dev is our GFX
#6
Actually in Drake's Fortune I bet much of the "dynamic" shadows from the tree cover are actually offline-generated lightmaps that they're just running through some oscillator to make them look dynamic. If your sun doesn't move and you don't need to cast shadows from the palm tree from a moving light source then maybe there's a way you could hook it all up at compile-time.
But in both of those games they have a very complicated LOD system for handling dynamic shadows. You get about 20ft out from the character and you can see a demarkation between high-LOD shadows and low-LOD shadows, and a simple transition between the two levels. I could see handling these LODs a trickier problem than simply getting the shadows. So if you get this working you're going to have a new problem on your hands. :-)
I would recommend you try getting the shadows working with more complex geometry. Try and load two versions of the palm tree, one for rendering and one for shadows? There may even be a simple way to do this in script.
01/27/2008 (1:03 pm)
This definitely seems possible but I can't imagine it's a very cheap operation. Have you seen the dynamic shadows in games like Drake's Fortune / Crysis? I'm pretty sure they use geometry to cast shadows, not an alpha mask texture.Actually in Drake's Fortune I bet much of the "dynamic" shadows from the tree cover are actually offline-generated lightmaps that they're just running through some oscillator to make them look dynamic. If your sun doesn't move and you don't need to cast shadows from the palm tree from a moving light source then maybe there's a way you could hook it all up at compile-time.
But in both of those games they have a very complicated LOD system for handling dynamic shadows. You get about 20ft out from the character and you can see a demarkation between high-LOD shadows and low-LOD shadows, and a simple transition between the two levels. I could see handling these LODs a trickier problem than simply getting the shadows. So if you get this working you're going to have a new problem on your hands. :-)
I would recommend you try getting the shadows working with more complex geometry. Try and load two versions of the palm tree, one for rendering and one for shadows? There may even be a simple way to do this in script.
#7
02/16/2008 (7:46 am)
Crysis uses a modified version of shadowmapping.. the have 2 maps, one higher res, the other lower..
#8

Also, if you choose to implement a spotlight version(smartest way IMO):
This means that you use the shadow image on the +z location.
new CubemapData( NAMEHERE )
{
cubeFace[0] = ""; // +x
cubeFace[1] = ""; // -x
cubeFace[2] = ""; // +z (spotlight)
cubeFace[3] = ""; // -z
cubeFace[4] = ""; // +y
cubeFace[5] = ""; // -y
};
02/25/2008 (2:42 pm)
I suggest looking into using dynamic-lights-with-projected-cubemaps. NOWHERE-near-perfect or a good solution...but it can be a valuable asset in certain cases.Also, if you choose to implement a spotlight version(smartest way IMO):
This means that you use the shadow image on the +z location.
new CubemapData( NAMEHERE )
{
cubeFace[0] = ""; // +x
cubeFace[1] = ""; // -x
cubeFace[2] = ""; // +z (spotlight)
cubeFace[3] = ""; // -z
cubeFace[4] = ""; // +y
cubeFace[5] = ""; // -y
};
#9
02/25/2008 (4:57 pm)
Im not sure how to to do that but its an idea. The problem I see is that my trees are animated so it wouldnt work for me.
Torque Owner Adam Beer
Ignition Games Inc.