HDRP Fog and Camera Issue

Hi there , I am having quite a difficult time setting up my scene with fog whenever I do so half my game screen becomes black, I have attached pic and the only way I can remove it is by disabling fog but I am working on a project which really requires fog so I can’t disable it other way to remove it is by changing Volume Mask Layer in Camera but it gives weird result. I am not an expert in HDRP or Unity in anyway , and your help will be greatly appreciated .


Is your “fog attenuation distance” set to more than say – 100 or so in your volume image effect settings? If the fog attenuation distance is set too low, that means the fog will start immediately around your camera’s area. Which will block out all of the light. I usually use around 1000 in my scene.

@Suryansh55 Do you have multiple directional lights in your scene or just one? I’m just curious.

I am having an issue with Fog and lighting as well though. I think it’s because the HDRP Fog image effect somehow blocks the light from directional lights in the scene (except for maybe one?). So when the fog is “on” it will block out most (or all) of the directional light in the scene. I’m not an expert either, so I hope someone can help.

Does anyone know how to make the fog not block all of the lights in the scene? In my scene, my main light seems to do ok – but all of my other directional lights essentially get canceled by the fog. Maybe that’s what is happening in your case as well?

@Velo222 Hii there , thanks for your reply I don’t think it’s a fog attenuation distance problem , and nor do I have multiple directional light but I do have 2 Cameras attached to the Player one for FPS and one for Arms , and camera attached to the Arms is causing this mess and only way I can fix it is by using Nothing in Volume Layer Mask but that removes fog magic in scene

You do know that HDRP does NOT support more than 1 camera? If you use a 1st person controller (with 2 cameras), you just killed your project. HDRP is set up currently to perform best with 3rd person controllers (1 camera).

I have 2, 1st person controllers working in HDRP, but i still have a performance hit, you have to compensate for that…

1 Like

@warthos3399 Damn that is bad , I thought it was just a minute problem thankfully my project is in pre-production , being a Unity fanboy I wanted to built it on Unity but I guess I will have to port to Unreal Engine

1 Like

Hi, you should never used two camera to make a First person game, you should always used a single camera. Most first person engine have a foreground layer they render at the same time as the world to save overdraw etc… The current way of doing it with HDRP which doesn’t have foreground layer is to manipulate the projection matrix in the shader graph, like show in this project GitHub - Unity-Technologies/FPSSample: A first person multiplayer shooter example project in Unity (Sorry it is a bit old now as it rely on 2018.3 but the FPS display is still valid).

(And yes, each camera in HDRP have a cost (we are working on it), thus why recommend to use single camera even for UI (with RenderingMode: After posptorcess)).

Lastly, for your information we support camera stacking in HDRP via the compositor tool: Graphics Compositor | High Definition RP | 10.2.2 . Still initial purpose is not FPS game development, so depends on your context.

2 Likes

SebLagarde is correct. But honesty, you shouldnt hastily jump to another engine, as all engines have their pros and cons, and ive tried them all. Most everything can be worked out in HDRP, just have to have some patience, and knowledge.

What you propose/want is do-able, you just have to compensate and optimize…

@SebLagarde Thanks for the useful info and I’m currently looking into using Compositor , but since I was using FPS asset from assetstore and it was built on Built-in render thus it had stacked camera , it has been quite complicated switching to compositor. Still thanks a lot for your feedback

This might come in a bit late, but I’ve had the exact same problem, and at the end… the problem is that fog is rendered on your weapon camera too. So, in your weapon camera go and check Custom Frame Settings, then under lightning uncheck Fog. HUH, that took some time to figure out. Cheers!

4 Likes

Thanks Dude, This helped me setup my scene good. Although the two cameras options are bad but your solution helped me at least render the scene even for all cameras.

1 Like