Can I have a Spotlight that casts shadows of different depth than the light?
I have a spotlight the player can move around and casts dynamic shadows.
The attenuating radius applies equally to the light and shadows. I want to decouple them such that the shadows can be shorter. For example, the spotlight attenuating radius can be 2000, but only cast shadows up to 500.
I tried having two spotlights, one with casting shadows at 500 and one with none at 2000, but the non-shadow-casting light drowns out the shadows (i.e. one spotlight creates the shadows and the other lights them thereby undoing them).
Part of the effect is for performance so simply making the shadow fade out faster is not enough. The cost of dynamic lights is proportional to the # of dynamic lights x # of meshes x # of polys so I actually want fewer meshes sent to the shadow mapping process.
I imagine a bit of coding is necessary to accomplish this. I'm looking into ShadowSetup.cpp and ShadowRendering.cpp to either reduce the # of primitives, light radius, or some other trick.
asked Nov 05 '15 at 08:41 AM in C++ Programming
The short answer is 'No'. You can go into ShadowSetup.cpp and look in InitDynamicShadows, you'll see lights iterated through. Each light has a 'DynamicPrimitiveList' which is all the primitives that light affects. You can cull the ones that are too far yourself. I imagine this would create a pop as you get in and out of your custom shadow range. The normal fade is created by the attenuation of light (near the range of the light, pixels are close to unlit). To fix this, you'd have to add your own distance-based shadow modifier in the shader (maybe ShadowProjectionPixelShader?). Good Luck!
answered Nov 21 '15 at 04:21 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here