My Current Endeavor:
I am in the process of developing a lightweight GIS application with topography. One feature I want to implement is atmosphere haze.
The Code I'm Working With:
(Please bear with me as I have multiple scenes)
fogColor = new THREE.Color(0x7EC0EE);
this.scenes[name].background = fogColor;
this.scenes[name].fog = new THREE.Fog(fogColor, 250, 2000);
//alternatively:
this.scenes[name].fog = new THREE.FogExp2( fogColor, .001 )
Issue Faced:
While both Fog and FogExp2 are effective for close-to-ground scale units in my app, there is an obstacle when the camera moves higher above the ground and looks downwards. At some point, the earth appears completely blue due to being enveloped by the fog setting.
The Question at Hand:
Is there a method to set a maximum opacity for the fog?
I aim for the distant topography to remain hazy but not entirely cloaked in solid-colored fog. My initial thought was to determine the farthest object in view and adjust the fog setting whenever the camera position changes, though I'm uncertain if this approach is too complex. Ideally, I would like to calculate fog intensity based on the volume of "air" between the camera and objects, ensuring it never surpasses a certain level of opacity. Would a shader be a more efficient way to achieve this?