Global Fog not hiding geometry at far end

Hi,

I’m having problems with fog not hiding properly the geometry at camera’s far.

For instance, in this scene, there is a sphere half outside of the far end of the camera. The Fog affects to the sphere, but just where the far plane cuts the sphere, you can see a ring, the fog isn’t working the way it should.

It only happens with Opaque materials, with Fade or Transparent materials it works.

I think the Global Fog shader has problems to process geometry at the far end.

Have you experienced anything like this?

Do you consider this is a Global Fog shader’s bug?

Ok. So I solved the problem commenting lines 140 and 141 of GlobalFog.shader

	// Compute fog amount
	half fogFac = ComputeFogFactor (max(0.0,g));
	// Do not fog skybox
	//if (rawDepth >= 0.999999)
	//	fogFac = 1.0;
	//return fogFac; // for debugging

The drawback is that the fog hides the skybox, but that’s an effect that I wanted (when there’s fog you cannot see the sky).