梁某人

发展才是硬道理

导航

SunFlow场景文件的Shader代码块

  • 颜色空间:
    有六种,常用的是  sRGB nonlinear
  • 阴影:所有阴影都可以使用 texture
    1. Constant Shader
      定量阴影,物体本身不会产生阴影效果,只有投下的阴影效果,如:
      shader {
      name sfcon.shader  /* 阴影的名字 */
      type constant /* 定量阴影类型 */
      color { "sRGB nonlinear" 0.800 0.800 0.800 } /* 颜色空间,通过把数值加大到1.0以上,可以打开"Path Tracing"效果 */
      }
    2. Diffuse Shader
      漫反射阴影,物体本身会产生阴影,但无高光,如:
      shader {
      name sfdif.shader
      type diffuse
      diff { "sRGB nonlinear" 0.800 0.800 0.800 }
      }
    3. Textured Diffuse Shader
      使用了Texture的漫反射阴影类型,如:
      shader {
      name sfdif.shader
      type diffuse
      texture "C:"mypath"image.png"
      }
    4. Phong Shader
      最为逼真的阴影类型,如:
      shader {
      name sfpho.shader
      type phong
      diff { "sRGB nonlinear" 0.800 0.800 0.800 } /* 漫反射部分的色值 */
      spec { "sRGB nonlinear" 1.0 1.0 1.0 } 50 /* 高光的色值及强度 */
      samples 4
      }
    5. Textured Phong Shader
      使用了纹理的Phong Shader,如:
      shader {
      name sfpho.shader
      type phong
      texture "C:"mypath"image.png"
      spec { "sRGB nonlinear" 1.0 1.0 1.0 } 50
      samples 4
      }
    6. Shiny Shader
      发光体阴影,如日光灯之类的物体:
      shader {
      name sfshi.shader
      type shiny
      diff { "sRGB nonlinear" 0.800 0.800 0.800 }
      refl 0.5 /* 不知道这个是什么 */
      }
    7. Textured Shiny Shader
      使用了纹理的发光体阴影,如:
      shader {
      name sfshi.shader
      type shiny
      texture "C:"mypath"image.png"
      refl 0.5
      }
    8. Glass Shader
      玻璃类型阴影,如:
      shader {
      name sfgla.shader
      type glass
      eta 1.0 /* 折射率 */
      color { "sRGB nonlinear" 0.800 0.800 0.800 } /* 色值 */
      absorbtion.distance 5.0 /* 吸收率,数值越小吸收越多 */
      absorbtion.color { "sRGB nonlinear" 1.0 1.0 1.0 }
      }
      跟踪深度 (Trace Dept),似乎与透明度有关,如下的场景全局设置:
      trace-depths {
      diff 1
      refl 4
      refr 4
      }
      调整三个值,玻璃的透明度发生变化.
      聚焦线(Caustics),要做场景全局设置如下:
      photons {
      caustics 1000000 kd 100 0.5
      }
    9. Mirror Shader
      镜面阴影,如:
      shader {
      name sfmir.shader
      type mirror
      refl { "sRGB nonlinear" 0.800 0.800 0.800 }
      }

  • 其他阴影,略.

posted on 2009-02-12 04:02  涛仔28  阅读(391)  评论(0编辑  收藏  举报