Game Development Community

Why are shadows so hard to get to?

by Syllus · in Torque Game Engine · 04/11/2007 (9:28 am) · 6 replies

I am a bit confused as to why shadows are such a big problem for TGE/TGEA. First off why are there posts telling you that in order to have shadows cast properly by dts objects you need to make these source code changes then recompile the engine? Shouldn't this be turned on by default for any descent game engine? Why is it so hard to get shadows working smoothly between dif, dts, and terrain?

Don't get me wrong.. I love Torque and GG... I just don't understand why things are done certain ways sometimes. Shadows and lighting are a fundamental part of ANY game's visual aspects... more important then any type of shaders or other fancy effects you can put in. So why is this not working out of the box and why do we have to make source code changes and recompile to even get some of them turned on and then they still don't work with the other 2 main aspects of the game engine?

IMHO Shadows and any shadow capabilities should be enabled and working properly between objects, buildings, and terrain out of the box. These aspects should not be "turned off" and require c++ programming to enable. Even the cheap / free game engines often have very good lighting /shadowing and they are working the second you download them.

I apologize for the rant but it is frustrating sometimes. Something so fundamental as lighting and shadows should not be such a huge ordeal just to get it working with any descent engine and especially one that claims to be a "AAA" engine and costs $750-$1500. /End Rant

Anyhow... just venting a bit and also hoping that maybe GG will someday decide to turn on and make all the shadow abilities play nice together, "out of the box"

On an up note... I LOVE constructor!! Awesome job GG! and Thank you! Just because I'm frustrated with this shadow stuff doesn't mean that I don't love you guys! lol

#1
04/11/2007 (9:54 am)
You need to be more careful about the "features" community members are talking about - if something isn't enabled in the engine it most likely doesn't work.

The proposed dts to dts shadow implementations for TGE cast shadows on the collision boxes, so the shadows are floating in mid-air in front of the receiving object - that's probably not what you're looking for.

TGEA has dts to dts shadows, though a bug is preventing large objects from casting shadows (obviously that's being worked on).

Receiving shadows on all other objects (except Atlas, which is also being worked on) works out of the box.

Did you check out the TDN Lighting System articles about shadows? They explain what types of shadows are cast from the different object types.
#2
04/11/2007 (10:39 am)
Hmm then any idea why stuff like this is happening? www.blackskullstudios.com/bss/pics/shadow1.jpg this was exported from constructor and look sgreat except that for some reason these difs either are not casting shadows on the terrain or the shadow is very small / or skewed etc so that it is unnoticeable... however the hut that was placed just to the left of these cast a perfect shadow on the terrain.

The one on the left is in-game lighting only... no lights were applied in constructor before export, the middle one had lights added in constructor before export, and the right one is the default on that came with constructor exported "As is" notice that not only do the dif structures themselves not cast shadows on the terrain but none of the other shadows (including the ones on the left which are all in-game lightmapping) display on the terrain... they immediately cut off at the edge of the dif... is there something im missing somewhere maybe that you can think of?
#3
04/11/2007 (11:14 am)
The terrain uses a single 512x512 light map, which is stretched over a large area, in comparison the large interior surfaces in the image likely have at least 128x128 light maps on those surfaces alone, so the lighting scale won't be consistent, however the shadows are there, though fuzzier (zoom out to see them).

The terrain light map size is difficult to change because of the terrain blender (a cool, but at times frustrating piece of code that lets the terrain, with multiple textures, blend efficiently on any video card, even old single texture unit cards), which is in assembly (though there's also a slower C++ version) - the blender assumes a light map size of 512x512.

Most interiors are larger than those shown and as they grow in size the shadows will become more defined relative to the interior size.

If you need higher detail light mapping you can also reduce the terrain block size to 4, which makes the terrain smaller reducing the distance the light map is stretched over.

There are ways to hack higher rez lighting into the legacy terrain, but we're still researching those to see, which, if any, will work best.
#4
04/11/2007 (12:57 pm)
Hmm that did help... its still not the most pronounced shadow in the world but reducing the square size did bring it out quite a bit. With a little artistic creativity this may work for now. Defiantly not an end all solution but it helps and is quite a bit better then before for the smaller objects... thanks :)
#5
04/12/2007 (4:30 pm)
John... I had a look at the info on TDN but I don't really understand it.

Is there any sort of "noobs Guide to adding shadows"?

I'm playing around with img443.imageshack.us/img443/3136/screenshot00100002ek7.jpg and want to add some shadows to bring it to life a bit more.
#6
04/13/2007 (12:08 pm)
Static shadows are cast from the collision hulls of TSStatic and ScopeAlwaysShape objects. Make sure the trees have valid collision meshes.

If the collision meshes are very thin the terrain light map might not be detailed enough to show the shadows - you can test this by scaling the trees up to 5 - 10 times their original size to see if they cast visible shadows (make sure to relight after changing the object's size).

If the terrain light map is not detailed enough you can change the terrain block size to 4 to get better lighting resolution.