Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 Knight52   Members   -  Reputation: 171

Like
0Likes
Like

Posted 30 August 2012 - 04:53 AM

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?

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31822

Like
0Likes
Like

Posted 30 August 2012 - 04:59 AM

it'll fail the technique validation

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

#3 Knight52   Members   -  Reputation: 171

Like
0Likes
Like

Posted 30 August 2012 - 05:26 AM

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


#4 Lightness1024   Members   -  Reputation: 739

Like
0Likes
Like

Posted 30 August 2012 - 06:32 AM

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

#5 kunos   Crossbones+   -  Reputation: 2207

Like
1Likes
Like

Posted 30 August 2012 - 06:37 AM

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
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#6 Knight52   Members   -  Reputation: 171

Like
0Likes
Like

Posted 30 August 2012 - 07:06 AM

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, 30 August 2012 - 07:09 AM.


#7 Jason Z   Crossbones+   -  Reputation: 5324

Like
0Likes
Like

Posted 30 August 2012 - 07:14 AM

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.

#8 kunos   Crossbones+   -  Reputation: 2207

Like
1Likes
Like

Posted 30 August 2012 - 07:27 AM

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
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#9 Knight52   Members   -  Reputation: 171

Like
0Likes
Like

Posted 30 August 2012 - 07:43 AM

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?

#10 kunos   Crossbones+   -  Reputation: 2207

Like
1Likes
Like

Posted 30 August 2012 - 08:01 AM


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?


positive ;)
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#11 Lightness1024   Members   -  Reputation: 739

Like
0Likes
Like

Posted 31 August 2012 - 02:38 AM

if that is the problem, in DX9 there is a way to share the same depth surface for every rendering. just make it the largest needed size. in DX10 however I never found a way to do that.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS