OpenGL Fog: the z component is at the model transformation.

When dealing with fog, the z distance used to compute the fog density. However, which z?

Turns out, the z depth used is the z depth that is computed after applying the GL_MODELVIEW matrix but before applying the GL_PROJECTION matrix. One result of this is that through the careful manipulation of both matrixes you can create the effect of fog on the valley floor below the viewpoint: fog doesn’t just have to be haze in the distance.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s