Search Unity

Lighting changing depending on main camera

Discussion in 'General Graphics' started by unity_nnFw1AoPg3nEeA, May 20, 2018.

  1. unity_nnFw1AoPg3nEeA

    unity_nnFw1AoPg3nEeA

    Joined:
    Feb 14, 2018
    Posts:
    8
    Hey,

    i have a problem with my lighting, i uploaded a short video showing the problem.



    The same thing happens when the game is running. The lighting changes depending on the camera.


    This is what the main camera looks like. It is not attached to any other object.



    Im new to Unity so please be patient with me. :)

    Just tell me if you need more information.

    thanks in advance,
    Elias
     
  2. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    My guess is that you are using Forward rendering on the camera. It has a max number of light setting. Real time lights are expensive in forward mode .

    Try to switch to deferred on the camera. see if that helps.
     
  3. unity_nnFw1AoPg3nEeA

    unity_nnFw1AoPg3nEeA

    Joined:
    Feb 14, 2018
    Posts:
    8
    Thanks, this seems to fix the issue with the light. I'm going to have to do some reading on rendering paths to understand what exactly i'm meddling with here.

    Unfortunately with deferred rendering i'm not able to use the basic fog anymore, so i'm looking for some other way to get the fog effect back into my scene.




    I tried to use the Post Processing Stack repository but i'm not sure wether fog is even supported, as stated in this thread: https://forum.unity.com/threads/post-processing-stack-fog-missing.499713/



    Maybe i'm doing it wrong but there doesn't seem to be a fog effect in the new Post Processing repository:



    Should i just use the old legacy effects?



    EDIT:

    Bonus video of me moving around the ground plane, even though there's only a simple color texture on it:



     
    Last edited: May 20, 2018
  4. unity_nnFw1AoPg3nEeA

    unity_nnFw1AoPg3nEeA

    Joined:
    Feb 14, 2018
    Posts:
    8
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    With deferred rendering and the Unity PP 2.x stack you enable deferred fog effect in the post processing volume profile. It requires shader model 3 (not sure if the platform you are targeting supports that) and that deferred rendering be enabled, otherwise you won't see the setting, and after that it uses the fog settings in the lighting window as normal.

    Make sure you are using the 2.x post processing stack, and not the 1.x stack the thread you linked is referring to. If you got it from the asset store, you got the old 1.x stack. (If you are using Post Processing Volumes then you have the 2.x stack, if you are assigning profiles directly to your camera object then you are using the 1.x stack)

    https://github.com/Unity-Technologies/PostProcessing/wiki/Deferred-Fog
    https://docs.unity3d.com/Manual/GraphicsEmulation.html

    Personally though I just use a volumetric fog asset instead of Unity's built in fog for all my fog needs. Saves the hassle and I think it looks better.