Fogging problem with sea

Hi,
I am developing a 3d environment, which have terrain, sky dome, sea and other ships. I need to simulate the visibiliy of the camera (in terms of visibility parameter in meters). To do that i am using Linear fog.
Here is the fogging parameters
setVisibility(double distance)
{
linearFog.setFrontDistance(1);
linearFog.setBackDistance(distance);
linearFog.setColor(new Color3f(05f,05f,05f);
}

The problem with this is, although it works with terrain, ships etc., it does not work with sea as i expected. All the sea gets fogged, without any interpolation.
I implemented sea as a bid quad covering all the sea area with a sea texture and i gave motion effect by just changing texture position of the sea continuesly.
Can the problem be related to how i implemented the sea (one big quad), do i need to partition the sea into smal quads (which i dont prefer ), or is there any other
paramter that i should think about.

how about a screenshot ;D

on nVidia fog is applied per vertex - then interpolated for every pixel.

So if your sea-plane-vertices are all way beyond ‘distance’ they get 100% fogged, interpolating that across the pixels will result in a 100% fogged plane.

ATi however applies fog per pixel, using the depthbuffer, so you’ll probably find your renderer works like expected on ATi cards.

Workaround for nVidia cards: tesselate your sea-plane

Doesnt values passed to glhint decidie if for is to be vertex or pixel?

Hm, could be, but the the default setting is different between nVidia and ATi.

Never to old to learn something new :slight_smile:

Hi,
Thanks for the answers, the problem is solved by generating 2 sea quads. one is a close sea quad, which is divided into sub quads so that fog colors are scattered much more realistic, and the orher is far sea quad geometry which is needed only for when there is less fog in the scene.