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
13 May 2024 19:11:45 EDT (-0400)
  Re: Using Fog for depthcue - broken when behind transparent objects  
From: Kenneth
Date: 24 Feb 2014 16:20:00
Message: <web.530bb66d76632899c2d977c20@news.povray.org>
Confirmed in Windows XP (using POV-Ray v3.62, anyway.)

I don't think you're doing anything wrong with the scene; there's definitely
some kind of problem with fog and transparency. (It also happens with 'regular'
type 1 fog, not just ground fog.)

I rearranged your code to make it more understandable (to me)-- essentially just
changing things so that the camera looks into +z rather than in -z.  I posted
this below, with a few additions to help make the problem stand out more clearly
and to test it. I also added an animation feature, to see how/if the odd effect
changes as the triangle recedes into the distance.

By the way, since you're camera is using   right x*1.0000  , the render should
be a square one, not a 4:3 ratio. I'll assume that you already knew that ;-)

I've noticed this fog/transparency problem before, in several different scene
set-ups, but could never make sense of it. It also happens with a zero-thickness
box, not just a triangle shape.

I tried adding the hollow keyword to your triangle just to see what would
happen, as well as scale <1,1,-1> in case the triangle had a 'switched'
inside/outside. Neither change helped. (In fact, adding hollow-- which would
make the space 'behind' the triangle hollow-- had the strange effect of
MULTIPLYING the fog there.) Scale <1,1,-1> had no effect at all, on anything.

//-----  re-worked code ----
global_settings {
  ambient_light rgb  <0.40000, 0.40000, 0.40000>
  assumed_gamma      1.800
  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 > }

plane{y,-.2 no_shadow pigment{bozo scale .3}} // my addition

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 < 20 )
  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 = 1.0; // .8

triangle { <-1,-0.5,0>, <0.0,0.8,0.0>, <1,-0.5,0>
 // OR...
  //box{ <-.5,-.5,0>, <.5,.5,0>

  //hollow // seems to MULTIPLY the fog effect
  no_shadow

 // I rearranged these transformations to be in an easier-to-understand order
  scale 0.25
// scale <1,1,-1> // does not seem to affect the problem in any way
 rotate z*30


  translate <0,.11,1.39>
  // OR...
  //translate <0,.11,-2 + 8*clock> // for animation-- run 50 frames,
  // with clock 0 to 1.0

  texture {
       pigment { color rgbt <0.3, 0.8, 0.3, TrigTrans> }
            finish {ambient 0.0 diffuse 0.3 specular 0.2 roughness 0.01} }
}


Post a reply to this message

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