Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Toggle Shadows On/Off

4: Adsense

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   

1468
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 Funkymunky   Members   

1385
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   Members   

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