本文整理汇总了C#中Plane.SetMaterial方法的典型用法代码示例。如果您正苦于以下问题:C# Plane.SetMaterial方法的具体用法?C# Plane.SetMaterial怎么用?C# Plane.SetMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane.SetMaterial方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: build10
void build10()
{
int ns = 49;
world.ViewPlane.HRes = 800;
world.ViewPlane.VRes = 700;
world.ViewPlane.SetSampler(new Regular(ns));
world.ViewPlane.MaxDepth = 10;
world.Tracer = new Whitted(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new MultiJittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(40, 30, 20);
cam.Target = new Vector3(0, 0, 0);
cam.Distance = 5000;
cam.Zoom = 1.5f;
world.Camera = cam;
Sphere ss = new Sphere(new Vector3(2f, 0.5f, 1f), 0.5f);
ss.Shadows = true;
ss.SetMaterial(new Matte(0.25f, 0.5f, new Vector3(1f, 1f, 1f)) { Shadows = true });
world.Objects.Add(ss);
Matte matte = new Matte(0.25f, 0.5f, new Vector3(0.5f, 0, 0.5f));
matte.Shadows = true;
Box s = new Box(new Vector3(0, 0, 1), new Vector3(1, 1, 2));
s.Shadows = true;
s.SetMaterial(matte);
world.Objects.Add(s);
Matte m2 = new Matte(0.25f, 0, new Vector3(1, 1, 0));
m2.Shadows = true;
Box b2 = new Box(new Vector3(1, 1, 0), new Vector3(2, 2, 1));
b2.SetMaterial(m2);
b2.Shadows = true;
//world.Objects.Add(b2);
Matte matte2 = new Matte(0.75f, 0.5f, new Vector3(1, 1, 1));
matte2.Shadows = true;
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(matte2);
world.Objects.Add(p);
Matte m5 = new Matte(0.75f, 0.1f, new Vector3(0, 0.5f, 1));
m5.Shadows = true;
Annulus an = new Annulus(new Vector3(1, 1.2f, 0), Vector3.Up, 0.4f, 0.2f);
an.SetMaterial(m5);
an.Shadows = true;
world.Objects.Add(an);
Matte m6 = new Matte(0.75f, 0.1f, new Vector3(1, 0, 0.4f));
m6.Shadows = true;
SolidCylinder sc = new SolidCylinder(0, 1, 0.5f);
sc.Shadows = true;
sc.SetMaterial(m6);
world.Objects.Add(sc);
PointLight pl = new PointLight();
pl.Color = Vector3.One;
pl.Position = new Vector3(4, 4, 0);
pl.RadianceScale = 1.0f;
pl.Shadows = true;
world.Lights.Add(pl);
float exp = 2000;
Transparent sphere_material = new Transparent();
sphere_material.SetSpecularRC(0.5f);
sphere_material.SetExp(exp);
sphere_material.SetIndexOfRefraction(1.5f);
sphere_material.SetReflectiveRC(0.1f);
sphere_material.SetTransmissionCoefficient(0.9f);
Sphere sph = new Sphere(new Vector3(2f, 0.5f, 0f), 0.5f);
sph.SetMaterial(sphere_material);
world.Objects.Add(sph);
Reflective smatte2 = new Reflective();
smatte2.SetAmbientRC(0.25f);
smatte2.SetDiffuseRC(0.5f);
smatte2.SetRColor(new Vector3(1));
smatte2.SetSpecularRC(0.15f);
smatte2.SetExp(100);
smatte2.SetReflectiveRC(0.75f);
smatte2.SetCD(new Vector3(1));
Sphere sphere = new Sphere(new Vector3(0, 2, 0), 0.4f);
sphere.SetMaterial(smatte2);
world.Objects.Add(sphere);
}
示例2: build12
void build12()
{
int ns = 256;
world.ViewPlane.HRes = 400;
world.ViewPlane.VRes = 400;
world.ViewPlane.SetSampler(new Regular(ns));
world.ViewPlane.MaxDepth = 10;
world.Tracer = new Whitted(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new MultiJittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(10, 20, 40);
cam.Target = new Vector3(0, 0, 0);
cam.Distance = 200;
cam.Zoom = 3f;
world.Camera = cam;
Matte matte2 = new Matte(0.75f, 0.5f, new Vector3(1, 1, 1));
matte2.Shadows = true;
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(matte2);
world.Objects.Add(p);
Transparent smatte2 = new Transparent();
smatte2.SetIndexOfRefraction(1.37896f);
smatte2.SetReflectiveRC(0.1f);
smatte2.SetExp(2000);
smatte2.SetTransmissionCoefficient(0.9f);
smatte2.SetSpecularColor(new Vector3(1));
smatte2.SetSpecularRC(0.5f);
Sphere s = new Sphere(new Vector3(0, 7, 0), 5);
s.SetMaterial(smatte2);
world.Objects.Add(s);
Matte stage_m = new Matte(0.5f, 0.5f, new Vector3(1, 0, 0));
PointLight light = new PointLight();
light.Color = Vector3.One;
light.Position = new Vector3(12, 12, 12);
light.RadianceScale = 1.0f;
world.Lights.Add(light);
Matte wall_m = new Matte(0.75f, 0.75f, new Vector3(1));
Box b = getbox(new Vector3(-20, 5, 0), new Vector3(2, 50, 50));
b.SetMaterial(wall_m);
Box b2 = getbox(new Vector3(0, 5, -20), new Vector3(50, 50, 2));
b2.SetMaterial(wall_m);
world.Objects.Add(b2);
world.Objects.Add(b);
Box stage = getbox(new Vector3(0, 1, 0), new Vector3(5, 2, 5));
stage.SetMaterial(stage_m);
world.Objects.Add(stage);
}
示例3: build8
void build8()
{
int ns = 256;
world.ViewPlane.HRes = 400;
world.ViewPlane.VRes = 400;
world.ViewPlane.MaxDepth = 1;
world.ViewPlane.SetSamples(ns);
world.Tracer = new Whitted(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new MultiJittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(40, 30, 20);
cam.Target = new Vector3(0, 0, 0);
cam.Distance = 5000;
cam.Zoom = 1;
world.Camera = cam;
Reflective matte2 = new Reflective();
matte2.SetAmbientRC(0.001f);
matte2.SetDiffuseRC(0.5f);
matte2.SetRColor(new Vector3(1));
matte2.SetSpecularRC(0);
matte2.SetExp(100);
matte2.SetReflectiveRC(0.5f);
matte2.SetCD(new Vector3(1));
Sphere ss = new Sphere(new Vector3(2f, 0.5f, 1f), 0.5f);
ss.Shadows = true;
ss.SetMaterial(matte2);
world.Objects.Add(ss);
Matte matte = new Matte(0.25f, 0.5f, new Vector3(0.5f, 0, 0.5f));
matte.Shadows = true;
Box s = new Box(new Vector3(0, 0, 1), new Vector3(1, 1, 2));
s.Shadows = true;
s.SetMaterial(matte);
world.Objects.Add(s);
Matte m2 = new Matte(0.25f, 0, new Vector3(1, 1, 0));
m2.Shadows = true;
Box b2 = new Box(new Vector3(1, 1, 0), new Vector3(2, 2, 1));
b2.SetMaterial(m2);
b2.Shadows = true;
//world.Objects.Add(b2);
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(new Matte(0.25f, 0.5f, new Vector3(1f, 1f, 1f)) { Shadows = true });
world.Objects.Add(p);
Matte m3 = new Matte(1, 1, Vector3.One);
m3.Shadows = true;
Disk d = new Disk(new Vector3(0f, 1.6f, 1), new Vector3(1, 1, 1), 0.5f);
d.SetMaterial(m3);
d.Shadows = true;
world.Objects.Add(d);
Matte m5 = new Matte(0.75f, 0.1f, new Vector3(0, 0.5f, 1));
m5.Shadows = true;
Annulus an = new Annulus(new Vector3(1, 1.2f, 0), Vector3.Up, 0.4f, 0.2f);
an.SetMaterial(m5);
an.Shadows = true;
world.Objects.Add(an);
Matte m6 = new Matte(0.75f, 0.1f, new Vector3(1, 0, 0.4f));
m6.Shadows = true;
SolidCylinder sc = new SolidCylinder(0, 1, 0.5f);
sc.Shadows = true;
sc.SetMaterial(m6);
world.Objects.Add(sc);
PointLight pl = new PointLight();
pl.Color = Vector3.One;
pl.Position = new Vector3(0, 4, 0);
pl.RadianceScale = 1.0f;
pl.Shadows = true;
world.Lights.Add(pl);
}
示例4: build9
void build9()
{
int ns = 256;
world.ViewPlane.HRes = 400;
world.ViewPlane.VRes = 400;
world.ViewPlane.MaxDepth = 20;
world.ViewPlane.SetSampler(new Hammersley(ns));
world.Tracer = new Whitted(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new Jittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(10, 10, 10);
cam.Target = new Vector3(0, 0, 0);
cam.Distance = 5000;
cam.Zoom = 1f;
world.Camera = cam;
Matte floor_material = new Matte(0.75f, 0.25f, Vector3.One);
Plane floor = new Plane(Vector3.Zero, Vector3.Up);
floor.SetMaterial(floor_material);
world.Objects.Add(floor);
Reflective matte2 = new Reflective();
matte2.SetAmbientRC(0.25f);
matte2.SetDiffuseRC(0.5f);
matte2.SetRColor(new Vector3(1));
matte2.SetSpecularRC(0.15f);
matte2.SetExp(100);
matte2.SetReflectiveRC(0.75f);
matte2.SetCD(new Vector3(1));
Box wall1 = new Box(Vector3.Zero, new Vector3(0.5f, 0.5f, 0.1f));
Box wall2 = new Box(Vector3.Zero, new Vector3(0.1f, 0.5f, 0.5f));
wall2.SetMaterial(matte2);
wall1.SetMaterial(matte2);
float exp = 2000;
Transparent sphere_material = new Transparent();
sphere_material.SetSpecularRC(0.5f);
sphere_material.SetExp(exp);
sphere_material.SetIndexOfRefraction(1.5f);
sphere_material.SetTransmissionCoefficient(0.1f);
sphere_material.SetTransmissionCoefficient(0.9f);
Sphere s = new Sphere(new Vector3(0.3f, 0.1f, 0.3f), 0.1f);
s.SetMaterial(sphere_material);
world.Objects.Add(s);
world.Objects.Add(wall1);
world.Objects.Add(wall2);
PointLight pl = new PointLight();
pl.RadianceScale = 1.0f;
pl.Color = Vector3.One;
pl.Position = new Vector3(0, 8, 0);
world.Lights.Add(pl);
}
示例5: build6
void build6()
{
try
{
int ns = 121;
world.ViewPlane.HRes = 400;
world.ViewPlane.VRes = 400;
world.ViewPlane.SetSamples(ns);
world.Tracer = new AreaLighting(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new MultiJittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(40, 30, 20);
cam.Target = new Vector3(0, 0, 0);
cam.Distance = 5000;
cam.Zoom = 1;
world.Camera = cam;
Sphere ss = new Sphere(new Vector3(2f, 0.5f, 1f), 0.5f);
ss.Shadows = true;
ss.SetMaterial(new Matte(0.25f, 0.5f, new Vector3(1f, 1f, 1f)) { Shadows = true });
world.Objects.Add(ss);
Matte matte = new Matte(0.25f, 0.5f, new Vector3(0.5f, 0, 0.5f));
matte.Shadows = true;
Box s = new Box(new Vector3(0, 0, 1), new Vector3(1, 1, 2));
s.Shadows = true;
s.SetMaterial(matte);
world.Objects.Add(s);
Matte m2 = new Matte(0.25f, 0, new Vector3(1, 1, 0));
m2.Shadows = true;
Box b2 = new Box(new Vector3(1, 1, 0), new Vector3(2, 2, 1));
b2.SetMaterial(m2);
b2.Shadows = true;
//world.Objects.Add(b2);
Matte matte2 = new Matte(0.75f, 0.5f, new Vector3(1, 1, 1));
matte2.Shadows = true;
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(matte2);
world.Objects.Add(p);
Matte m3 = new Matte(0.25f, 0.5f, new Vector3(0.2f, 0.7f, 0.3f));
m3.Shadows = true;
Disk d = new Disk(new Vector3(0f, 1.6f, 1), new Vector3(1), 0.5f);
d.SetMaterial(m3);
d.Shadows = true;
world.Objects.Add(d);
Matte m5 = new Matte(0.75f, 0.1f, new Vector3(0, 0.5f, 1));
m5.Shadows = true;
Annulus an = new Annulus(new Vector3(1, 1.2f, 0), Vector3.Up, 0.4f, 0.2f);
an.SetMaterial(m5);
an.Shadows = true;
world.Objects.Add(an);
Matte m6 = new Matte(0.75f, 0.1f, new Vector3(1, 0, 0.4f));
m6.Shadows = true;
Instance sc = new Instance(new SolidCylinder(0, 1, 0.5f));
sc.Shadows = true;
sc.SetMaterial(m6);
world.Objects.Add(sc);
Matte mcone = new Matte(0.45f, 1, new Vector3(0.1f, 0, 0.4f));
Instance cone = new Instance(new SolidCone(0.5f, 1));
cone.Shadows = true;
cone.SetMaterial(mcone);
cone.Translate(new Vector3(0, 1.5f, -0.5f));
world.Objects.Add(cone);
PointLight pl = new PointLight();
pl.Color = Vector3.One;
pl.Position = new Vector3(0, 4, 0);
pl.RadianceScale = 1.0f;
pl.Shadows = true;
world.Lights.Add(pl);
}
catch (Exception e)
{
MessageBox.Show(e.StackTrace);
MessageBox.Show(e.TargetSite.ToString());
throw new Exception("yup");
}
}
示例6: build7
void build7()
{
int ns = 121;
world.ViewPlane.HRes = 400;
world.ViewPlane.VRes = 400;
world.ViewPlane.SetSamples(ns);
world.Tracer = new AreaLighting(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new MultiJittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(0, 50, 0);
cam.Target = new Vector3(0, 0, 0);
cam.Zoom = 2;
cam.Distance = 500;
world.Camera = cam;
var grid = new SimpleBVHTree(GroupingMethod.DistanceM, 40);
for (int i = 0; i < 1000; i++)
{
float rad = MathHelper.RandomFloat(0, 0.25f);
Sphere ss = new Sphere(new Vector3(MathHelper.RandomFloat(-10, 10), rad, MathHelper.RandomFloat(-10, 10)), rad);
ss.Shadows = true;
ss.SetMaterial(new Matte(0.25f, 0.5f, new Vector3(MathHelper.RandomFloat(0, 1), MathHelper.RandomFloat(0, 1), MathHelper.RandomFloat(0, 1))) { Shadows = true });
grid.AddObject(ss);
}
grid.PrepareObjects();
world.Objects.Add(grid);
Matte matte2 = new Matte(0.75f, 0.5f, new Vector3(1, 1, 1));
matte2.Shadows = true;
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(matte2);
world.Objects.Add(p);
PointLight pl = new PointLight();
pl.Color = Vector3.One;
pl.Position = new Vector3(0, 4, 0);
pl.RadianceScale = 1.0f;
pl.Shadows = true;
world.Lights.Add(pl);
}
示例7: build3
void build3()
{
world.ViewPlane = new ViewPlane();
world.ViewPlane.HRes = world.ViewPlane.VRes = 400;
world.ViewPlane.S = 0.5f;
world.ViewPlane.NumSamples = 1;
world.ViewPlane.SetSamples(1);
Ambient ambient_ptr = new Ambient();
ambient_ptr.RadianceScale = (1.0f);
world.AmbientLight = (ambient_ptr);
world.Tracer = new RayCast(world);
Pinhole pinhole_ptr = new Pinhole();
pinhole_ptr.Position = new Vector3(0, 500, 500);
pinhole_ptr.Target = new Vector3(0, 25, 0);
pinhole_ptr.Distance = (600.0f);
pinhole_ptr.ComputeUVW();
world.Camera = (pinhole_ptr);
Directional light_ptr1 = new Directional();
light_ptr1.Direction = Vector3.Normalize(new Vector3(100, 100, 200));
light_ptr1.RadianceScale = 3.0f;
world.Lights.Add(light_ptr1);
Vector3 yellow = new Vector3(1, 1, 0); // yellow
Vector3 brown = new Vector3(0.71f, 0.40f, 0.16f); // brown
Vector3 darkGreen = new Vector3(0.0f, 0.41f, 0.41f); // darkGreen
Vector3 orange = new Vector3(1f, 0.75f, 0f); // orange
Vector3 green = new Vector3(0f, 0.6f, 0.3f); // green
Vector3 lightGreen = new Vector3(0.65f, 1, 0.30f); // light green
Vector3 darkYellow = new Vector3(0.61f, 0.61f, 0); // dark yellow
Vector3 lightPurple = new Vector3(0.65f, 0.3f, 1); // light purple
Vector3 darkPurple = new Vector3(0.5f, 0, 1); // dark purple
Vector3 grey = new Vector3(0.25f); // grey
float ka = 0.25f;
float kd = 0.75f;
Matte matte_ptr1 = new Matte(ka, kd, yellow);
Sphere sphere_ptr1 = new Sphere(new Vector3(5, 3, 0), 30);
sphere_ptr1.SetMaterial(matte_ptr1); // yellow
world.Objects.Add(sphere_ptr1);
Matte matte_ptr2 = new Matte(ka, kd, brown);
Sphere sphere_ptr2 = new Sphere(new Vector3(45, -7, -60), 20);
sphere_ptr2.SetMaterial((matte_ptr2)); // brown
world.Objects.Add(sphere_ptr2);
Matte matte_ptr3 = new Matte(ka, kd, darkGreen);
Sphere sphere_ptr3 = new Sphere(new Vector3(40, 43, -100), 17);
sphere_ptr3.SetMaterial((matte_ptr3)); // dark green
world.Objects.Add(sphere_ptr3);
Matte matte_ptr4 = new Matte(ka, kd, orange);
Sphere sphere_ptr4 = new Sphere(new Vector3(-20, 28, -15), 20);
sphere_ptr4.SetMaterial((matte_ptr4)); // orange
world.Objects.Add(sphere_ptr4);
Matte matte_ptr5 = new Matte(ka, kd, green);
Sphere sphere_ptr5 = new Sphere(new Vector3(-25, -7, -35), 27);
sphere_ptr5.SetMaterial((matte_ptr5)); // green
world.Objects.Add(sphere_ptr5);
Matte matte_ptr6 = new Matte(ka, kd, lightGreen);
Sphere sphere_ptr6 = new Sphere(new Vector3(20, -27, -35), 25);
sphere_ptr6.SetMaterial((matte_ptr6)); // light green
world.Objects.Add(sphere_ptr6);
Matte matte_ptr7 = new Matte(ka, kd, green);
Sphere sphere_ptr7 = new Sphere(new Vector3(35, 18, -35), 22);
sphere_ptr7.SetMaterial((matte_ptr7)); // green
world.Objects.Add(sphere_ptr7);
Matte matte_ptr8 = new Matte(ka, kd, brown);
Sphere sphere_ptr8 = new Sphere(new Vector3(-57, -17, -50), 15);
sphere_ptr8.SetMaterial((matte_ptr8)); // brown
world.Objects.Add(sphere_ptr8);
Matte matte_ptr9 = new Matte(ka, kd, lightGreen);
Sphere sphere_ptr9 = new Sphere(new Vector3(-47, 16, -80), 23);
sphere_ptr9.SetMaterial((matte_ptr9)); // light green
world.Objects.Add(sphere_ptr9);
Matte matte_ptr10 = new Matte(ka, kd, darkGreen);
Sphere sphere_ptr10 = new Sphere(new Vector3(-15, -32, -60), 22);
sphere_ptr10.SetMaterial((matte_ptr10)); // dark green
world.Objects.Add(sphere_ptr10);
Matte matte_ptr11 = new Matte(ka, kd, darkYellow);
Sphere sphere_ptr11 = new Sphere(new Vector3(-35, -37, -80), 22);
sphere_ptr11.SetMaterial((matte_ptr11)); // dark yellow
world.Objects.Add(sphere_ptr11);
Matte matte_ptr12 = new Matte(ka, kd, darkYellow);
Sphere sphere_ptr12 = new Sphere(new Vector3(10, 43, -80), 22);
sphere_ptr12.SetMaterial((matte_ptr12)); // dark yellow
world.Objects.Add(sphere_ptr12);
Matte matte_ptr13 = new Matte(ka, kd, darkYellow);
Sphere sphere_ptr13 = new Sphere(new Vector3(30, -7, -80), 10);
sphere_ptr13.SetMaterial((matte_ptr13));
world.Objects.Add(sphere_ptr13); // dark yellow (hidden)
Matte matte_ptr14 = new Matte(ka, kd, darkGreen);
Sphere sphere_ptr14 = new Sphere(new Vector3(-40, 48, -110), 18);
sphere_ptr14.SetMaterial((matte_ptr14)); // dark green
world.Objects.Add(sphere_ptr14);
Matte matte_ptr15 = new Matte(ka, kd, brown);
Sphere sphere_ptr15 = new Sphere(new Vector3(-10, 53, -120), 18);
sphere_ptr15.SetMaterial((matte_ptr15)); // brown
world.Objects.Add(sphere_ptr15);
Matte matte_ptr16 = new Matte(ka, kd, lightPurple);
Sphere sphere_ptr16 = new Sphere(new Vector3(-55, -52, -100), 10);
sphere_ptr16.SetMaterial((matte_ptr16)); // light purple
world.Objects.Add(sphere_ptr16);
Matte matte_ptr17 = new Matte(ka, kd, brown);
Sphere sphere_ptr17 = new Sphere(new Vector3(5, -52, -100), 15);
//.........这里部分代码省略.........
示例8: build4
void build4()
{
int ns = 256;
world.ViewPlane.HRes = world.ViewPlane.VRes = 400;
world.ViewPlane.SetSamples(ns);
world.Tracer = new RayCast(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new MultiJittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(25, 20, 45);
cam.Target = new Vector3(0, 1, 0);
cam.Distance = 5000;
world.Camera = cam;
Matte matte = new Matte(0.25f, 0f, new Vector3(0.5f, 0, 0.5f));
matte.Shadows = true;
Sphere s = new Sphere(new Vector3(0, 1, 0), 1);
s.Shadows = true;
s.SetMaterial(matte);
world.Objects.Add(s);
Matte matte2 = new Matte(0.75f, 0f, new Vector3(1, 1, 1));
matte2.Shadows = true;
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(matte2);
world.Objects.Add(p);
}
示例9: build2
void build2()
{
int ns = 100;
world.ViewPlane = new ViewPlane();
world.ViewPlane.HRes = world.ViewPlane.VRes = 400;
world.ViewPlane.SetSamples(ns);
world.Tracer = new RayCast(world);
MultiJittered sampler = new MultiJittered(ns);
AmbientOccluder occulder = new AmbientOccluder();
occulder.RadianceScale = 1.0f;
occulder.Color = Vector3.One;
occulder.MinAmount = 0.0f;
occulder.SetSampler(sampler);
occulder.Shadows = true;
world.AmbientLight = occulder;
Directional light_ptr = new Directional();
light_ptr.Direction = Vector3.Normalize(new Vector3(100, 100, 100));
light_ptr.RadianceScale = 1.0f;
light_ptr.Shadows = true;
light_ptr.Color = new Vector3(1);
world.Lights.Add(light_ptr);
Pinhole cam = new Pinhole();
cam.Position = new Vector3(25, 20, 45);
cam.Target = new Vector3(0, 1, 0);
cam.Distance = 5000;
world.Camera = cam;
Matte matte = new Matte(0.25f, 0.7f, new Vector3(1, 1, 0));
matte.Shadows = true;
Sphere s = new Sphere(new Vector3(0, 1, 0), 1);
s.Shadows = true;
s.SetMaterial(matte);
world.Objects.Add(s);
Matte matte2 = new Matte(0.75f, 0, new Vector3(1, 1, 1));
matte2.Shadows = true;
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(matte2);
world.Objects.Add(p);
}
示例10: build15
void build15()
{
int ns = 1;
world.ViewPlane.HRes = 400;
world.ViewPlane.VRes = 400;
world.ViewPlane.SetSampler(new MultiJittered(ns));
world.ViewPlane.MaxDepth = 10;
world.Tracer = new Whitted(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new MultiJittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(0, 20, -60);
cam.Target = new Vector3(0, 7.5f, 0);
cam.Distance = 200;
cam.Zoom = 3.5f;
world.Camera = cam;
ins = new Instance(new Sphere(new Vector3(0, 7.5f, 0), 7.5f));
ins.SetMaterial(new Matte(0.7f, 0.7f, new Vector3(0.56, 0.32, 0.2)));
world.Objects.Add(ins);
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(new Matte(0.75f, 0.75f, new Vector3(0.56, 0.45, 0.32)));
world.Objects.Add(p);
}
示例11: build13
void build13()
{
int ns = 9;
world.ViewPlane.HRes = 400;
world.ViewPlane.VRes = 400;
world.ViewPlane.SetSampler(new MultiJittered(ns));
world.ViewPlane.MaxDepth = 10;
world.Tracer = new Whitted(world);
AmbientOccluder occ = new AmbientOccluder();
occ.RadianceScale = 1.0f;
occ.MinAmount = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
occ.SetSampler(new MultiJittered(ns));
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(0, 20, -60);
cam.Target = new Vector3(0, 7.5f, 0);
cam.Distance = 200;
cam.Zoom = 3.5f;
world.Camera = cam;
float refl = 0.8f;
float spec = 0.2f;
float amb = 0.2f;
float diff = 0.2f;
float exp = 100;
Plane p = new Plane(Vector3.Zero, new Vector3(0, 1, 0));
p.Shadows = true;
p.SetMaterial(new Matte(0.75f, 0.75f, new Vector3(0.56, 0.45, 0.32)));
world.Objects.Add(p);
ImageTexture im = new ImageTexture();
Disque.Raytracer.Textures.Image imm = Extensions.CreateFromBitmap(@"C:\Users\Belal\Downloads\Earth_Diffuse_2.jpg");
im.SetImage(imm);
im.SetMapping(new SphericalMap());
SV_Phong sphere_m = new SV_Phong();
sphere_m.SetCD(im);
sphere_m.SetSpecularColor(new ConstantColor(Vector3.One));
sphere_m.SetExp(1);
sphere_m.SetSpecularRC(1f);
sphere_m.SetDiffuseRC(1f);
sphere_m.SetAmbientRC(1f);
Sphere sphere = new Sphere(new Vector3(0, 0f, 0), 1f);
ins = new Instance(sphere);
ins.SetMaterial(sphere_m);
ins.RotateY(45);
ins.Scale(new Vector3(10));
ins.Translate(new Vector3(0, 13, 0));
Reflective smatte2 = new Reflective();
smatte2.SetAmbientRC(amb);
smatte2.SetDiffuseRC(diff);
smatte2.SetCD(new Vector3(1, 0, 0));
smatte2.SetRColor(new Vector3(1));
smatte2.SetSpecularRC(spec);
smatte2.SetExp(exp);
smatte2.SetReflectiveRC(refl);
SolidCylinder sc = new SolidCylinder(0, 3, 13);
sc.SetMaterial(new Matte(0.5f, 0.5f, new Vector3(0.5f, 0.5f, 0)));
world.Objects.Add(sc);
world.Objects.Add(ins);
PointLight light = new PointLight();
light.Color = Vector3.One;
light.Position = new Vector3(0, 40, -20);
light.RadianceScale = 2f;
world.Lights.Add(light);
}
示例12: build1
void build1(int ns)
{
world.ViewPlane.HRes = 400;
world.ViewPlane.VRes = 400;
world.ViewPlane.MaxDepth = 5;
world.ViewPlane.SetSamples(ns);
world.Tracer = new Whitted(world);
Ambient occ = new Ambient();
occ.RadianceScale = 0f;
occ.Shadows = true;
occ.Color = Vector3.One;
world.AmbientLight = occ;
Pinhole cam = new Pinhole();
cam.Position = new Vector3(0, 60, 120);
cam.Distance = 100;
cam.Zoom = 1400;
world.Camera = cam;
PointLight pl = new PointLight();
pl.Color = Vector3.One;
pl.Position = new Vector3(0, 1000, 0);
pl.RadianceScale = 1.0f;
pl.Shadows = true;
world.Lights.Add(pl);
OBJReader obj = new OBJReader(File.ReadAllText(@"C:\Users\Belal\Downloads\bunny.obj.txt"));
Mesh mesh = obj.GetMesh();
mesh.SetShadows(false);
mesh.SetMaterial(Material.Glass);
world.Objects.Add(mesh);
BBox bb = mesh.GetBoundingBox();
cam.Target = (bb.Min + bb.Max) * 0.5f;
Matte matte2 = new Matte(0.5f, 0.5f, new Vector3(1, 1, 1));
matte2.Shadows = true;
Plane p = new Plane(new Vector3(0, -20, 0), new Vector3(0, 1, 0), "p1");
p.SetShadows(true);
p.SetMaterial(matte2);
world.Objects.Add(p);
}