static void CreateRaycastScene(Scene <PositionNormalCoordinate, Material> scene) { Texture2D planeTexture = Texture2D.LoadFromFile("wood.jpeg"); var sphereModel = Raycasting.UnitarySphere.AttributesMap(a => new PositionNormalCoordinate { Position = a, Coordinates = float2(atan2(a.z, a.x) * 0.5f / pi + 0.5f, a.y), Normal = normalize(a) }); // Adding elements of the scene scene.Add(sphereModel, new Material { Specular = float3(1, 1, 1), SpecularPower = 260, WeightDiffuse = 0, WeightFresnel = 1.0f, // Glass sphere RefractionIndex = 1.6f }, Transforms.Translate(0, 1, -1.5f)); scene.Add(sphereModel, new Material { Specular = float3(1, 1, 1), SpecularPower = 260, WeightDiffuse = 0, WeightMirror = 1.0f, // Mirror sphere }, Transforms.Translate(1.5f, 1, 0)); Texture2D boxDiffuse = Texture2D.LoadFromFile("textures\\wall_texture.bmp"); Materials <MyPositionNormalCoordinate> .CreateNoisyBumpMap("noisy.bmp", 0.05f, 400, 400); Materials <MyPositionNormalCoordinate> .CreateRoughStringBumpMap("rough.bmp", 10, 400, 400); var boxBump = Texture2D.LoadFromFile("noisy.bmp"); boxBump = Texture2D.LoadFromFile("rough.bmp"); //boxBump = null; var material = new Material { DiffuseMap = boxDiffuse, BumpMap = boxBump, Diffuse = float3(1, 1, 1), Specular = float3(1, 1, 1) * .3f, SpecularPower = 60, WeightGlossy = .02f, WeightFresnel = 0f, TextureSampler = new Sampler { Wrap = WrapMode.Repeat, MinMagFilter = Filter.Linear }, }; scene.Add(sphereModel, new Material { Specular = float3(1, 1, 1) * 0.1f, SpecularPower = 60, Diffuse = float3(1, 1, 1) }, Transforms.Translate(-1.5f, 1, 0)); var mesh = MeshShapeGenerator <PositionNormalCoordinate> .Box(5, 5, 5, false, false, false, false, false, allMat : material); var normal = float3(1, 0, 0); scene.Add(Raycasting.PlaneYZ.AttributesMap(a => new PositionNormalCoordinate { Position = a, Coordinates = float2(a.y, a.z), Normal = normal }), material, Transforms.Translate(-1.5f, 1, 0)); scene.Add(Raycasting.PlaneXZ.AttributesMap(a => new PositionNormalCoordinate { Position = a, Coordinates = float2(a.x * 0.2f, a.z * 0.2f), Normal = float3(0, 1, 0) }), new Material { DiffuseMap = planeTexture, Diffuse = float3(1, 1, 1), TextureSampler = new Sampler { Wrap = WrapMode.Repeat, MinMagFilter = Filter.Linear } }, Transforms.Identity); // Light source scene.Add(sphereModel, new Material { Emissive = LightIntensity / (4 * pi), // power per unit area WeightDiffuse = 0, WeightFresnel = 1.0f, // Glass sphere RefractionIndex = 1.0f }, mul(Transforms.Scale(2.4f, 0.4f, 2.4f), Transforms.Translate(LightPosition))); }