public void MeshRenderUVsAndTexture() { var mesh = ObjFileLoader.LoadMeshFromObjAtPath(new System.IO.FileInfo("../../../../../geometry_models/knot3/knot3.obj")); var tris = mesh.Triangles; mesh.VertexData = mesh.VertexData.Select(x => Vector4.Multiply(x, new Vector4(1.0f, 1.0f, 1.0f, 1.0f))) //scale and offset. .Select(x => Vector4.Multiply(Vector4.Add(x, new Vector4(5, 5, 0, 0)), 120.0f)).ToArray(); var ppm = new ppmImage("../../../../../textures/testTexture2.ppm"); var renderable = new Renderable <Mesh>( new DiffuseMaterial() { Shader = new TextureShader(Matrix4x4.Identity, Matrix4x4.Identity, Matrix4x4.Identity), DiffuseTexture = new Texture2d(ppm.Width, ppm.Height, ppm.Colors) }, mesh); var renderer = new Renderer2dGeneric <Mesh>(1024, 768, Color.Black, new List <IEnumerable <Renderable <Mesh> > > { new List <Renderable <Mesh> > { renderable } }); var image = new ppmImage(1024, 768, 255); image.Colors = renderer.Render(); System.IO.File.WriteAllBytes("../../../ShaderRender2.ppm", image.toByteArray()); //how many pixels are bluish... Assert.AreEqual(4053, image.Colors.Where(x => Utilities.ComputeSimpleColorDistance(x, Color.FromArgb(41, 92, 144)) < 50).Count()); }