コード例 #1
0
ファイル: Material.cs プロジェクト: hksonngan/sharptracing
 protected Material()
 {
     this.absorptivity = 0.3f;
     this.glossy = 0.1f;
     this.kDiff = 0.5f;
     this.kSpec = 0.5f;
     this.kTrans = 0.0f;
     this.kAmb = 0.1f;
     this.diffuseColor = RGBColor.White;
     this.specularColor = RGBColor.White;
     this.refractIndex = 1.51f;
     this.shiness = 64;
     this.isTexturized = false;
     this.texture = new Texture();
 }
コード例 #2
0
ファイル: PhongShader.cs プロジェクト: hksonngan/sharptracing
        public static Vector3D BumpNormal(Texture bumpTexture, Intersection intersection)
        {
            const float scale = 1;
            UVCoordinate uv = intersection.CurrentTextureCoordinate;
            float dx = 1.0f / (bumpTexture.Width - 1);
            float dy = 1.0f / (bumpTexture.Height - 1);
            float b0 = bumpTexture.GetPixel(uv).Luminance;
            float bx = bumpTexture.GetPixel(uv.U + dx, uv.V).Luminance;
            float by = bumpTexture.GetPixel(uv.U, uv.V + dy).Luminance;

            return (intersection.Normal + new Vector3D(scale * (bx - b0) / dx, scale * (by - b0) / dy, 1)).Normalized;

            //RGBColor color = bumpTexture.GetPixel(uv);
            //Vector3D tangent1, tangent2;
            //Vector3D.Orthonormalize(intersection.Normal, out tangent1, out tangent2);
        }
コード例 #3
0
ファイル: Material.cs プロジェクト: hksonngan/sharptracing
 protected Material(float kdiff, float kspec, float kamb, float refractIndex, float ktrans, float glossy,
     float shiness, Texture texture)
 {
     this.KDiff = kdiff;
     this.KSpec = kspec;
     this.KTrans = ktrans;
     this.KAmb = kamb;
     this.diffuseColor = RGBColor.White;
     this.specularColor = RGBColor.White;
     this.RefractIndex = refractIndex;
     this.Glossy = glossy;
     this.Absorptivity = 0.3f;
     this.Shiness = shiness;
     if (!texture.IsLoaded) {
         this.isTexturized = false;
     } else {
         this.texture = texture;
         this.isTexturized = true;
     }
 }
コード例 #4
0
ファイル: CubeMap.cs プロジェクト: hksonngan/sharptracing
 private void SetUpTextures()
 {
     this.xMinTexture = new Texture(Path.Combine(this.basePath, this.fileNamePattern.Replace("{#}", "_NX")));
     this.xMaxTexture = new Texture(Path.Combine(this.basePath, this.fileNamePattern.Replace("{#}", "_PX")));
     this.yMinTexture = new Texture(Path.Combine(this.basePath, this.fileNamePattern.Replace("{#}", "_NY")));
     this.yMaxTexture = new Texture(Path.Combine(this.basePath, this.fileNamePattern.Replace("{#}", "_PY")));
     this.zMinTexture = new Texture(Path.Combine(this.basePath, this.fileNamePattern.Replace("{#}", "_NZ")));
     this.zMaxTexture = new Texture(Path.Combine(this.basePath, this.fileNamePattern.Replace("{#}", "_PZ")));
     this.isLoaded = true;
 }
コード例 #5
0
 public PhongMaterial(float kdiff, float kspec, float kamb, float refractIndex, float ktrans, float glossy,
     float shiness, Texture texture)
     : base(kdiff, kspec, kamb, refractIndex, ktrans, glossy, shiness, texture)
 {
 }
コード例 #6
0
 public CookTorranceMaterial(float kdiff, float kspec, float kamb, float refractIndex, float ktrans, float glossy,
     float shiness, float roughness, Texture texture)
     : base(kdiff, kspec, kamb, refractIndex, ktrans, glossy, shiness, texture)
 {
     this.roughness = roughness;
 }