Jump to content
  • Advertisement
Sign in to follow this  
Knight52

[c++] having shadow map larger than display window

This topic is 2217 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

say the shadow map is 1024x1024 pixel. If the display window is larger than that (1280x1024), it's fine. If it isn't (800x600), it'll fail the technique validation. Did I miss something?

Share this post


Link to post
Share on other sites
Advertisement
it'll fail the technique validation
Can you expand on this - something with the effect framework generates an error?

Share this post


Link to post
Share on other sites

Can you expand on this - something with the effect framework generates an error?



HRESULT result = effect->ValidateTechnique(ShadowTechnique);
if(FAILED(result))
{// will generate error -2005530591 D3DERR_CONFLICTINGRENDERSTATE
MessageBox(cq->handler(), "Failed validating Shadow Mapping technique", "ERROR", MB_OK);
}

Share this post


Link to post
Share on other sites
Doesn't make sense for me. you can validate a technique before allocating the render targets and there fore the technique validation supposedly is unaware of any resolution of anything.
In particular, if you were not using render targets, but the backbuffer to render your sahdow maps (by then copying the render into a texture and not swapping).
You could have an issue because obviously the backbuffer will have the size of the window. But nothing to do with render states or techniques in any case.

Apparently this message is talking about some states put in the fx code. do you have a different .fx file for your case with 800x600 window and 1280x1024 window ?

(by the way, why do you have window in 4:3 aspect ratio, you still have a 4:3 screen ?)

Share this post


Link to post
Share on other sites
perhaps the shadow map creation pass is sharing the main depth buffer? I noticed that you can set a color buffer with a bigger depth buffer, but not the opposite.
Make sure you create both color and depth buffer for your shadow creation pass.

Share this post


Link to post
Share on other sites
I swap default render target to shadow map's surface before rendering the map, then swap back when finished, if that's what you mean.

you ask why does screen have 4:3 ratio? Isn't it still standard resolution ratio nowaday? I mean I will, at least, try to make this game go public, so shouldn't it at least have 4:3 ratio? Edited by Knight52

Share this post


Link to post
Share on other sites
I have had this issue before - it is probably that your depth buffer is not the same size or larger than the render target that you are trying to render your shadow map into. Try creating a second depth buffer that matches the size of your shadow map, and then bind it accordingly when generating the shadow map. Also don't forget to rebind the original depth buffer when you switch back to render the rest of the scene.

Share this post


Link to post
Share on other sites

I swap default render target to shadow map's surface before rendering the map, then swap back when finished, if that's what you mean.



do you also swap the depth buffer with one with the same size as the shadowmap?

Share this post


Link to post
Share on other sites


do you also swap the depth buffer with one with the same size as the shadowmap?


so that's the problem. Should I create another texture for this swapping?

Share this post


Link to post
Share on other sites

[quote name='kunos' timestamp='1346333229' post='4974799']
do you also swap the depth buffer with one with the same size as the shadowmap?


so that's the problem. Should I create another texture for this swapping?
[/quote]

positive ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!