Cast dynamic shadow from skybox onto map?

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
I have an in game event where a UFO flies over my map. That in itself is a prop_dynamic parented to a func_tracktrain. As my map is set during the day with a bright overhead sun, the UFO passes between the sun and the ground. For the effect to work, I need it to cast a shadow down onto the map.

What I want to know is if this is possible and if so how?
 
Last edited:

henke37

aa
Sep 23, 2011
2,075
515
Objects in the skybox can not do dynamic shadows onto the rest of the level. You will have to do a full sized prop.
 
Mar 2, 2018
124
4
Wouldn't it be possible to use a func_brush in the shape of the shadow with a logic_measure_movement with a scale of 1/16 or something to cast a fake shadow?
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
Wouldn't it be possible to use a func_brush in the shape of the shadow with a logic_measure_movement with a scale of 1/16 or something to cast a fake shadow?
I did consider using a fuc_brush with the BlockLight texture applied, but that would have required it to be 4,720hu across.

I've also noticed that my prop_dynamic isn't casting a shadow to the skybox itself either, even though I have shadows enabled. I'm guessing I'll need a light_dynamic for that?
 
Mar 2, 2018
124
4
I did consider using a fuc_brush with the BlockLight texture applied, but that would have required it to be 4,720hu across.

I've also noticed that my prop_dynamic isn't casting a shadow to the skybox itself either, even though I have shadows enabled. I'm guessing I'll need a light_dynamic for that?
I don't see a problem with a 4720 units brush entity unless there's something I'm missing..
I'm not sure at all about the second question.
 
Mar 2, 2018
124
4
So use a smaller brush, and parent a light_dynamic over it at close range so that it casts a shadow down onto the ground?
Depends on your light source which is probably the skybox textures(?) unless I am mistaken, my guess is that you need to move it up towards the skybox texture that emits the already existing light.
Use the existing brush length and width to calculate how closer you will need to move it to the light and resize it using Thales' theorem.

Edit: Actually I'm not even sure about the mathematics behind all of this anymore I might have made a mistake one thing for sure is that making the brush smaller and moving it closer to the skybox textured face will leave you with a similar enough result that most players won't notice any differences.
 
Last edited:

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
To be honest I'm not after an accurate, to scale shadow. So long as it looks like the UFO is casting a shadow then that should be good enough.

Now I have tried making a func_brush with the BlockLight texture applied, and set a light_dynamic above it pointing directly down, but it won't work.
 

Freyja

aa
Jul 31, 2009
2,994
5,813
Your shadow controller likely has a max distance for dynamic shadows to fall that's too short for such a big thing.
 
Mar 2, 2018
124
4
Also you don't need a dynamic light entity, skybox textures emit light and the light you see on the floor comes from those textures probably not a dynamic light meaning to make a shadow on the floor you need to block the light the skybox textures emit. not a dynamic one.
tl;dr don't add a light_dynamic and move the brush closer to the ceiling of the map (would work I hope but I am not sure about how the light emitted from the skybox works especially when a light_environment is used.
 
May 25, 2015
390
307
The light emitted from light, light_spot, and light_environment is completely static in that it won't cast real-time shadows what-so-ever. light_dynamic can be moved but, if I remember correctly, it can't cast shadows and even if it could I doubt it would use actual projection to make the shadows bigger if the object is closer.

The best way to make a dynamic shadow is to use render-to-texture shadows, which can be controlled through the shadow_control entity. However, these are not porjected through the 3D skybox, so you must place a scaled up version of the original object in the actual world for it to cast shadows, and you must increase the shadow distance in the shadow_control entity if it's more than 75 units above the ground, which it probably is in your case. You can't use a func_brush in the world, since they don't cast RTT shadows. However, I believe that func_physbox entities cast shadows, but those can be tricky to work with.
 

Werewolf

Probably not a real Werewolf
aa
Apr 12, 2011
873
309
Your shadow controller likely has a max distance for dynamic shadows to fall that's too short for such a big thing.
I had tried adjusting that. I set the distance up to 9999 and enabled all shadows. Still didn't work.

The light emitted from light, light_spot, and light_environment is completely static in that it won't cast real-time shadows what-so-ever. light_dynamic can be moved but, if I remember correctly, it can't cast shadows and even if it could I doubt it would use actual projection to make the shadows bigger if the object is closer.

The best way to make a dynamic shadow is to use render-to-texture shadows, which can be controlled through the shadow_control entity. However, these are not porjected through the 3D skybox, so you must place a scaled up version of the original object in the actual world for it to cast shadows, and you must increase the shadow distance in the shadow_control entity if it's more than 75 units above the ground, which it probably is in your case. You can't use a func_brush in the world, since they don't cast RTT shadows. However, I believe that func_physbox entities cast shadows, but those can be tricky to work with.
What if I took the same prop_dynamic, scaled it up 16x, made sure shadows were enabled on it but most importantly, set its alpha to 0.

Of course at this point you have to ask why bother with the prop that's in the skybox when I'd have it in the map anyway.