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<Spectrum> > kd,
00036 boost::shared_ptr<Texture<Spectrum> > ks1, boost::shared_ptr<Texture<Spectrum> > ks2, boost::shared_ptr<Texture<Spectrum> > ks3,
00037 boost::shared_ptr<Texture<float> > r1, boost::shared_ptr<Texture<float> > r2, boost::shared_ptr<Texture<float> > r3,
00038 boost::shared_ptr<Texture<float> > m1, boost::shared_ptr<Texture<float> > m2, boost::shared_ptr<Texture<float> > m3,
00039 boost::shared_ptr<Texture<float> > bump);
00040
00041 BSDF *GetBSDF(const DifferentialGeometry &dgGeom, const DifferentialGeometry &dgShading, float u) const;
00042
00043 static Material * CreateMaterial(const Transform &xform, const TextureParams &mp);
00044 private:
00045
00046 boost::shared_ptr<Texture<Spectrum> > Kd, Ks1, Ks2, Ks3;
00047 boost::shared_ptr<Texture<float> > R1, R2, R3, M1, M2, M3;
00048 boost::shared_ptr<Texture<float> > bumpMap;
00049 };
00050
00051 struct CarPaintData {
00052 string name;
00053 float kd[COLOR_SAMPLES];
00054 float ks1[COLOR_SAMPLES];
00055 float ks2[COLOR_SAMPLES];
00056 float ks3[COLOR_SAMPLES];
00057 float r1, r2, r3;
00058 float m1, m2, m3;
00059 };
00060
00061 static CarPaintData carpaintdata[] = {
00062 {"ford f8",
00063 {0.0012f, 0.0015f, 0.0018f},
00064 {0.0049f, 0.0076f, 0.0120f},
00065 {0.0100f, 0.0130f, 0.0180f},
00066 {0.0070f, 0.0065f, 0.0077f},
00067 0.1500f, 0.0870f, 0.9000f,
00068 0.3200f, 0.1100f, 0.0130f},
00069 {"polaris silber",
00070 {0.0550f, 0.0630f, 0.0710f},
00071 {0.0650f, 0.0820f, 0.0880f},
00072 {0.1100f, 0.1100f, 0.1300f},
00073 {0.0080f, 0.0130f, 0.0150f},
00074 1.0000f, 0.9200f, 0.9000f,
00075 0.3800f, 0.1700f, 0.0130f},
00076 {"opel titan",
00077 {0.0110f, 0.0130f, 0.0150f},
00078 {0.0570f, 0.0660f, 0.0780f},
00079 {0.1100f, 0.1200f, 0.1300f},
00080 {0.0095f, 0.0140f, 0.0160f},
00081 0.8500f, 0.8600f, 0.9000f,
00082 0.3800f, 0.1700f, 0.0140f},
00083 {"bmw339",
00084 {0.0120f, 0.0150f, 0.0160f},
00085 {0.0620f, 0.0760f, 0.0800f},
00086 {0.1100f, 0.1200f, 0.1200f},
00087 {0.0083f, 0.0150f, 0.0160f},
00088 0.9200f, 0.8700f, 0.9000f,
00089 0.3900f, 0.1700f, 0.0130f},
00090 {"2k acrylack",
00091 {0.4200f, 0.3200f, 0.1000f},
00092 {0.0000f, 0.0000f, 0.0000f},
00093 {0.0280f, 0.0260f, 0.0060f},
00094 {0.0170f, 0.0075f, 0.0041f},
00095 1.0000f, 0.9000f, 0.1700f,
00096 0.8800f, 0.8000f, 0.0150f},
00097 {"white",
00098 {0.6100f, 0.6300f, 0.5500f},
00099 {2.6e-06f, 0.00031f, 3.1e-08f},
00100 {0.0130f, 0.0110f, 0.0083f},
00101 {0.0490f, 0.0420f, 0.0370f},
00102 0.0490f, 0.4500f, 0.1700f,
00103 1.0000f, 0.1500f, 0.0150f},
00104 {"blue",
00105 {0.0079f, 0.0230f, 0.1000f},
00106 {0.0011f, 0.0015f, 0.0019f},
00107 {0.0250f, 0.0300f, 0.0430f},
00108 {0.0590f, 0.0740f, 0.0820f},
00109 1.0000f, 0.0940f, 0.1700f,
00110 0.1500f, 0.0430f, 0.0200f},
00111 {"blue matte",
00112 {0.0099f, 0.0360f, 0.1200f},
00113 {0.0032f, 0.0045f, 0.0059f},
00114 {0.1800f, 0.2300f, 0.2800f},
00115 {0.0400f, 0.0490f, 0.0510f},
00116 1.0000f, 0.0460f, 0.1700f,
00117 0.1600f, 0.0750f, 0.0340f}
00118 };
00119
00120 }
00121