Cast dynamic shadow from skybox onto map?

Discussion in 'Mapping Questions & Discussion' started by Werewolf, Aug 1, 2018.

  1. Werewolf

    Werewolf Probably not a real Werewolf

    Messages:
    872
    Positive Ratings:
    278
    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: Aug 1, 2018
  2. henke37

    aa henke37

    Messages:
    2,059
    Positive Ratings:
    501
    Objects in the skybox can not do dynamic shadows onto the rest of the level. You will have to do a full sized prop.
     
  3. Unregistered HyperCam 2

    Unregistered HyperCam 2 L3: Member

    Messages:
    124
    Positive Ratings:
    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?
     
  4. Werewolf

    Werewolf Probably not a real Werewolf

    Messages:
    872
    Positive Ratings:
    278
    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?
     
  5. Unregistered HyperCam 2

    Unregistered HyperCam 2 L3: Member

    Messages:
    124
    Positive Ratings:
    4
    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.
     
  6. Werewolf

    Werewolf Probably not a real Werewolf

    Messages:
    872
    Positive Ratings:
    278
    Id have to extend the map massively, just to fit single brush
     
  7. Berke

    Berke L2: Junior Member

    Messages:
    59
    Positive Ratings:
    24
    Just try to cover origin with nodraw?
     
  8. Unregistered HyperCam 2

    Unregistered HyperCam 2 L3: Member

    Messages:
    124
    Positive Ratings:
    4
    Ah I see, what about moving it closer to the light source? You could calculate the exact distance it would require and use a smaller brush
     
  9. Werewolf

    Werewolf Probably not a real Werewolf

    Messages:
    872
    Positive Ratings:
    278
    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?
     
  10. Unregistered HyperCam 2

    Unregistered HyperCam 2 L3: Member

    Messages:
    124
    Positive Ratings:
    4
    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: Aug 2, 2018
  11. Werewolf

    Werewolf Probably not a real Werewolf

    Messages:
    872
    Positive Ratings:
    278
    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.
     
  12. Freyja

    aa Freyja It hurt itself in it's confusion!

    Messages:
    2,924
    Positive Ratings:
    5,365
    Your shadow controller likely has a max distance for dynamic shadows to fall that's too short for such a big thing.
     
    • Agree Agree x 1
  13. Unregistered HyperCam 2

    Unregistered HyperCam 2 L3: Member

    Messages:
    124
    Positive Ratings:
    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.
     
  14. Dr. Orange

    Dr. Orange L6: Sharp Member

    Messages:
    388
    Positive Ratings:
    292
    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.
     
    • Thanks Thanks x 1
  15. Werewolf

    Werewolf Probably not a real Werewolf

    Messages:
    872
    Positive Ratings:
    278
    I had tried adjusting that. I set the distance up to 9999 and enabled all shadows. Still didn't work.

    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.
     
  16. Werewolf

    Werewolf Probably not a real Werewolf

    Messages:
    872
    Positive Ratings:
    278
    So nothing I have tried seems to have worked, so I'm just going to presume the answer to this is 'No'. Which is a shame because I really wanted to recreate that scene from 'Independence Day'.