00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "lux.h"
00025 #include "material.h"
00026
00027 namespace lux
00028 {
00029
00030
00031
00032 class CarPaint : public Material {
00033 public:
00034
00035 CarPaint(boost::shared_ptr<Texture<SWCSpectrum> > kd,
00036 boost::shared_ptr<Texture<SWCSpectrum> > ka,
00037 boost::shared_ptr<Texture<float> > d,
00038 boost::shared_ptr<Texture<SWCSpectrum> > ks1, boost::shared_ptr<Texture<SWCSpectrum> > ks2, boost::shared_ptr<Texture<SWCSpectrum> > ks3,
00039 boost::shared_ptr<Texture<float> > r1, boost::shared_ptr<Texture<float> > r2, boost::shared_ptr<Texture<float> > r3,
00040 boost::shared_ptr<Texture<float> > m1, boost::shared_ptr<Texture<float> > m2, boost::shared_ptr<Texture<float> > m3,
00041 boost::shared_ptr<Texture<float> > bump, const CompositingParams &cp);
00042 virtual ~CarPaint() { }
00043
00044 virtual BSDF *GetBSDF(const TsPack *tspack, const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading) const;
00045
00046 static Material * CreateMaterial(const Transform &xform, const TextureParams &mp);
00047 private:
00048
00049 boost::shared_ptr<Texture<SWCSpectrum> > Kd, Ka, Ks1, Ks2, Ks3;
00050 boost::shared_ptr<Texture<float> > depth, R1, R2, R3, M1, M2, M3;
00051 boost::shared_ptr<Texture<float> > bumpMap;
00052 };
00053
00054 struct CarPaintData {
00055 string name;
00056 float kd[COLOR_SAMPLES];
00057 float ks1[COLOR_SAMPLES];
00058 float ks2[COLOR_SAMPLES];
00059 float ks3[COLOR_SAMPLES];
00060 float r1, r2, r3;
00061 float m1, m2, m3;
00062 };
00063
00064 static CarPaintData carpaintdata[] = {
00065 {"ford f8",
00066 {0.0012f, 0.0015f, 0.0018f},
00067 {0.0049f, 0.0076f, 0.0120f},
00068 {0.0100f, 0.0130f, 0.0180f},
00069 {0.0070f, 0.0065f, 0.0077f},
00070 0.1500f, 0.0870f, 0.9000f,
00071 0.3200f, 0.1100f, 0.0130f},
00072 {"polaris silber",
00073 {0.0550f, 0.0630f, 0.0710f},
00074 {0.0650f, 0.0820f, 0.0880f},
00075 {0.1100f, 0.1100f, 0.1300f},
00076 {0.0080f, 0.0130f, 0.0150f},
00077 1.0000f, 0.9200f, 0.9000f,
00078 0.3800f, 0.1700f, 0.0130f},
00079 {"opel titan",
00080 {0.0110f, 0.0130f, 0.0150f},
00081 {0.0570f, 0.0660f, 0.0780f},
00082 {0.1100f, 0.1200f, 0.1300f},
00083 {0.0095f, 0.0140f, 0.0160f},
00084 0.8500f, 0.8600f, 0.9000f,
00085 0.3800f, 0.1700f, 0.0140f},
00086 {"bmw339",
00087 {0.0120f, 0.0150f, 0.0160f},
00088 {0.0620f, 0.0760f, 0.0800f},
00089 {0.1100f, 0.1200f, 0.1200f},
00090 {0.0083f, 0.0150f, 0.0160f},
00091 0.9200f, 0.8700f, 0.9000f,
00092 0.3900f, 0.1700f, 0.0130f},
00093 {"2k acrylack",
00094 {0.4200f, 0.3200f, 0.1000f},
00095 {0.0000f, 0.0000f, 0.0000f},
00096 {0.0280f, 0.0260f, 0.0060f},
00097 {0.0170f, 0.0075f, 0.0041f},
00098 1.0000f, 0.9000f, 0.1700f,
00099 0.8800f, 0.8000f, 0.0150f},
00100 {"white",
00101 {0.6100f, 0.6300f, 0.5500f},
00102 {2.6e-06f, 0.00031f, 3.1e-08f},
00103 {0.0130f, 0.0110f, 0.0083f},
00104 {0.0490f, 0.0420f, 0.0370f},
00105 0.0490f, 0.4500f, 0.1700f,
00106 1.0000f, 0.1500f, 0.0150f},
00107 {"blue",
00108 {0.0079f, 0.0230f, 0.1000f},
00109 {0.0011f, 0.0015f, 0.0019f},
00110 {0.0250f, 0.0300f, 0.0430f},
00111 {0.0590f, 0.0740f, 0.0820f},
00112 1.0000f, 0.0940f, 0.1700f,
00113 0.1500f, 0.0430f, 0.0200f},
00114 {"blue matte",
00115 {0.0099f, 0.0360f, 0.1200f},
00116 {0.0032f, 0.0045f, 0.0059f},
00117 {0.1800f, 0.2300f, 0.2800f},
00118 {0.0400f, 0.0490f, 0.0510f},
00119 1.0000f, 0.0460f, 0.1700f,
00120 0.1600f, 0.0750f, 0.0340f}
00121 };
00122
00123 }
00124