Shadowmapping with shader: tex2D takes incredible resources with my shadowmap

Started by
2 comments, last by Mercenarey 18 years, 4 months ago
In my shader, doing a tex2D on my shadowmap takes incredible resources. I have just for the heck of it tried to use some other texture map, just to see if it was the indexing, that did it. And it seems as if it is... What is the reason? The stencil-defined surface? The format I use? My shadowmap's stencil surface is created with: D3DFMT_D24X8. The shadowmap texture is created with: D3DFMT_R32F. Shadowmap texture is furthermore defined as a D3DUSAGE_RENDERTARGET (of course). Is it a data format? Or is it because it is a rendertarget? Or something else that I totally overlook? Do you have similar performance problems indexing into the shadowmap on the shader, compared to indexing into "normal" textures? Edit: My card is ATI Radeon 9600. maybe it has special problems?
Quote:CalvinI am only polite because I don't know enough foul languageQuote:Original post by superpigI think the reason your rating has dropped so much, Mercenarey, is that you come across as an arrogant asshole.
Advertisement
If you render to your shadow map and then immediately read from it, you could be hitting a stall because the graphics card may not have finished rendering the shadow map in the first place by the time you try to access it.

You're also using a floating point texture format. The 9600 is a first generation SM2.0 card so it may not have the most optimzied floating point texture fetches. Fetching non-floating point textures is usually very fast, but floating point ones may not be as optimized.

neneboricua
I have a 9600 here as well and have had real problems with R32F shadow maps as far as I can recall. Do you have the lastest driver available?

What do you mean by "takes incredible resources"? Do you mean the drop in FPS you see?

Also if your shadow map is a non-Pow2 size that may be affecting things.

Quote:If you render to your shadow map and then immediately read from it, you could be hitting a stall because the graphics card may not have finished rendering the shadow map in the first place by the time you try to access it.


As long as you are not locking your shadow map surface you should not hit a stall as all you are doing is pushing more commands onto the command stream for the gfx card - the commands are executed in order so if you push: "Render To rtX" followed by "Render Using rtX to rtY" there should be no stall because "Render Using rtX" only occurs after "Render To rtX". IIRC.

Hope this helps narrow things down!

Mike.
The drop in FPS can be 50% or more, if I render a large area (like fullscreen 1024x768).

If I just index a garbage texture (I try to index the scene texture just to test, visual result is horrible, hehe), the FPS soar up again, barely making it noticable whether I use shadowmaps or not.

So I have concluded so far that it must be the shadowmap itself, and not the tex2D indexing...

I will get a friend to download my demo and test for FPS fullscreen vs. small window to see if he gets similar results. He has a kickass card, I am suspecting that my card is the culprit.
Quote:CalvinI am only polite because I don't know enough foul languageQuote:Original post by superpigI think the reason your rating has dropped so much, Mercenarey, is that you come across as an arrogant asshole.

This topic is closed to new replies.

Advertisement