POV-Ray : Newsgroups : povray.programming : Difference bug in POVray? Server Time
28 Jul 2024 12:29:53 EDT (-0400)
  Difference bug in POVray? (Message 1 to 1 of 1)  
From: David C  Jones
Subject: Difference bug in POVray?
Date: 16 Apr 2001 23:18:28
Message: <3adbb604$1@news.povray.org>
So, I spent all day today trying to build a cartoon head for a personal
project and I got to where I had to do the mouth.  One idea was to use a
difference command and whack out cavity for the mouth and I ended up with a
rather odd render.  Right in the center of the render is black dot that
seemingly comes from nowhere.  Two odd things of note:

1) If I union the sphere instead of difference it, the black dot goes away
2) If I change the camera location or rotate the object, the black dot
appears on the same location in the render (as opposed to moving in
conjuction with the camera or the rotation).

Both of these lead me to believe that the artifact is a rendering error and
not a free object.  To see the pictures, go to
http://www.nightswimming.com/davy/pov.  The code is listed below and the
relevant difference/union command is the very last one at the end of the
file, but I wouldn't actually render it unless you have a lot of patience.
Rendering the union takes 11 seconds but rendering the difference takes 15
minutes (both on a PIII-700 machine).  I've decided to take a different
approach on the mouth, but I was wondering if anybody knew about this.

Davy

#macro SphToRec (rho, theta, phi) rho*<sin(phi)*cos(theta),
sin(phi)*sin(theta), cos(phi)> #end
#macro PlrToRec (rho, theta, zed) <rho*cos(theta),zed,rho*sin(theta)> #end

#include "colors.inc"

background{ SkyBlue }

#declare Cam_Rot = -90;

camera {
  location <5 10, -13>
  look_at <0, 10, 10>
}

light_source { <1000, 1000, -1000> 0.4*<1,1,1> }
light_source { <-1000, 1000, -1000> 0.4*<1,1,1> }
light_source { <0, .1, -1000> 0.9*<1,1,1> }



plane {
  y, 0
  texture {
    pigment {
      checker
        color Blue
        color Green*1.03
  } scale <5,1,5>
 }
}

#declare HeadNoMouth = object {
union { // head without mouth

  blob


    threshold .1

    sphere { // head
      <0, 10, 0> 5 .9
      texture { pigment { Flesh } }
    }

    sphere { // mouth-jaw
      <0, 0, 0> 1 .9
      scale <6.25,3.5,5>
      translate <0,8.1,0>
      texture { pigment { Flesh } }
    }

    sphere { // right eye
      <0,0,0> 1 .9
      scale <.85,1.25,.33>
      rotate <7.5,0,0>
      translate <.45,11,-4>
      texture { pigment { White*1.25 }}
    }

    sphere { // left eye
      <0,0,0> 1 .9
      scale <.85,1.25,.33>
      rotate <7.5,0,0>
      translate <-.45,11,-4>
      texture { pigment { White*1.25 }}
    }

    sphere { // right pupil
      <0,0,0> .25 .9
      translate <.45,10.25,-4.25>
      texture { pigment { Black }}
    }

    sphere { // left pupil
      <0,0,0> .25 .9
      translate <-.45,10.25,-4.25>
      texture { pigment { Black*1.5 }}
    }

    sphere { // nose
      <0,9,-4> .5 .9
      scale <1,1,1.05>
      texture { pigment { Flesh } }
    }

  } // head pieces

  sphere { // yellow hair
    <0,10.,.99> 4.8
    texture {
      pigment { Yellow transmit .65}
    }
  } // yellow hair

  #declare hairphi=0;
  #while (hairphi<pi/1.25)
    #declare hairtheta=2*pi;
    #while (hairtheta>0)
        cone {
          SphToRec(4  ,hairtheta,hairphi-
(pi/100)*sin(5*abs(hairphi-pi)*abs(hairtheta-pi))) , .33
          SphToRec(4.87,hairtheta,hairphi-
(pi/100)*sin(5*abs(hairphi-pi)*abs(hairtheta-pi))) , .05
          texture { pigment { Yellow/10 }}
          rotate <0,0,-90>
          translate <0,10,1>
        }
      #declare hairtheta=hairtheta-pi/25 +
(pi/75)*cos(abs(hairphi-pi)*abs(hairtheta-pi));
    #end
    #declare hairphi=hairphi+pi/45 ;
  #end

  object { // left ear
    union

      difference {
        sphere { <0,0,0> 1 }
        sphere { <0,0,0> .6 }
        box {
          <2,2,0>
          <-2,-2,-2>}
      } // difference
    torus { 0.8 0.2 rotate <90,0,0>}
    } // union
    texture { pigment { Flesh } }

    scale <.9,1.25,.75>
    translate <5.,10,-1>

  } // left ear

  object { // right ear
    union

      difference {
        sphere { <0,0,0> 1 }
        sphere { <0,0,0> .6 }
        box {
          <2,2,0>
          <-2,-2,-2>}
      } // difference
    torus { 0.8 0.2 rotate <90,0,0>}
    } // union
    texture { pigment { Flesh } }

    scale <.9,1.25,.75>
    translate <-5,10,-1>

  } // object right ear

} // head without mouth

} //  HeadNoMouth

// If this union is changed to a difference, the artifact appears.  The fact
that HeadNoMouth
// is made a separate object is irrelevant.  I built the same object without
the declare and the artifact still appears.

union

  object { HeadNoMouth }
  sphere {
    <0,0,0> 1
    scale <3/4,1/3,1/2>
    rotate <0,-25,0>
    translate <2,8,-3.5>
    texture { pigment { Red } }
  }
   // rotate <0,25,0>
} // difference


Post a reply to this message

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