背景を空にしよう


背景を空にするために最も簡単な方法は,インクルード・ファイルの「skies.inc」を使うことだと思います。skies.incには「S_Cloud1」から「S_Cloud5」まで,基本的な5種類の空(雲)が収められています。

それぞれを使ったサンプルは次のようになります。

S_Cloud1 S_Cloud2 S_Cloud3
S_Cloud4 S_Cloud5

skies.incを使うためにソースファイルの先頭の方に「#include "skies.inc"」と書いておきます。

skies.incよりも前に「#include "colors.inc"」を書いておいてください。そうしないとエラーになります。

#include "skies.inc"

背景の色を変えるときに,たとえば「background { Yellow }」と書いたのと同じ感じで,S_Cloud1からS_Cloud5までを使うには,ソースファイルのどこかに次のように書いてください。

sky_sphere {
  S_Cloud5
}

上のサンプル画像を作ったときのソースファイルの全体は次のようになっています。

#include "colors.inc"
#include "skies.inc"

camera {
  location  <0.0, 0.5, -5.0>
  look_at   <0.0, 2.0,  0.0>
  right     x*image_width/image_height
}

light_source {
  <100, 100, -100>
  color rgb 1.0
}

object {
  sphere { <0, 0, 0>, 0.5 }
  pigment { Red }
  translate <0, 0.5, 0>
}

object {
  plane { y, 0 }
  pigment { 
    checker
      color rgb 1,
      color rgb 0
  }
}

sky_sphere {
  S_Cloud5
}

(注)skies.inc内にはいろいろと定義されていますが,sky_sphere{}内で使えるのは,「S_」ではじまるものだけです。


戻る