Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Any ideas?

Product Version: UE 4.9
more ▼

asked Nov 05 '15 at 08:41 AM in C++ Programming

avatar image

18 4 5 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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!

more ▼

answered Nov 21 '15 at 04:21 AM

avatar image

1.5k 48 47 216

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question