Sign in to follow this  
Guoshima

2 World Shadows [Canopy Shadows]

Recommended Posts

Hello, I just took a closer look at the shadows from 2 worlds. The shadows from the trees look extremely detailed. I am really wondering how they achieve such a good quality. Even if I would use a 2K by 2K texture for only 50m on 50m in my engine, the quality wouldn't be that good. Any idea on what tricks they might be using. This has defently nothing to do with using LiSPSM, VSM, PCF or any other trick, but just the shadow quality itself. Regards, Kenzo [Edited by - Guoshima on April 19, 2006 2:51:49 AM]

Share this post


Link to post
Share on other sites
I reckon they use Canopy Shadows for their tree-shadows, in which they project a high-resolution (static) shadow-map on the scene "under" each tree, using projective texturing. It's not 100% correct but very effective, non the less, the shadows of the leafs will even be projected on persons that walk under the tree.

I noticed Bethesda does the same in Oblivion for their tree-shadows, by the way.

Edit: It seems Epic uses the same technique in their Unreal-engines: there is small bit about Canopy Shadows for trees on this page: http://udn.epicgames.com/Two/ExampleMapsAdvLighting#Tree_Canopy_Shadows

A screenshot showing Canopy Shadows:

(This screenshot is from Epic Megagames' developer network)

[Edited by - HolyFish on April 18, 2006 4:16:20 PM]

Share this post


Link to post
Share on other sites
The only problem (which is actually a big one depending on what you want) with the described method, is that it breaks down fairly quickly when the direction of the light source changes significantly with respect to the direction that the original shadow map was baked from. You would have serious trouble getting accurate shadows out of this method if you wanted to have a true day/night cycle with cycling sun/moon.

Share this post


Link to post
Share on other sites
hmm looks very interesting actually :)

Does anyone can give me little bit more explenation about this, or point me to somewhere where I can read/find more information perhaps. A quick google didn't gave me lot on first sight, but I'll take another look tomorrow then.

Regards,
Kenzo

Share this post


Link to post
Share on other sites
Quote:
Original post by HolyFish
I reckon they use Canopy Shadows for their tree-shadows, in which they project a high-resolution (static) shadow-map on the scene "under" each tree, using projective texturing.

Am I missing something, because as I read that 'canopy shadows' is just regular projective texturing, theres nothing new going on except they've given it a special name.

Share this post


Link to post
Share on other sites
Hi Kenzo,

If you want to use Canopy Shadows you'll have to look into Projective Texturing, cause that's really all there is to it, I imagine.
I learned a great deal about Projective Texturing by reading this article (http://www.paulsprojects.net/tutorials/smt/smt.html). It's a shadowmapping tutorial, but has a very nice introduction about Projective Texturing.

If you animate the shadowmap a tiny bit by scrolling it from side to side and up and down randomly (so it looks like the leafs wave in the wind) I bet the result would be very satisfying and convincing, if you can live with the fact it's fake :)

Quote:
The only problem direction of the light source changes significantly with respect to the direction that the original shadow map was baked from.
That's right, but I guess that's one of those things you'll have to sleep about and consider to use higher quality shadows instead of going for 100% realism.

Oblivion comes to mind again, cause it's a recent game that has canopy shadows, which has a full day/night cycle and it's really not that much of an issue there.

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
Quote:
Original post by HolyFish
I reckon they use Canopy Shadows for their tree-shadows, in which they project a high-resolution (static) shadow-map on the scene "under" each tree, using projective texturing.

Am I missing something, because as I read that 'canopy shadows' is just regular projective texturing, theres nothing new going on except they've given it a special name.

Exactly, like I said above (sorry I was probably typing when you posted your reply), there's nothing fancy about them, but they do the trick.
Sometimes the hardest problems have the simplest solutions :)

Share this post


Link to post
Share on other sites
Quote:
Original post by HolyFish
...cause it's a recent game that has canopy shadows, which has a full day/night cycle and it's really not that much of an issue there.


But what if you could have real shadows?? :)

Share this post


Link to post
Share on other sites
It wouldn't really be that hard to make the projected shadow update once every minute or whatever update rate you needed. Even if it was an extremely high poly tree model, you could easily update the shadowmap once in a while as long as the sun didn't move too fast...

Share this post


Link to post
Share on other sites
Isn't it just a single render pass per light? That isn't as taxing as many people would imagine on modern graphics cards, as long as you don't have too many lights.

Share this post


Link to post
Share on other sites
hmm it seams that I already used a technique like this. The only problem is that each object which will be influenced by the tree shadow needs to have the shadow texture. If a lot of trees are close to each other, the object might even need a few tree shadow textures, which can become rather expensive to compute. That's why I tried to create regions for the shadows (50m by 50m), instead of a shadowmap for a single tree. Like this I only have to sample one shadow map, and don't have a problem with shadow overlapping or anything. I think FarCry is doing something like this, if you take a look at this screenshot.

I can even precompute the shadows for a certain region, and perhaps store them for later use. The problems for the regions is of course, that I can't share any textures, and I presume, if you use a single texture for each tree, then you can easily reuse that texture.

With the moving of the texture, you only have to compute a little uv offset when sampling the texture right? And do you use default depth maps, or shadow color maps put on top of an object?

Regards,
Kenzo

[Edited by - Guoshima on April 19, 2006 4:41:10 AM]

Share this post


Link to post
Share on other sites
I presume I can only use those canopy shadows only for trees and foliage and stuff like that, and not for my buildings. So during my shading, I need to take the contributed shadow from the canopy shadow map and a normal shadow map (LiSPSM or whatever), and then beldn those 2. Correct ?

As for CryEngine 3, I would say they use a canopy shadow containing a simple alpha color, which is blurred then. Is it possible to have self shadowing with this, or simply don't use the canopy texture on the leaves but only on the branches ? (the problem with self shadowing and storing color values is that you can't use a little offset or anything anymore, so after projection it will always self shadow .. or am I thinking wrong here ?)

Regards,
Kenzo

Share this post


Link to post
Share on other sites
you cannot have selfshadowing with canopy shadows, so you're thinking right.

regards,
m4gnus

[Edited by - m4gnus on April 19, 2006 8:04:42 AM]

Share this post


Link to post
Share on other sites
Does anyone know the shadowing system True Crime: New York City uses? It has no self shadowing, it looks like this (soft, faded) and it is dynamic. The shadows are only visible from a close distance, beyond they fade out.

Share this post


Link to post
Share on other sites
Quote:
Original post by Brian Lawson
But what if you could have real shadows?? :)

Alan Wake looks like it doesn't use canopy shadows/projected textures for the tree shadows.

The shadows look accurate to the direction of the light and the trees don't look like speedtree generated ones.

If you watch the video it gives a better impression of the accurate dynamic shadows on pretty much everything [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by Guoshima
If a lot of trees are close to each other, the object might even need a few tree shadow textures, which can become rather expensive to compute. That's why I tried to create regions for the shadows (50m by 50m), instead of a shadowmap for a single tree.

I think that's the way to go, indeed. They mention something about Canopy Shadows for forests in the link I gave you in my first post, and it seems they do the same thing.

Quote:
With the moving of the texture, you only have to compute a little uv offset when sampling the texture right? And do you use default depth maps, or shadow color maps put on top of an object?
Yes, or you could translate your frustum you use for projective texturing, whatever goes easier or faster in your engine.

Quote:
So during my shading, I need to take the contributed shadow from the canopy shadow map and a normal shadow map (LiSPSM or whatever), and then beldn those 2. Correct ?

Exactly. I guess, the hardest part will be to make sure the shadow-colors are the same so they blend right and you can't see the "borders" of your Canopy-map through the shadows in the environment...

Quote:
Is it possible to have self shadowing with this, or simply don't use the canopy texture on the leaves but only on the branches ?

Do you mean, can the tree cast "shadows" on itself? Sure, just make sure you render the tree aswell in your projective-texturing-pass. Wheter you want shadows on your leaves aswell, I guess that's a question of testing out how it looks. It's certainly possible, but I think shadows on the tree alone will be more then enough to give the illusion and the projected shadows on the leaves *may* look strange.

Kenzo, how small can this world possibly be :)

Share this post


Link to post
Share on other sites
Quote:

Do you mean, can the tree cast "shadows" on itself? Sure, just make sure you render the tree aswell in your projective-texturing-pass. Wheter you want shadows on your leaves aswell, I guess that's a question of testing out how it looks. It's certainly possible, but I think shadows on the tree alone will be more then enough to give the illusion and the projected shadows on the leaves *may* look strange.


if you want correct self-shadowing with canopy shadows you'd need to cull all parts/leaves/whatever of the tree that cast shadows. Accomplishing that should be pretty hard and a common solution that problem is shadow mapping. So Selfshadowing with canopy shadows is hardly possible.

regards,
m4gnus

Share this post


Link to post
Share on other sites
well an easy solution to this, is storing a shadow color in red channel and depth into blue channel for example. Then you can use same texture as projected and shadow map. Don't know if it will be interesting though, but I am playing with these things right now ..

Regards,
Kenzo

Share this post


Link to post
Share on other sites
Quote:
Original post by ViLiO
Quote:
Original post by Brian Lawson
But what if you could have real shadows?? :)

Alan Wake looks like it doesn't use canopy shadows/projected textures for the tree shadows.

The shadows look accurate to the direction of the light and the trees don't look like speedtree generated ones.

If you watch the video it gives a better impression of the accurate dynamic shadows on pretty much everything [smile]


Oh, I know! I was simply asking a leading question... :) It's definitely do-able, even at highly interactive frame rates. It really just comes down to a data organization problem and an order of operations problem.

However, the topic/question at hand is a great middle of the road compromise if you don't need fully dynamic true to life shadowing (including self-shadowing).

Alan Wake looks very impressive.

Quote:
...of the accurate dynamic shadows on pretty much everything [smile]


And I can think of another game coming out somewhat soon that is doing the same thing... [smile]

Share this post


Link to post
Share on other sites
Quote:

well an easy solution to this, is storing a shadow color in red channel and depth into blue channel for example. Then you can use same texture as projected and shadow map. Don't know if it will be interesting though, but I am playing with these things right now ..

you don't need to store the shadow color as it's usually the same for the whole shadow map. When you project that texture onto the rest of your scene you'd simply look if the projected pixel is not black, if that's true then that point is in shadow. That's not many calculations more than usual canopy shadows and you could use the shadow map for selfshadowing.

Another option for selfshadowing(not physically correct though) would be Ambient Occlusion. That can easily be done in realtime. You just have to render the mesh from several directions into a depth map and then check for every pixel on the surface if it's on those depth maps. In most cases that can be precomputed and stored in a texture(as trees usually don't change that much).

regards,
m4gnus

Share this post


Link to post
Share on other sites
Alan Wake uses as far as I know Cascaded Shadow maps .. I believe I saw the transition are when I looked at it last time.
Canopy Shadows: these are simple projected textures that do not work with a time of day feature ....
In other words, if your game has a time of day feature you can not use them ... if you are not satisfied with a pretty strange shadow in extreme lighting conditions.
So games that have a time of day feature need dynamic shadow maps .... this is for example Crysis ...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:

noticed Bethesda does the same in Oblivion for their tree-shadows, by the way.
...
Epic uses the same technique in their Unreal-engines


Both these engines use the same tree rendering technology (SpeedTree). And yes, this system uses projective textures of pre-rendered shadow maps for the tree shadows. You can check out their nifty demos off thier site, one of the keys turns on the projective shadow mapping frustum and you can see how it works.

Share this post


Link to post
Share on other sites
Quote:

Alan Wake uses as far as I know Cascaded Shadow maps .. I believe I saw the transition are when I looked at it last time.
Canopy Shadows: these are simple projected textures that do not work with a time of day feature ....
In other words, if your game has a time of day feature you can not use them ... if you are not satisfied with a pretty strange shadow in extreme lighting conditions.
So games that have a time of day feature need dynamic shadow maps .... this is for example Crysis ...


I don't really see the problem with dynamic day night system. You can update your projected shadow maps every few frames / seconds, depending on the movement of the sun, and then they become dynamic. I create now, a few patches around the camera with a projected texture from the trees. These I use as static shadow maps. For a radius of 50m around the camera, I also have a dynamic map, which blends nicely to the static ones. So far this works fine, and shouldn't suffer from day to night I would say ..

Quote:

you don't need to store the shadow color as it's usually the same for the whole shadow map. When you project that texture onto the rest of your scene you'd simply look if the projected pixel is not black, if that's true then that point is in shadow. That's not many calculations more than usual canopy shadows and you could use the shadow map for selfshadowing.

Another option for selfshadowing(not physically correct though) would be Ambient Occlusion. That can easily be done in realtime. You just have to render the mesh from several directions into a depth map and then check for every pixel on the surface if it's on those depth maps. In most cases that can be precomputed and stored in a texture(as trees usually don't change that much).


I actually want to store a grey scaled color for my shadows, because it feels like it gives me a nicer shadow.

Farcry:


Mine (in progress :))

But I don't understand how you would use your black white comparison for self shadowing then. Could you give a little bit more explenation about this pls.

Thank and regards,
Kenzo

PS: gonna take a look at the fast scene voxelization now>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this