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 Tispe   Members   -  Reputation: 1046

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.



Sponsor:

#2 Funkymunky   Members   -  Reputation: 686

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 L. Spiro   Crossbones+   -  Reputation: 14262

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


It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums




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