Game Development Community

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:

img256.imageshack.us/img256/8721/screenshot02600001vn0.png
How do I make it so the shadows use the alpha maps?

#1
01/19/2008 (1:20 pm)
I would like to also add that if you put a something that uses an alpha map un the shadow of any object, the shadow doesnt effect the object. Has anyone fixed these 2 problems?
#2
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
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
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
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.
fragstudios.com/gg_images/shadow_stuff_thumb.jpg

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.