POV-Ray : Newsgroups : povray.general : Problem with differences/unions, maybe too many; or a missing "{" or "}"? Server Time
5 Nov 2024 15:54:14 EST (-0500)
  Problem with differences/unions, maybe too many; or a missing "{" or "}"? (Message 1 to 4 of 4)  
From: D  Hansen
Subject: Problem with differences/unions, maybe too many; or a missing "{" or "}"?
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

From: Tim Attwood
Subject: Re: Problem with differences/unions, maybe too many; or a missing "{" or "}"?
Date: 24 Dec 2006 05:52:18
Message: <458e5be2$1@news.povray.org>
You have a coincident surface with the liquid
surface and the "fog" bottom...

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.149,1.2>, <1.2,-1.2,1.2>} // <-- changed
   pigment{ color rgbt 0.9 }
   interior_texture { pigment { color rgbt <0,0.1,0,0.9> } }
}


Post a reply to this message

From: Chris B
Subject: Re: Problem with differences/unions, maybe too many; or a missing "{" or "}"?
Date: 24 Dec 2006 06:04:46
Message: <458e5ece$1@news.povray.org>
"D. Hansen" <PoV### [at] Stefaniede> wrote in message 
news:web.458e4323bcd79e8bea53f7190@news.povray.org...
> Hi!
>
> 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 :)
>

Hi D.

I think your problem is one of coincident surfaces. In this case the top 
surface of the liquid and the bottom surface of your 'fog over the liquid' 
are in exactly the same place. The transparency in the 'fog over the liquid' 
makes the surface visible, but the surface has an indeterminate texture so 
POV-Ray chooses whether to give it the surface texture of one or other of 
the two surface specifications - This issue is actually explained a lot 
better in the FAQ. Other, seemingly unrelated objects in the scene, seem to 
influence the decision that POV-Ray makes for each point where it finds a 
coincident surface in the scene. I think this is why the changes to the pot 
feet, the plane and the table influenced the render.

To get rid of this problem just move one or other surface. Below I've 
adjusted the 'y' value for the bottom surface of the 'fog over the liquid' 
to 0.149 instead of 0.15 and this seems to cure the problem.

    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.149,1.2>, <1.2,-1.2,1.2>}     // Avoid coincident 
surfaces
      pigment{ color rgbt 0.9 }
      interior_texture { pigment { color rgbt <0,0.1,0,0.9> } }     // try 
granite
    }

You may wish to check your scene for other coincident surfaces.

For the future I'd recommend reducing your code snippets down before 
posting.
Your complex texures made your code look more complicated than it is and 
didn't contribute to the problem.
Seeing a long piece of code in a posting puts a lot of people off looking at 
the problem.
I reduced your code down to the following before spotting what the problem 
might be.

#version 3.6;

#include "colors.inc"

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

camera {
  location  <0.0, 0.7, -4.0>*1.2*2 *0.35   // Side View
//  location  <1,3,0>
  look_at   <0.0, 0.0,  0.0>
}

light_source {<1, 30, -1> color rgb 1}

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

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}
//  }


  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>}
}

difference {            // liquid
  sphere {  0.0, 0.98 }
  box {-<1.2,0.15,1.2>, <1.2,1.2,1.2>}
  pigment {color rgb <1,0,0>}
}

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.149,1.2>, <1.2,-1.2,1.2>}
  pigment{ color rgbt 0.9 }
}

box { <-5, -1.05, -1.2> , <5, -1, 2>   // table
  pigment { color rgb <1,1,0>}
}

plane {-y, 4
  pigment {color rgb <1,0,1>}
}



regards,
Chris B.


Post a reply to this message

From: D  Hansen
Subject: Re: Problem with differences/unions, maybe too many; or a missing "{" or "}=
Date: 24 Dec 2006 07:15:00
Message: <web.458e6e5b6987e0fd938f4fbd0@news.povray.org>
Thank you all!

Having not used POV-Ray for some monthes I just fall into the first pit :P

A Happy Christmas and a Good New Year to all of you and the whole POV-Ray
team and all contributors.

Greetings
Dieter Hansen


Post a reply to this message

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