在「」一节中,草率的用了一张棋盘格图案的平面当作大地。现在,我们将它做成草地:
plane { y, 0 texture { pigment { color rgb<0.35,0.65,0.0>*0.8 } normal { bumps 1.25 scale 0.015 } }}
草地,是通过让绿色的平面随机的产生一些小的凹凸而营造的一种假象:
也就是说,平面还是平面,只是平面上蒙上了一层草地的图案。草地的图案,是通过 bumps
语句随机扰动平面的法向而渲染出来的。可以尝试不同的 bumps
与 scale
的参数,理解它们对草地图案渲染结果的影响。
不过,现在的场景依然很不真实。天际不应该是那么蓝,地平线也不应该那么清晰。即使去了西藏,天际顶多也只是淡蓝色的。我们需要用雾气消除这种不真实:
fog { fog_type 2 distance 1000 color rgb <1,1,1>*0.75 fog_offset 50 fog_alt 10}
但是,此刻所设置的雾不会起作用,天际依然蔚蓝,地平线依然清晰。这是因为,用来作为天空和云层的两个球体,都是实心的。要想让雾显现,必须使用 hollow
将这两个球体变成中空的:
// 天空sphere { <0, 0, 0>, 5000 hollow // <-- 注意此处 texture { pigment {color rgb <0.1, 0.25, 0.75>} finish { ambient <1, 1, 1> diffuse 0 } }}// 云sphere { <0, 0, 0>, 4000 hollow // <-- 注意此处 texture{ pigment{ bozo turbulence 0.75 color_map { [0.0 color rgb <0.95, 0.95, 0.95>] [0.05 color rgb <1, 1, 1>] [0.15 color rgb <0.85, 0.85, 0.85>] [0.55 color rgbt <1, 1, 1, 1>] [1.0 color rgbt <1, 1, 1, 1>] } scale 0.25 * 4000 } finish {ambient 1 diffuse 0} }}
现在,天际有雾了。
fog_type
用于设定雾的类型,类型为 1
时是简单雾,这种雾会让整个画面都朦胧;类型为 2
时,是地面上的雾。在渲染野外场景时,地面雾最常用。
distance
用于设定雾气的远近。例如,将雾拉近一点:
fog{ fog_type 2 distance 10 color rgb <1,1,1>*0.75 fog_offset 50 fog_alt 10}
就可以达到草船借箭级别的雾效:
fog_offset
用于设定雾距离地面的高度(y 坐标值)。fog_alt
用于设定雾层浓度的衰减速率,值越大,衰减速率越小。
不过,上面的雾效与我们这个世界的自然现象不符。因为,这么大的雾天,物体不可能在地面上留下阴影。若要消除物体的阴影,需将光源设置为无影光源(类似医院里的无影灯):
light_source { <2000, 4500, -100> color White shadowless}
下面给出一份完整的 .pov 文件以供参考:
#version 3.7;#include "colors.inc"// 相机camera { location <0, 2, -3> look_at <0, 3, 8>}// 光源light_source { <2000, 4500, -100> color White}// 天空sphere { <0, 0, 0>, 5000 hollow texture { pigment {color rgb <0.1, 0.25, 0.75>} finish { ambient <1, 1, 1> diffuse 0 } }}// 云sphere { <0, 0, 0>, 4000 hollow texture{ pigment{ bozo turbulence 0.75 color_map { [0.0 color rgb <0.95, 0.95, 0.95>] [0.05 color rgb <1, 1, 1>] [0.15 color rgb <0.85, 0.85, 0.85>] [0.55 color rgbt <1, 1, 1, 1>] [1.0 color rgbt <1, 1, 1, 1>] } scale 0.25 * 4000 } finish {ambient 1 diffuse 0} }}//雾fog { fog_type 2 distance 1000 color rgb <1,1,1>*0.75 fog_offset 50 fog_alt 10}// 大地plane { y, 0 texture { pigment { color rgb<0.35,0.65,0.0>*0.8 } normal { bumps 1.25 scale 0.015 } }}// 大石块#include "stones.inc"box { <0, 0, 0>, <1, 1, 3> texture { T_Stone25 } scale 3 rotate 45 * y translate 5 * z}