POV-Ray : Newsgroups : povray.advanced-users : How to avoid or remove fog from the backgound? : Re: How to avoid or remove fog from the backgound? Server Time
28 Jul 2024 12:34:40 EDT (-0400)
  Re: How to avoid or remove fog from the backgound?  
From: Elmar Krieger
Date: 27 Jul 2005 18:25:00
Message: <web.42e808c45ae24a7b386d56720@news.povray.org>
Warp wrote:
> Elmar Krieger wrote:
> > 1) Create fog that doesn't start immediately at the camera, but only at a
> > certain distance from it, so that some close objects are not fogged at all.
> > Comparable to the OpenGL GL_FOG_MODE GL_LINEAR feature that allows to
> > specify where the fog starts and where it reaches the maximum density.
>
>   You have to take into account that povray, as a raytracer, can also
> calculate reflections and refractions. Thus you have to make a distinction
> between fog which is calculated along a ray (regardless of where the ray
> starts) and a fog which is calculated in relation to the location of the
> camera.
>
>   Probably what you want is a "sphere" of fog centered on the camera so
> that the "inside" of the sphere is fog-free and then, at some distance,
> the fog starts getting denser.

Thanks for the hint. Trying to mimic OpenGL, the distance from the viewplane
is more important for me, so I just put my objects into a hollow box and
filled it with absorbing media. This way I got indeed a nice fog (at least
black, other fog colors seem difficult), but rendering took a factor 3
longer. Anyway, the original trick with fast rotated ground fog along the
Z-axis also worked.

My main problem is still to keep the fog from affecting the background (I
want to insert my own non-ray-traced background using the alpha channel of
the +UA +FN output).

>
>   If I'm not complately mistaken (I haven't actually tried it) you can
> get this effect by using a global media (which type? that's a good
> question) using spherical mapping (just scale the media big enough).
>   Even though media cannot be sampled for rays which do not hit anything,
> I think that povray still calculates the color of the media correctly
> assuming that it travels an infinite distance inside it (or at least
> I remember encountering this phenomenon in the past).

Unfortunately yes, I need a way to just ignore these rays traveling an
infinite distance.

Maybe a solution: I just found a mod called MegaPOV which can also output a
depth map in a single render pass. Then I could render my scene without any
fog (and get the alpha channel I need), and write a little program to add
fog myself using the data from the depth map?

Lots of hacks...

Ciao,
Elmar


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.