Toggle Shadows On/Off

Started by
1 comment, last by L. Spiro 10 years, 3 months ago

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.

Advertisement

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.

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement