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

Started by
9 comments, last by Lightness1024 11 years, 7 months ago
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?
Advertisement
it'll fail the technique validation
Can you expand on this - something with the effect framework generates an error?

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);
}
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 ?)
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.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

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?
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.

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?

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni



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 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 ;)

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

This topic is closed to new replies.

Advertisement