Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Disable in-front camera volumetrics lights

Discussion in 'High Definition Render Pipeline' started by SentryGames, Jun 21, 2021.

  1. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    Hi there,

    I'm using HDRP 10.5 on Unity 2020.3 and I would like to know if it's possible to avoid displaying the volumetric lights when your camera is inside?

    For example in my picture, I want that my camera to see the 5 godrays in front on it but not the one we are under?

    Any tricks to do that?
     

    Attached Files:

  2. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    885
    I'm not sure if I understand but do you want that fog closer to camera to disappear/not be visible?
     
  3. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    Yes indeed :) In fact, when we are under the fog, it's not very pleasant to play, but we want to keep it when we are not inside because is much attractive
     
  4. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    885
    Currently, there is no concept of negative fog volume in HDRP so I don't think so that it's possible.
    One way could be to decrease overall fog density so that only far away object look like they are influenced by fog but I guess it would be too thin in your scenario.
    Another method could have been to attach a volume to the player itself and inversing the blend to make it thin on the inside but that has problem of its own https://forum.unity.com/threads/volumetric-fog-strange-black-ghosting-effect.1115443/
    So I don't think I would be able to help with that :(
     
  5. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    423
    Hey, a cheap workaround is to attach a meshrenderer to your camera, and make sure it casts shadows (either "On" or "Shadows only"). This will have the effect of blocking the light, and the area around the camera will not have illuminated fog as a result.
     
  6. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    Thanks for the idea, it works but to do it properly we need to create a "big" plane to mask all the light and it create weird shadows from the other light sources :/

    And if we reduce the size of the plane we do not get a clear benefit
     
  7. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    423
    You can use the light layer system for shadows btw, this way the mesh you use to "protect" the camera, only cast shadows from specific lights, but not from the rest.

    https://docs.unity3d.com/Packages/c.../manual/Light-Layers.html#shadow-light-layers
     
  8. SentryGames

    SentryGames

    Joined:
    Jun 4, 2014
    Posts:
    24
    Yes we tried, but it does not solve our problem. Because of the scale of the plane, when we are close to the border of the godray, the shadow mask the next rays :/

    The idea was really good but in our case the graphical result is not as good as we want :/

    upload_2021-6-22_16-23-25.png