Basic Graphics principle:
FOG is when you blend two pixels based on distance:
Pixel 1 is the color of the dot on the screen normally.
Pixel 2 is the FOG blend color you select.
At a close distance you will see 100% of pixel 1 and 0% of pixel 2.
FINAL COLOR
At 50% distance you will see 50% of pixel 1 and 50% of pixel 2.
FINAL COLOR
At a far distance you will see 0% of pixel 1 and 100% of pixel 2.
FINAL COLOR
COH2 EXAMPLE
The farther away we look we see all drawn objects becoming grey. Grey is the FOG blend color.
COH2 lets you set the minimum and maximum distances for fog calculations. Generic numbers are like 25m and 300m. So nothing gets FOG if closer than 25m. Things from 25-300m are blended with the blend ratio being DISTANCE/MAX DISTANCE. Anything after 300m is just the FOG blend color.
COH2 WATER
The water in COH2 is a FOG effect generically.
The MINIMUM distance is the water level set in the WATER object dialog.
The MAXIMUM distance is set in the terrain dialog as DEPTH.
In the example above the water is at level 7.7m and the lowest terrain is at 4m.
So objects/terrain drawn at 7.7m are drawn with 0% blending of the FOG blend color (Water color).
Objects are then blended by the blend ratio of distance from the water surface (7.7m).
Blend Ratio = (WaterY-PixelY)/(WaterY-DepthY)
Ratio is clipped to a number between 0 and 1 (0% and 100%)
So objects at the surface are not blended. Objects below the surface are blended. Objects below WaterY and Depth are 100% water color.
The deepest darkest water will be the WATER COLOR you setup in the terrain dialog. In this example it is a dark brown color.
WATER COLOR