POV-ray脚本仅以黑色呈现



一些POV-ray脚本只是给我一个空白的黑屏,而其他运行良好。下面是一个场景的例子(最初由Steve Waterman编写),它只是给了我一个空白的黑屏

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

虽然下面的代码工作得很好…

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

我在x64 Win上使用POV-ray 3.7;机器。

我是新的POV-ray任何隐藏的设置,我应该知道?

根据下面的注释补充说明:

我添加了一个相机&光源如下…

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

这里有两个问题:

  1. 背景为黑色
  2. 对象没有纹理或颜料,它是黑色的

问题1的解决方案:添加类似

的背景
background { color rgb <0.2, 0.2, 0.3> }

到你的场景。观点文件)。这将渲染一些黑色的对象在一些蓝灰色的背景。

问题2的解决方案:将联合声明为
#declare obj=union { 
   ... // original source code
}

object指令一起使用,给它一些纹理

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

在这里,你看到一个物体在蓝灰色的背景下带有红色的阴影。

最新更新