Home Unreal Engine

Problem with volumetric fog from a stationary directional light.

rogrobin
polycounter lvl 9
Offline / Send Message
rogrobin polycounter lvl 9

Hi

Im trying to set up volumetric fog on a stationary directional light. It it behaves as I expect when Im setting it up but when I relightmap the scene something goes very wrong. If I then switch the light to moveable it works as expected. But switch the light to Stationary (or Static) and it breaks again.

I thought that volumetric fog worked with stationary directional lights?

I also have a skylight and a BP_Sky_sphere in the scene. I cant figure out what is going on. Here are my light and fog settings. Any help would be appreciated. 

Replies

  • B_P_L
    Offline / Send Message
    B_P_L greentooth
    Wow.... this is odd, I just came here to post a question about exactly this same problem! This is 100% the exact thread I was going to make... weird, no?

    Anyway - so, as I said - I'm in the same situation as OP: I get a nice, sharp volumetric fog occlusion / light-shaft effect on the spotlight coming thru my window when it's set to movable:

    movable spotlight

    ....BUT, I want to use it for baked lighting so I can get that nice hot-spot reflection with the shadow from the window frame you can see on the floor (that's the result of a previous bake btw...)
    But whenever I set the spotlight to stationary so it contributes to baked lighting and dynamic lighting - this is the result:


    stationary spotlight

    The light-shaft has more or less vanished. Am I just going to have to do the lighting in two stages at the end? So, when the scene is done I run the final production-quality bake and then switch the stationary lights to movable? It works of course, but I'm wondering if there's a more efficient / permanent solution?

    Here's the light setup in context:

    Inner and outer cone angles are pretty close to each other....


    Each window has two panes of glass (single poly planes, not boxes): one facing outward and one facing in. Outward facing glass has modulated-emissive material to allow light through, inward glass just has emissive material so player can't see out. Neither of the glass materials are set to two-sided. Both inward and outward glass meshes are set to add emissive to static lighting.  Wall materials are set to two-sided.

    Any ideas? 

    Thanks in advance for any help, and I hope OP doesn't mind me slightly hijacking the thread...
    B.
  • B_P_L
    Offline / Send Message
    B_P_L greentooth

    I'm actually happier with the result I'm getting when I first bake the light set to static - then after the bake, set the same light to movable; much sharper, more defined shadows in the bake.
    This is giving a better result than when set to stationary, both before and after baking....

    Going to go forward like this unless someone knows of a simpler, one-step way of doing this and getting the same quality?
  • rogrobin
    Offline / Send Message
    rogrobin polycounter lvl 9
    @ B_P_L  -Thanks for posting.  Its reassuring to know that Im not the only one with this problem!

    It was interesting to see your workaround -I havent found a solution but Ive been using a similar way that seems to work for me. 

    Rather than bake the light then switch it to moveable I duplicated light and set one copy to be a dynamic light (moveable) with the volumetric fog turned on. The other I set as static (with volumetric turned off) and gave it a a very low intensity and a high indirect lighting intensity setting.  The idea is to have one light to bake the bounce only light and the other as a dynamic light with the volumetric fog.

    TBH your way seems a lot simpler!


    Cheers.

  • B_P_L
    Offline / Send Message
    B_P_L greentooth
    Hey again @rogrobin - glad you didn't mind me barging into your thread with my own issues!
    I initially tried it your way (two lights in same position; one static, one dynamic) but it seemed to me that the movable light was confusing the bake somehow and ending up at a worse result - shadows weren't so well defined. Also, (I didn't time it, so I may be exaggerating) but I'm fairly sure the bake took significantly longer with the two lights active at the same time.... Maybe give it a shot the other way and post comparisons?

    Anyhow - I'm having another minor issue with this and I'm wondering if anyone can help out?

    The spotlight is so close to the window that the shadow / hot-spot on the floor is comically huge and distorted - shadows from mid-day sunlight should be about the same size as the object actually creating the shadow....


    But whenever I move the light beyond a certain distance from the window, volumetric shadowing from it is disabled....

    Current position:


    After moving light back:


    I can't figure out what is cutting it off - whether it's a setting in the light or in the height fog actor, or maybe even in the window? or the window material? Even when it's moved back, the light is still within the bounds of the lightmass importance volume and everything I want it to hit is within it's attenuation radius. Increasing intensity / attenuation distance / volumetric scattering intensity does nothing - its just cut-off entirely beyond a certain distance from.... I don't know - distance from the particle emitters? the window?

    Any ideas? I just want to re-shape that ridiculous shadow without losing volumetric shadowing... 

    Thanks again, B.




  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Looks like 2 different issues to me. To fix the second one, try increasing the volumetric lightmap resolution. About the first one, I'm thinking that its because of one sided geometry maybe.
  • rogrobin
    Offline / Send Message
    rogrobin polycounter lvl 9
    @B_P_L Might be a silly question but have you tried making the light brighter!?  -if you take the light further away then it will need to be brighter to give the same volumetric effect  -esp if you have the inverse square falloff on.  Failing that maybe try increasing the lights volumetric scattering intensity. 

    @Obscura Thanks for the input. A question:  When you say increase the volumetric lightmap resolution do I do that by decreasing the Volumetric Detail Cell Size value in the Lightmas settings?  

    Also I tried double sided geometry and giving the mesh a thickness so I dont think its that. :/

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Yes. Thats what i meant. 
  • rogrobin
    Offline / Send Message
    rogrobin polycounter lvl 9
    @Obscura OK thanks -I'll give it a test when I get home later.
  • B_P_L
    Offline / Send Message
    B_P_L greentooth
    rogrobin said:
    @B_P_L Might be a silly question but have you tried making the light brighter!?  -if you take the light further away then it will need to be brighter to give the same volumetric effect  -esp if you have the inverse square falloff on.  Failing that maybe try increasing the lights volumetric scattering intensity.  
    Hey again - no it's not anything to do with intensity or falloff, I've tried all that. Something is being culled as the light moves beyond a certain distance because the volumetric shadowing is there one moment, and then I move it a tiny bit more and it shuts off entirely. But what is being culled, and what it is being culled by is what I can't figure out. The window? The light itself? The height fog? The particle emitters? Can't figure it out.

    Re: Your first post - just seen that the volumetric scattering intensity of your directional light is at 100 - that's insanely high.
    I may be wrong, but when you're setting up a stationary light it effectively behaves as a pure dynamic light with volumetric shadowing, so it'll look ok with those settings before baking.
    After baking - for whatever reason - the volumetric shadowing doesn't function the same as before, so that scattering intensity of 100 is going to just totally overwhelm your entire scene.

    Have you got any particle emitters working in there with your fog? I ask because I'm guessing you've cranked your volumetric scattering intensity just to make it look visible, right?
    That could be your answer - the exponential height fog actor doesn't look great by itself in the foreground - you ideally need some particles in there to work with it. Once you do that you can drop the scattering intensity to a sensible level and you should be on your way after that. 

    Here's my master material setup that I use on particles;

  • rogrobin
    Offline / Send Message
    rogrobin polycounter lvl 9
    Re: Your first post - just seen that the volumetric scattering intensity of your directional light is at 100 - that's insanely high.
    I may be wrong, but when you're setting up a stationary light it effectively behaves as a pure dynamic light with volumetric shadowing, so it'll look ok with those settings before baking.
    After baking - for whatever reason - the volumetric shadowing doesn't function the same as before, so that scattering intensity of 100 is going to just totally overwhelm your entire scene.
    Yes -I overcranked the scattering intensity so that I could more clearly see the errors.  Interesting point that you suspect that the volumetric shadowing doesnt behave the same after baking -but I am not sure that this is the case.  At least this is not something that I have been able to recreate in my tests.

    Thanks for posting your fog particle master material.  Im very much a beginner with blueprints (Most of my experience is with a proprietary engine) so I havent yet been able to give it a go.  But I will when I get a chance. It would be really great to be able to control where the volumetric fog was in my scene rather than a global setting.

    Back to my original issue: I found that increasing the volumetric lightmap density (i.e. decreasing the Volumetric Lightmap Detail size in lightmass settings) had no effect on the visible volumetric light shaft. I tried it as low as 25 (default is 200) and there was no difference in my scene.

    Increasing the thickness of the walls made no difference.

    What did make a big difference was the Static Lighting Level Scale value. With the Static Lighting Level Scale set to 1 there was some discrepancy where the volumetric effect started and the edge of the window.  Setting the Static Lighting Level Scale to 0.25 made this much more accurate.  I also tried setting the Static Lighting Level Scale to 4 and the error is much more pronounced.  This is the problem that I was seeing in my scene.  
    Static Lighting Level Scale 0.25

    Static Lighting Level Scale 1


    Static Lighting Level Scale 4

  • rogrobin
    Offline / Send Message
    rogrobin polycounter lvl 9
      UPDATE:  I found out that the resolution of the volumetric light shaft is directly related to the resolution of the shadow map of that light.  So in my scene setting the Shadow Resolution Scale to higher than 3 on the light resolves my issue. :)  I tested this on a spotlights and directional lights and it works exactly the same on both.

    On a directional light this could also be resolved by setting up an appropriate cascaded shadow map.  i.e high rez shadows where you need high rez volumetric light shafts.

    No need to change the Static Lighting Level Scale.
Sign In or Register to comment.