示例#1
0
 public PlasticMaterial(ITexture2 <Spectrum> kd,
                        ITexture2 <Spectrum> ks,
                        ITexture2 <float> roughness,
                        ITexture2 <float> bumpMap,
                        bool remapRoughness)
 {
     Kd             = kd;
     Ks             = ks;
     Roughness      = roughness;
     BumpMap        = bumpMap;
     RemapRoughness = remapRoughness;
 }
示例#2
0
 public MetalMaterial(ITexture2 <Spectrum> eta,
                      ITexture2 <Spectrum> k,
                      ITexture2 <float> roughness,
                      ITexture2 <float> uRoughness,
                      ITexture2 <float> vRoughness,
                      ITexture2 <float> bumpMap,
                      bool remapRoughness)
 {
     _eta            = eta;
     _k              = k;
     _roughness      = roughness;
     _uRoughness     = uRoughness;
     _vRoughness     = vRoughness;
     _bumpMap        = bumpMap;
     _remapRoughness = remapRoughness;
 }
示例#3
0
        public static void Bump(this ITexture2 <float> d, SurfaceInteraction si)
        {
            var displace = d.Evaluate(si);

            var du = 0.5f * Abs(si.Dudx) + Abs(si.Dudy);

            // Create small du if no differential available.
            if (du == 0f)
            {
                du = 0.0005f;
            }

            si.P  += du * si.ShadingGeometry.Dpdu;
            si.UV += new Vector2(du, 0f);
            si.N   = ((Normal)Vector.Cross(si.ShadingGeometry.Dpdu, si.ShadingGeometry.Dpdv) + du * si.Dndu).Normalize();
            var uDisplace = d.Evaluate(si);

            var dv = 0.5f * Abs(si.Dvdx) + Abs(si.Dvdy);

            // Create small dv if no differential available.
            if (dv == 0f)
            {
                dv = 0.0005f;
            }

            si.P  += dv * si.ShadingGeometry.Dpdv;
            si.UV += new Vector2(0f, dv);
            si.N   = ((Normal)Vector.Cross(si.ShadingGeometry.Dpdu, si.ShadingGeometry.Dpdv) + dv * si.Dndv).Normalize();
            var vDisplace = d.Evaluate(si);

            var dpdu = si.ShadingGeometry.Dpdu +
                       (uDisplace - displace) / du * (Vector)si.ShadingGeometry.N +
                       displace * (Vector)si.ShadingGeometry.Dndu;

            var dpdv = si.ShadingGeometry.Dpdv +
                       (vDisplace - displace) / dv * (Vector)si.ShadingGeometry.N +
                       displace * (Vector)si.ShadingGeometry.Dndv;

            si.SetShadingGeometry(dpdu, dpdv, si.ShadingGeometry.Dndu, si.ShadingGeometry.Dndv, false);
        }
示例#4
0
 public DisneyMaterial(
     ITexture2 <Spectrum> color,
     ITexture2 <float> metallic,
     ITexture2 <float> eta,
     ITexture2 <float> roughness,
     ITexture2 <float> specularTint,
     ITexture2 <float> anisotropic,
     ITexture2 <float> sheen,
     ITexture2 <float> sheenTint,
     ITexture2 <float> clearcoat,
     ITexture2 <float> clearcoatGloss,
     ITexture2 <float> specTrans,
     ITexture2 <Spectrum> scatterDistance,
     bool isThin,
     ITexture2 <float> flatness,
     ITexture2 <float> diffTrans,
     ITexture2 <float> bumpMap
     )
 {
     Color           = color;
     Metallic        = metallic;
     Eta             = eta;
     Roughness       = roughness;
     SpecularTint    = specularTint;
     Anisotropic     = anisotropic;
     Sheen           = sheen;
     SheenTint       = sheenTint;
     Clearcoat       = clearcoat;
     ClearcoatGloss  = clearcoatGloss;
     SpecTrans       = specTrans;
     ScatterDistance = scatterDistance;
     IsThin          = isThin;
     Flatness        = flatness;
     DiffTrans       = diffTrans;
     BumpMap         = bumpMap;
 }
示例#5
0
 public MatteMaterial(ITexture2 <Spectrum> kd, ITexture2 <float> sigma, ITexture2 <float> bumpMap)
 {
     Kd      = kd;
     Sigma   = sigma;
     BumpMap = bumpMap;
 }
示例#6
0
 public MixMaterial(IMaterial m1, IMaterial m2, ITexture2 <Spectrum> scale)
 {
     M1    = m1;
     M2    = m2;
     Scale = scale;
 }
示例#7
0
 public MirrorMaterial(ITexture2 <Spectrum> r, ITexture2 <float> bumpMap)
 {
     _kr      = r;
     _bumpMap = bumpMap;
 }