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. Dismiss Notice

Question Underwater rooms

Discussion in 'General Graphics' started by Dr_D_and_D, Feb 3, 2023.

  1. Dr_D_and_D

    Dr_D_and_D

    Joined:
    May 20, 2020
    Posts:
    25
    Hi, recently I have been playing a lot of subnautica and was wanting to recreate the building system but I'm running into a problem where when in the rooms you can still see the fog if your building is big enough, I could just disable fog when inside but then there wouldn't be any fog outside when looking through windows, and idk how I could fix this. upload_2023-2-3_16-42-47.png
    (What I'm trying to achieve)
     
  2. Deleted User

    Deleted User

    Guest

    What rendering pipeline are you using? Is there a post-processing volume you can define for the building that overrides the global fog?
     
  3. Dr_D_and_D

    Dr_D_and_D

    Joined:
    May 20, 2020
    Posts:
    25
    Im using URP, and yes there is a post-processing volume I can define for the building that overrides the global fog
     
    Deleted User likes this.
  4. N7RX_Y

    N7RX_Y

    Unity Technologies

    Joined:
    Jun 29, 2020
    Posts:
    8
    (*Not an expert in URP)

    I think in this use case you will need to write your own shaders for the building/objects where you don't want fog to be rendered. URP's volume overrides post processing based on camera location, but it won't affect per object rendering setting.

    To create such a shader, you may refer to:
    (*I don't see URP providing a way for disabling fog on per opaque material basis, hopefully they will add this in the future... or someone please correct me if it was already added)

    I guess you will want to apply the no-fog shaders ONLY to indoor area objects, so that when looking from outside, the building still gets covered in fog. Also, transparent parts like windows might need some extra care.
     
    Deleted User likes this.
  5. Dr_D_and_D

    Dr_D_and_D

    Joined:
    May 20, 2020
    Posts:
    25
    Thank you https://cmwdexint.com/2022/08/24/turn-off-fog-for-urp-lit-shadergraph/ was fairly helpful, it allowed me to achieve a basic effect.
     
    N7RX_Y likes this.