Sign in to follow this  
MARS_999

Static Shadowmap....

Recommended Posts

MARS_999    1627
I have decided to just use a static shadowmap to self shadow my terrain. I was wondering does anyone have any idea if you could do the shadowmap creation in a VP/FP or would that be to slow? Also I have read the article on gamedev.net about fast computation of terrain shadowmaps, and the code is not to well commented for a tutorial. So I was wondering does anyone else have any decent code or tutorials on the same topic or maybe a better way to generate the shadowmap? I would like to hear what peoples thoughts are on the VP/FP idea...

Share this post


Link to post
Share on other sites
gulgi    315
You sound a bit confused.
* Shadowmapping is when you render from the lights point-of-view to a depth texture, then when you render the scene you compare the depths-texture to the scene to see what's in shadow and what's not.
Having a static shadow-map works as long as nothing moves inside the shadow..

Using VP/FP to create a Shadowmap.. i see no point (it's easier and.. same speed to do it with fixed functions) if you'r not using TSM or something fancy that is.


The terrain shadow things discussed here have usually been a shadow texture you use on the terrain just like the normal texture (nothing like shadowmapping). Just like in Quake3.. :)
The creation of this should be done in MAX/Maya or you own specific program made just for this, not in your game.

I would go with normal shadowmapping. Dynamic shadows are always nice. But it totally depend on what you want, your target hardware etc.

Good luck!

Share this post


Link to post
Share on other sites
MARS_999    1627
Quote:
Original post by gulgi
You sound a bit confused.
* Shadowmapping is when you render from the lights point-of-view to a depth texture, then when you render the scene you compare the depths-texture to the scene to see what's in shadow and what's not.
Having a static shadow-map works as long as nothing moves inside the shadow..

Using VP/FP to create a Shadowmap.. i see no point (it's easier and.. same speed to do it with fixed functions) if you'r not using TSM or something fancy that is.


The terrain shadow things discussed here have usually been a shadow texture you use on the terrain just like the normal texture (nothing like shadowmapping). Just like in Quake3.. :)
The creation of this should be done in MAX/Maya or you own specific program made just for this, not in your game.

I would go with normal shadowmapping. Dynamic shadows are always nice. But it totally depend on what you want, your target hardware etc.

Good luck!


So if I go with a standard shadowmapping sceme with FFP and make a depth texture can I use this texture to stretch over my whole terrain? Will this self shadow or just shadow objects that are in the way of the terrain... I am looking for self shadowing as of right now and am planning on doing the shadowmapping for my units.

Share this post


Link to post
Share on other sites
Ademan555    361
You might be ok using static lightmaps for your terrain, maybe just have it a resolution of 2 * width, 2 * height (or better yet break it up a bit) that would give you a little better than per vertex lighting values and cost you very little. To do a shadowmap for terrain is expensive, as it is a whole extra render, and you would also most likely need an insanely huge shadow map to get even remotely good aliasing. As for shadow mapping for your units, thats viable, but i say you should either use fixed function per vertex lighting for your terrain, or use a static lightmap (im debating whether splitting it up is a good idea or not)

hope that helps
-Dan

Share this post


Link to post
Share on other sites
gulgi    315
Shadowmapping means at least one more render-pass (at some point.. you don't have to update every frame), depending on how many shadow-maps you use.
And as have been said, if you use one shadowmap for the whole terrain, the quality can be really bad. This can somewhat be helped with more complicated shadow-mapping-algorithms as PSM, TSM and LispSM.
I would use one shadow-map per object/character.. terrain is usually quite flat and doesn't cast that much shadow...

To use a shadow-map with VP/FP is very straight-forward. Read the extension texts. I posted GLSL code for shadow-mapping a while back as well..

Good luck!

Share this post


Link to post
Share on other sites
Ademan555    361
Sure he doesnt hafta update the shadow maps every frame, but why wouldnt he want to? Except for the case of maybe, calcing the shadow map every 3 frames or something like that, the ADVANTAGE of shadowmaps is that theyre dynamic, lightmaps would be precompouted, static(advantage or disadvantage, you tell me), and another advantage over shadow maps, have the same resolution over the whole terrain.

hope that helps
-Dan

Share this post


Link to post
Share on other sites
MARS_999    1627
Quote:
Original post by gulgi
Shadowmapping means at least one more render-pass (at some point.. you don't have to update every frame), depending on how many shadow-maps you use.
And as have been said, if you use one shadowmap for the whole terrain, the quality can be really bad. This can somewhat be helped with more complicated shadow-mapping-algorithms as PSM, TSM and LispSM.
I would use one shadow-map per object/character.. terrain is usually quite flat and doesn't cast that much shadow...

To use a shadow-map with VP/FP is very straight-forward. Read the extension texts. I posted GLSL code for shadow-mapping a while back as well..

Good luck!


So you are saying I can calculate the shadowmap inside my VP/FP without using FFP methods?

Share this post


Link to post
Share on other sites
MARS_999    1627
Quote:
Original post by Ademan555
Sure he doesnt hafta update the shadow maps every frame, but why wouldnt he want to? Except for the case of maybe, calcing the shadow map every 3 frames or something like that, the ADVANTAGE of shadowmaps is that theyre dynamic, lightmaps would be precompouted, static(advantage or disadvantage, you tell me), and another advantage over shadow maps, have the same resolution over the whole terrain.

hope that helps
-Dan


Not sure which way you are leaning, but I have for the most part decided against having a dynamic light. I tried it and the scene gets to dark for nightime to be fun in a game and to be real that is real... I am thinking the best looking static lightmap precalculated for shadows and per pixel lighting would be good enough for most gamers...

Share this post


Link to post
Share on other sites
zedzeek    529
Quote:
So you are saying I can calculate the shadowmap inside my VP/FP without using FFP methods?

as someone mentioned the 2 dont have a relationship, read + understand a few papers about shadowmaps first

Share this post


Link to post
Share on other sites
MARS_999    1627
Quote:
Original post by zedzeek
Quote:
So you are saying I can calculate the shadowmap inside my VP/FP without using FFP methods?

as someone mentioned the 2 dont have a relationship, read + understand a few papers about shadowmaps first


I know that VP/FP don't have a relationship. I am assuming you will have to calculate some kind of depth value for the vertex which would be done in the vertex program if that is possible... and then send that value to the FP to be used with the current fragment. Maybe that clears up my statement.

Share this post


Link to post
Share on other sites
_the_phantom_    11250
you dont need a VP/FP to make a depth map for shadow mapping, the vertex transform is just a simple call to ftransform() in GLSL and the fragment program only needs to output the fragment (unless you are doing something funky like encoding it into a RBGA texture), which again is do able via the FFP.

However, on a modern card with no silcon spent for a FFP (GF6 and anything after the 9500) and the FFP being done via shaders its possible that writing a minimal shader might get you a tiny speed up, but dont quote me on that.

Share this post


Link to post
Share on other sites
MARS_999    1627
Quote:
Original post by _the_phantom_
you dont need a VP/FP to make a depth map for shadow mapping, the vertex transform is just a simple call to ftransform() in GLSL and the fragment program only needs to output the fragment (unless you are doing something funky like encoding it into a RBGA texture), which again is do able via the FFP.

However, on a modern card with no silcon spent for a FFP (GF6 and anything after the 9500) and the FFP being done via shaders its possible that writing a minimal shader might get you a tiny speed up, but dont quote me on that.


Thats great but I am not using GLSL as of yet and might be awhile...

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