POV-Ray : Newsgroups : povray.newusers : Using Fog for depthcue - broken when behind transparent objects : Re: Using Fog for depthcue - broken when behind transparent objects Server Time
19 May 2024 19:55:57 EDT (-0400)
  Re: Using Fog for depthcue - broken when behind transparent objects  
From: Alain
Date: 25 Feb 2014 20:00:42
Message: <530d3cba$1@news.povray.org>

> Hi,
>
>    I am using the Fog feature to add depthcuing to a scene in povray 3.6 and the
> new 3.7. For this puropse I rotate the ground fog 90 degrees so that it is
> getting denser in the back and it works quite well.
>
> However, I noticed that when I have a transparent object close to the observer
> looking at some depthcued/foggy objects behind it, the fog is essentially
> removed from it. This looks odd and breaks the depthueing. This refers to the
> linux (CentOS 6.5) version of povray - did not try windows.
>
> The following shows a set of red cubes with depthcuing. The right side has a
> transparent triangle in front and the cubes in the back behind the triangle
> appear to have the fog removed.
>
> This is either a bug or an incorrect use of some povray feature by me. If there
> is an alternative to do depthcuing please let me know.
>
> //Start
> global_settings {
>    ambient_light rgb  <0.40000, 0.40000, 0.40000>
>    assumed_gamma      1.800

If you use version 3.7, you should use 1, 2.2 OR srgb for your 
assumed_gamma. Other values will be altered to 1 or 2.2.

>    adc_bailout        0.00390
>    max_trace_level    5
> }
>
> #declare camera_direction = < 0.0, 0.0, -1.0 >;
> #declare camera_location  = < 0.0, 0.3, 3.0 >;
> #declare camera_angle     = 10;
> #declare camera_look_at   = < 0.0, 0.0, -1.0 >;
>
> camera {
>    location  camera_location
>    right     x * 1.00000
>    direction camera_direction
>    angle     camera_angle
>    look_at   camera_look_at
> }
>
>
> background { color rgb < 1.0000, 1.0000, 1.0000 > }
>
> light_source {
>     <0.0, 0, 100>
>     color rgb 1
> }
> light_source {
>     <0.0, 500, 0.1>
>     color rgb 1
> }
>
> #declare Usefog = 1;
> #ifdef (Usefog)
> #declare DEPTH_RGB      = <1.000, 1.000, 1.000>;
>    fog {
>      distance   0.2424 * 8
>      fog_alt    0.01
>      fog_offset -1.1437 + 1
>      fog_type   2
>      rotate     x*90
>      color rgb  DEPTH_RGB
>    }
> #end
>
>
> #declare b = box {
>    <-0.1,-0.1,-0.1>, <0.1,0.1,0.1>
> }
>
> #declare idz = 0;
>
> #while (idz < 9 )
>
>    object {
>      b
>      texture {
>        pigment { color rgb <1,0,0> }
>        finish { ambient 0.8 diffuse 0.3 specular 0.1 roughness 0.05 }
>      }
>      translate <-0.12,0.0, -idz*0.5>
>    }
>    object {
>      b
>      texture {
>        pigment { color rgb <1,0,0> }
>        finish { ambient 0.8 diffuse 0.3 }
>      }
>      translate <0.12, 0.0, -idz*0.5>
>    }
>
>    #declare idz = idz+1;
> #end
>
>
> #declare TrigTrans = 0.8;
>
> triangle {
>
>    <-1,-0.5,0>, <0.0,0.5,0.0>, <1,-0.5,0>
>    translate <1.4, 0.8,0>
>    scale 0.11
>    rotate z*45
>    texture { pigment { color rgbt <0.8, 0.8, 0.8, TrigTrans> }
>              finish {ambient 0.4 diffuse 0.3 specular 0.2 roughness 0.01} }
> }
>
>
>
>
>

The problem is that you use a single surfaced object: A triangle.
When the ray encounter it, what is behind is concidered as been "inside" 
a non-hollow object.

When the ray encounter a surface, the fog stops been evaluated. When the 
ray encounter a second surface, the fog evaluation resumes.
Also, if the ray reatch the background, the fog is NOT evaluated.

The workaround can be:
- Use an union of two parallel triangles.
- Use a thin triangle shaped prism object.
For either, you need to increase the transparance to compensate for the 
two surfaces.


Alain


Post a reply to this message

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