Jump to content

  • Log In with Google      Sign In   
  • Create Account

Toggle Shadows On/Off


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
2 replies to this topic

#1   Members   

1419
Like
0Likes
Like

Posted 12 January 2014 - 12:59 PM

Hi

 

I wanted to know how one should approach toggling various shader effects such as Shadows on/off.

 

Should I have a single shader that checks a global bool and branch depending if shadows are on/off.

Or should I write two shaders, one with shadows on and one with shadows off?

 

Are there any considerations I should be aware of?

 

With multiple passes and many things to turn on and off on the fly, one could end up with dozens of shaders depending on what effects are on and what effects are off.



#2   Members   

1292
Like
0Likes
Like

Posted 12 January 2014 - 09:59 PM

Is this just for debugging purposes?  If so, I'd probably add a float to a cbuffer and multiply the shadow value by that: passing zero would effectively disable the shadows.

 

If it was for something more performance/release oriented, then yeah I'd write the extra non-shadowed-shaders.



#3   Members   

24828
Like
0Likes
Like

Posted 12 January 2014 - 10:27 PM

Add a setting to your rendering pipeline to enable or disable shadows (and whatever other features you want) and upon rendering use the shader appropriate for your render settings.  That means a shader without shadows if shadows are disabled.

 

 

L. Spiro






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.