unity-game-enginegame-developmentlightinglight

Light Functions Weirdly On Nvidia Graphics Cards


EDIT: If you are curious about the game, you can inspect the game on steam: https://store.steampowered.com/app/2570900/SABAH_Sun_As_Biased_As_Harmony/

I have developed a video game on Unity. It works almost perfectly except weird light problem. I haven't seen any problem on AMD graphics cards (Tested on 2 different computers), but when I play my game on Nvidia GTX 1080, lights are going crazy. Why? How can I solve this problem? Thank you. Here are the screenshots about the problem: (The sun is not purple! or the leaves of the tree are not purple! and on the last screenshot, there are no green or purple lights on the original map. There is a light problem!) enter image description here enter image description here enter image description here

Those screenshots lighting should look like these (Correct Ones): enter image description here

enter image description here

enter image description here


Solution

  • I have found out the problem. The source of the problem is Skybox. I have used Unity's Procedural Skybox shader to make my own skybox material. I have changed almost all values to make my own one, and main reason of this problem is Atmosphere Thickness values are going crazy when you increase over 3 or 4 or directly 5. My setting was 5. And that was creating the problem. I have reduced the value and that weird lighting solved. However, I want it to be 5, but you know that creates the problem on Nvidia. I haven't seen any problem on AMD. That's so stupid.

    EDIT: I HAVE SOLVED THE PROBLEM. There is a falsy line on Unity's Procedurel Skybox Shader file. Open the .shader file and find this line:

    #define kRAYLEIGH (lerp(0.0, 0.0025, pow(_AtmosphereThickness,2.5)))
    

    and change it as this:

    #define kRAYLEIGH abs((lerp(0.0, 0.0025, abs(pow(_AtmosphereThickness,2.5)))))
    

    In this code, we are returning the absolute value. In this way, we are protecting the code returns negative values that causes the lighting problem in those screenshots. I guess, AMD handle those negative values better than Nvidia, so I haven't seen any problem on AMD. However, we have to return non-negative values, so we have used abs() function.

    My skybox material's values: enter image description here