public static Scene Lighting1() { Scene scene = new Scene(new Color(255, 255, 255)); Light sun = new LightDirectional(new Color(255, 255, 255), new Vector3(1, -1, 1), scene); LightGroup lightGroup = new LightGroup(); lightGroup.addLight(sun); SurfaceMaterial diffuseRed = new SurfaceDiffuse(new Color(255, 50, 50), lightGroup); SurfaceMaterial diffuseGreen = new SurfaceDiffuse(new Color(50, 255, 50), lightGroup); SurfaceMaterial diffuseBlue = new SurfaceDiffuse(new Color(50, 50, 255), lightGroup); SurfaceMaterial diffuseWhite = new SurfaceDiffuse(new Color(255, 255, 255), lightGroup); SurfaceMaterial specular = new SurfaceSpecular(new Color(100, 100, 100), 50, lightGroup); SurfaceMaterial red = new SurfaceMaterialSum(specular, diffuseRed); SurfaceMaterial blue = new SurfaceMaterialSum(specular, diffuseBlue); SurfaceMaterial green = new SurfaceMaterialSum(specular, diffuseGreen); SurfaceMaterial white = new SurfaceMaterialSum(specular, diffuseWhite); scene.addSurface(new Surface(new SurfacePlane(-25 * Vector3.Up, Vector3.Forward, Vector3.Right), white)); scene.addSurface(new Surface(new SurfaceSphere(new Vector3(-40, 0, 80), 10), red)); scene.addSurface(new Surface(new SurfaceSphere(new Vector3(0, 0, 80), 10), green)); scene.addSurface(new Surface(new SurfaceSphere(new Vector3(40, 0, 80), 10), blue)); return(scene); }
public static Scene Lighting2() { Scene scene = new Scene(new Color(255, 255, 255)); Light lightRed = new LightDirectional(new Color(255, 0, 0), new Vector3(1, -3, 0), scene, true); Light lightGreen = new LightDirectional(new Color(0, 255, 0), new Vector3(-1, -3, 0), scene, true); Light lightBlue = new LightDirectional(new Color(0, 0, 255), new Vector3(0, -3, 1), scene, true); LightGroup lightGroup = new LightGroup(); lightGroup.addLight(lightRed); lightGroup.addLight(lightGreen); lightGroup.addLight(lightBlue); SurfaceMaterial diffuseWhite = new SurfaceDiffuse(new Color(255, 255, 255), lightGroup); SurfaceMaterial specular = new SurfaceSpecular(new Color(100, 100, 100), 50, lightGroup); SurfaceMaterial material = new SurfaceMaterialSum(specular, diffuseWhite); scene.addSurface(new Surface(new SurfacePlane(-25 * Vector3.Up, Vector3.Forward, Vector3.Right), diffuseWhite)); scene.addSurface(new Surface(new SurfaceSphere(new Vector3(0, 0, 80), 10), material)); return(scene); }
public static Scene Mesh() { Scene scene = new Scene(new Color(200, 200, 255)); Mesh mesh = OBJ.ParseFile(@"..\..\monkey.obj"); LightGroup lightGroup = new LightGroup(); lightGroup.addLight(new LightDirectional(new Color(255, 255, 255), new Vector3(0.2, -0.2, 1), scene)); SurfaceGeometry geometry = new SurfaceMesh(mesh, Vector3.Forward * 10, new Vector3(0, Math.PI, 0), SurfaceMesh.NormalMode.PER_VERTEX); SurfaceMaterial diffuse = new SurfaceDiffuse(new Color(200, 212, 180), lightGroup); SurfaceMaterial specular = new SurfaceSpecular(new Color(255, 255, 255), 150, lightGroup); SurfaceMaterial material = new SurfaceMaterialSum(diffuse, specular); Surface monkey = new Surface(geometry, material); //We enclose the monkey in a bounding sphere, which speeds up the rendering over 7 times Surface boundedMonkey = new Surface(new SurfaceBoundingVolume(new SurfaceSphere(Vector3.Forward * 10, 2.5), monkey), null); scene.addSurface(boundedMonkey); return(scene); }