We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Depth-fog (Read 992 times)
Depth-fog
Sep 30th, 2005, 5:06pm
 
I've written a small 3d landscape engine, and code to allow an object to travel around on the surface.

However, the edge of the landscape is easily visible as an edge against the background, and there's little dept information, as nothign changes but size with distance.

What I'm trying to achieve is to have objects over a certani distance start to fade into a fog/dust/atmosphere colour, so that the edge woudl only be visible if you got close to it, and to give more dept information to the viewer.

I've tried two solutions so far, neither of which are really usable.

Attempt 1 was to have a series of mostly transparent QUADS at certain distances from the viewpoint, so that they would add together over long distances. This does work, but is very noticable at the intersections between "fog poly" and ground, there's a sudden jump in the colour.

I've tried using the z-buffer, and going through pixel by pixel, adding colour depending on the value of the z-buffer, but this is incredibly slow if any pixels on screen aren't previously used, and are just showing the background colour it seems. As well as the fact that the z-buffer values don't appear to be all that predictable.

So I was wondering, does anyone have any other ideas about how to either speed up or improve either of the two methods, or any other ideas?
Page Index Toggle Pages: 1