I’ve implemented a minimap by using a 2nd camera which shows the top-down view on the play-field of my game. Now I noticed that if fog is enabled for the scene, the 2nd camera is also affected by the fog. This is basically not what I want, so is there a way to disable fog for a camera?
Thanks in advance!
You can try to add an observer on
scene.onBeforeCameraRenderObservable.add(() => scene.fogEnabled = false);
So you will also need:
scene.onBeforeRenderObservable.add(() => scene.fogEnabled = true);
Note however that it will retrigger all material reevaluation each time, because the fog setting impacts the generation of the shader code itself.
So you should check that it does not impair too much your fps by doing so.
What about calculating the fog through a post effect and screen space depth?
Then it effectively is not there and neither camera “sees” it but you would be over laying it.