色・材質の定義

3. specularColor(鏡面反射)


specularColor は、鏡面反射を表す単語です。
鏡面反射は、金属のような光の反射です。
specularColor の後に { } をつけて、
その中に色(RGB)と書いて、鏡面反射の色を表します。


以下、赤いハイライトのある大きな球と、
青いハイライトのある小さな球の記述例です。
specularColor の値の違いに着目してください。

#VRML V2.0 utf8

Transform {
  translation 3.0 0.0 0.0 
  children [
    Shape {
      appearance Appearance {
        material Material {
          specularColor 1.0 0.0 0.0
          diffuseColor 0.5 0.5 0.5
        }
      }
      geometry Sphere {
        radius 2.0
      }
    }
  ]
}

Transform {
  translation -3.0 0.0 0.0 
  children [
    Shape {
     appearance Appearance {
      material Material {
       specularColor 0.0 0.0 1.0
       diffuseColor 0.5 0.5 0.5
      }
     }
     geometry Sphere {
      radius 1.0
     }
    }
  ]
}

上の VRML を実際に表示してみましょう。

次は放射を表示してみましょう。


目次に戻る