Missing Shadows?

Hi all,

I have a few simple assets in my game, and I noticed this evening that some of them are not seemingly casting shadows.
i
I have checked the lighting settings against the other assets which are working as expected and I see no differences. They also share the same base material.

The only thing I have thought of which may be a factor is the size of the object in the game. The projectiles, which do not have shadows appearing, are 5x5x5 cubes, the shields/bunkers in this screenshot are made up of a series of those same assets, using ChildActorComponents in a Blueprint to spawn them at runtime.

I wondered if there was perhaps a setting somewhere that indicated a minimum size of an object which Unreal may not apply shadows to?

If you can think of anything else I could check I would be really grateful. Not overly bothered about the projectiles as they tend to move quite quickly and you can’t notice it, but there is a noticeable difference with the shields/bunkers.

Screenshot to demonstrate;

Thanks in advance :slight_smile:

Silly question maybe, but is it just because you have nothing to cast the shadows on?

Hey :slight_smile:

The background image is there, as it is for the other assets in the scene, the Invaders and the player. They are all the same distance from it, and the camera is on such an angle there kinda should be shadows…?

Ok, I thought it was a skybox. But even if it is a mesh, there no shadows in space, well, not on space itself… :slight_smile:

Yeah, I know, but this gives a nice little sense of depth, I kinda like it. The point here though is why some of these meshes are getting shadows and some are not.

I’m still leaning towards my “size” theory, and that the 206 ChildActorComponents on each bunker are deemed as individual static meshes, rather than one larger object and thus get ignored.

That’s gonna bit it, just too small…

The only thing I guess you could do is have another single mesh there to cast the shadow, that’s not visible at gameplay.

Details panel ‘hidden shadow’. It could be a sphere, so you get a nice vague shadow, but you’d need another smaller one to swap to as the hut got destroyed.

There are 206 blocks that make up that shape, if I wanted an accurate shadow I’d have to create so many variations of where the bunker could have been damaged it would be a bit insane…

…I’d much rather find an option that allows you to override the minimum size for shadows… must be something like that if that kind of limitation/performance option is in place in the first instance?

Not what I mean Rob.

2 shapes, both spheres actually. Once rougly the size of the hut, the other about half.

I’m not aware of any setting I’m afraid :-/

I appreciate the suggestion but I don’t think anything other than an actual representation of the blocks remaining will look right.

If the player shoots the bunkers, for example, you can get very unusual shapes being formed by the few blocks that can remain, in cases like those, there would be a larger shadow than the blocks should cause, which I think will probably stand out as much as it does at the moment without having a shadow at all etc.

Yeaah, you’re probably right, but I don’t think there’s an answer to this unfortunately…

Tis a shame, as, whilst not accurate from a space/lighting/reality perspective, I think the shadows add some value, looks quite flat with out them…

…oh well, will plod on… thanks, as always, for the replies :slight_smile:

I’d also be keen to know how to enable the shadows when running the game in the editor. At the moment, nothing is visible whilst editing, I have to build the game each time, which is a pain when you want to try different things to see what may work (running in Standalone mode doesn’t work either)

I wondered if there was perhaps a setting somewhere that indicated a minimum size of an object which Unreal may not apply shadows to?
The command r.shadow.radiusthreshold might help, if this is indeed the issue.
Lower values mean smaller objects will cast shadows.

Hiya,

Thanks for this, is this something I can achieve in Blueprint?

It’s a console command ( hit the back tick ` ).

You can run console commands from BP with ExecuteConsoleCommand.

Looks like its something under the project settings options too, rather than perhaps being “code” as I first assumed.

Will try to test this last today. :slight_smile:

Ok, so that little test was quite useful, although I’m not certain how to resolve it either! :smiley:

I dropping the projectile into a new, default, scene and there was no shadow. I dropped the player ship into the scene and there was a shadow, by default, without me having to do anything. (I had previous set the default light to a value of 10).

I then moved the camera in closer in “fly” mode towards the ship and as I did a shadow appear for the projectile!

So, it looks like the camera distance from the meshes is the cause of the lack of shadows, and because my bunkers are made up of lots of tiny blocks, these are behaviour differently, as smaller objects, than the player ship for example…

So I guess I’m looking for a setting now that allows you to configure the “viewable distance” or something like that, guessing I’ll need to increase it until I can see the shadows for the bunkers too… I’m less concerned about the projectiles, as they move so quickly its a bit of a moot point, but the bunkers would be a nice win…

Answers on a post card please - or here, which ever is easiest! :smiley:

Sadly the r.Shadow.RadiusThreshold command doesn’t appear to have had any effect.

I tried it in a few combinations…

My project settings already have the Shadows set to Epic, so its value should already be set to 0.03 (based on the docs).

I used the console to set it to 0.02 and 0.01 consecutively, built the game and tested, still no shadows.

It occurred to me that the project settings may be overriding whatever I’ve set via the console at build time, so, in the level blueprint, I added an ExecConsoleCommand and popped it in there, setting it again to 0.01. Built the game, played it, still no shadows.

I am at a bit of a loss with this now.

I’m going to create a dummy level and just drop the block in there and see what it does by default, but without any shadows appearing in the editor its a real pain in the bottom to have to keep building it to check this.

Any ideas how shadows can be enable IN the editor?

So, after a bit more digging, it seems that changing the r.Shadows.FadeResolution will make my bunker’s shadows appear… but… the default value is 64, and I have to change it to a value of 2 before they will appear - when I do this, the FPS drop massively and the game becomes very slow.

I noticed that the projectiles shadows are appearing with the value set higher, but I think that’s because I have them scaled up slightly, the bunkers have the smallest cubes…

Wondering now if I can get the camera in closer, without anything dropping out of the view, in order to not have to reduce the fade resolution so much, and still keep the FPS up high… the camera wasn’t really where I wanted it in the first place, was just the only way I could seemingly make the game all fit and be visible - probably something else I’m missing here…

humpf…

I’m guessing your material is translucent? If that’s the case, then it will not render shadows. You’ll want to use the “masked” material option instead and work with that.