POV-Ray : Newsgroups : povray.general : Problem with differences/unions, maybe too many; or a missing "{" or "}"? : Problem with differences/unions, maybe too many; or a missing "{" or "}"? Server Time
31 Jul 2024 14:31:36 EDT (-0400)
  Problem with differences/unions, maybe too many; or a missing "{" or "}"?  
From: D  Hansen
Date: 24 Dec 2006 04:10:00
Message: <web.458e4323bcd79e8bea53f7190@news.povray.org>
Hi!
To see the effect, a very small resulotion is enough.
I hope I just made some mistake in the syntax :)

The scene is a pot with liquid on a table (box), a plane y*-4, a skysphere,
light, camera, max intersection set to 255, max trace level 50.
Examples of problem:
- Depending on changing the feet of the pot, part of the liquid in the pot
vanishes. (Outcomment the union starting at "DOESN'T WORK", and delete the
union before.)
- When I delete the plane the liquid vanishes too :) (Delete the plane in
the original version, at the end of the scene.)
- Sometimes, when deleting one difference, everything looks fine again (Try
wildly :)

So here is the code:


#version 3.6;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  max_trace_level 50
  max_intersections 255
}

// ----------------------------------------

camera {
//  location  <0.0, 0.7, -4.0>*1.2*2 *0.35   // to watch from the side,  so
you could see the feet
  location  <0,4,0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}
sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [10000000 rgb <0.0,0.1,0.8>]
    }
  }
}
light_source {
  <0, 0, 0>
  color rgb <1, 1, 1>
  translate <-30, 30, -30>
}

// ----------------------------------------


    union{
        difference {            // pot
          sphere {  0.0, 1 }
          box {-<1.2,0,1.2>, <1.2,1.2,1.2>}
          sphere {  0.0, 0.98 }
        }
        difference {            // pot-feet
          union {cylinder { <0,-2,0>, <0,0,0>, 0.04 rotate z*35 rotate y*0}
                 cylinder { <0,-2,0>, <0,0,0>, 0.04 rotate z*35 rotate
y*120}
                 cylinder { <0,-2,0>, <0,0,0>, 0.04 rotate z*35 rotate
y*-120}
          }
 /* DOESN'T WORK        union{       cylinder { <0,-2,0>, <0,0,0>, 0.04
rotate z*35 rotate y*180}
                 cylinder { <0,-2,0>, <0,0,0>, 0.04 rotate z*35 rotate y*60}
                 cylinder { <0,-2,0>, <0,0,0>, 0.04 rotate z*35 rotate
y*-60}
          }     */
          sphere {  0.0, 1 }
          box {-<3,3,3>, <3,-1,3>}
        }
        texture {
            pigment {
              color rgb <0.8,0.8,1.0>
            }
            finish{
              diffuse 0.3
              ambient 0.0
              specular 0.6
              reflection {
                0.8
                metallic
              }
              conserve_energy
            }
        }
    }
    difference {            // liquid
      sphere {  0.0, 0.98 }
      box {-<1.2,0.15,1.2>, <1.2,1.2,1.2>}
      texture {
        pigment {
          color Brown*0.1+Red*0.8
        }
        normal { waves .275 scale .125 translate <0.2,0,0.2> }

        finish{
          diffuse 0.3
          ambient 0.0
          specular 0.6
          reflection {
            0.4
            metallic
          }
          conserve_energy
        }
      }
    }

    difference {            // some fog over the liquid
      sphere {  0.0, 0.98 }
      box {-<1.2,0.05,1.2>, <1.2,1.2,1.2>}
      box {-<1.2,0.15,1.2>, <1.2,-1.2,1.2>}
      pigment{ color rgbt 0.9 }
      interior_texture { pigment { color rgbt <0,0.1,0,0.9> } }     // try
granite
    }



box { <-5, -1.05, -1.2> , <5, -1, 2>   // table
  texture {
    pigment {
      color Brown*0.1
    }
    normal { waves .075 scale .25 }

    finish{
      diffuse 0.3
      ambient 0.0
      specular 0.6
      reflection {
        0.4
        metallic
      }
      conserve_energy
    }
  }

}

 plane {
  y,
  -4
  hollow on

  texture {
    pigment {
      color Brown*0.2
    }
    finish{
      diffuse 0.3
      ambient 0.0
      specular 0.6
      reflection {
        0.8
        metallic
      }
      conserve_energy
    }
  }
}


Post a reply to this message

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