POV-ray scripts rendering just in black

568 Views Asked by At

Some POV-ray scripts just give me a blank black screen whilst others run fine. Below is an example (originally written by Steve Waterman) of a scene that just gives me a blank black screen

/*
mecon
*/


#declare a = 0.5;

union { 
polygon { 4,
 <1,  0, -a >,   < 1, -a,  0 >,   < 1,  0,  a >,   < 1,  a,  0 > }
polygon { 4,
 <-1, -a,  0>,   < -1,  0,  a>,   < -1,  a,  0>,   <-1,  0, -a > }
polygon { 4,
 < 0,  a, -1>,   < -a,  0, -1>,   <  0 ,-a ,-1>,   <  a , 0, -1> } 
polygon { 4,
 <-a , 0,  1>,   <  0,-a  ,1>,   < a,  0 , 1>,   <  0 , a , 1 > }
polygon { 4,
 < a , 1 , 0>,   <  0,  1,  a>,   < -a , 1 , 0 >,   < 0 , 1, -a > }
polygon { 4,
 <0, -1 , a >,   <-a,-1 , 0>,   <  0 ,-1, -a>,   < a ,-1 , 0 > }
polygon { 6,
 <-a,  0 , 1>,   <  0, -a , 1>,   <  0 ,-1 , a>,   <-a, -1 , 0>,   < -1, -a , 0>,   < -1 , 0 , a > }
polygon { 6,
 <-a , 0 , 1>,   < -1 , 0 , a>,   < -1 , a  ,0 >,   <-a , 1 , 0 >,   < 0 , 1 , a >,   < 0 , a , 1> } 
polygon { 6, 
 <0 , a , 1  >,   <0 , 1 , a >,   < a  ,1 , 0 >,   < 1 , a , 0 >,   < 1 , 0 , a >,   < a  ,0 , 1 > }
polygon { 6,                          
 <a , 0 , 1 >,   < 1 , 0 , a>,   <  1 ,-a , 0>,   <  a, -1  ,0 >,   < 0 ,-1 , a >,   <0 ,-a  ,1 > }
polygon { 6,
 <-a , 0 ,-1>,   <  0 ,-a ,-1>,   <  0 ,-1 ,-a >,   <-a, -1 , 0 >,   <-1, -a ,0 >,   <-1  ,0 ,-a > }
polygon { 6,
 <-a , 0 ,-1>,   < -1  ,0 ,-a>,   < -1 , a , 0>,   < -a , 1 , 0>,   <  0 , 1,-a>,   <  0  ,a,-1 > }
polygon { 6,
  <0 , a ,-1>,   <  0 , 1 ,-a >,   < a , 1 , 0>,   < 1 , a , 0>,   < 1 , 0, -a >,   < a , 0, -1 > }
polygon { 6,
  <a  ,0 ,-1 >,   < 1, 0 ,-a >,   < 1, -a , 0>,   <  a ,-1 , 0 >,   < 0, -1, -a >,   < 0 ,-a ,-1 > }

}  

Whilst the following code works perfectly...

/* Change this at will */
#declare ROOT = 10;

/* This varies the colour ramp, should be between 0 and 1 */
#declare CUTOFF = 0.5;

#declare RADIUS2 = 2 * ROOT;
#declare RADIUS = sqrt(RADIUS2);
#declare SRADIUS = 1/sqrt(2.0);

#declare vp = 0.7*<3*(RADIUS+0.5),(RADIUS+0.5),(RADIUS+0.5)>;
camera {
   location vp
   up y
   right -x*image_width/image_height
   angle 60
   sky <0,0,1>
   look_at <0,0,0>
}

global_settings {
  assumed_gamma 1.0
}

light_source {
   <3*RADIUS,RADIUS,2*RADIUS>
   color rgb <1,1,1>
}

#declare IR = int(RADIUS2+1);
#declare ix = -IR;
#while (ix <= IR) 
   #declare iy = -IR;
   #declare R = ix*ix + iy*iy;
   #while (iy <= IR)
      #declare iz = -IR;
      #while (iz <= IR)
         #if (mod(ix+iy+iz,2) = 0)
            #declare R = ix*ix + iy*iy + iz*iz;
            #if (R <= RADIUS2)
               #debug "o"
               sphere {
                  <ix,iy,iz>, SRADIUS
                  #declare RAMP = (R-CUTOFF*RADIUS2)/(RADIUS2-CUTOFF*RADIUS2);
                  #if (RAMP > 1)
                     #declare RAMP = 1;
                  #end
                  #if (RAMP < 0)
                     #declare RAMP = 0;
                  #end
                  texture {
                     pigment { color rgb <RAMP,0,1-RAMP> }
                     finish { specular 0.3 }
                  }
               }
            #end
         #end
         #declare iz = iz + 1;
      #end
      #declare iy = iy + 1;
   #end
   #declare ix = ix + 1;
#end

I am using POV-ray 3.7 on a x64 Win & machine.

I'm new to POV-ray any hidden settings I should know about?

ADDITIONAL NOTE based on comment below:

I added a camera & light source as follows..

#declare vp = 0.7*<3*(a+0.5),(a+0.5),(a+0.5)>; 
camera {
   location vp
   up y
   right -x*image_width/image_height
   angle 60
   sky <0,0,1>
   look_at <0,0,0>
}   

light_source {
   <3*a,a,2*a>
   color rgb <1,1,1>
}

global_settings {
  assumed_gamma 1.0
}

...but I still get a blank screen.

1

There are 1 best solutions below

0
On

There are two of problems here:

  1. The background is black
  2. The object doesnt have a texture or a pigment, it is black

Solution for Problem 1: Add a background like

background { color rgb <0.2, 0.2, 0.3> }

to your scene (.pov file). This will render some black object against some bluish-gray background.

Solution for Problem 2: Declare your union as

#declare obj=union { 
   ... // original source code
}

and use it with object directive and give it some texture

object {obj 

    texture {
        finish { ambient 0.1 diffuse 0.5 }
        pigment { color rgb <0.8, 0.1, 0.3>  }
    }

} 

And there you are, you see an object with reddish shades against a bluish-grey background.