This project is read-only.

adding textures to 3D models

Nov 2, 2011 at 12:39 AM

Hi i am trying to add A 2D texture to a geometry node (the ground node)


           groundNode = new GeometryNode("Ground");
            groundNode.Model = new Box(50, 120, 0.1f);
            // Set this ground model to act as an occluder so that it appears transparent           

groundNode.IsOccluder = false;
            // Make the ground model to receive shadow casted by other objects with         

  // CastShadows set to true           

groundNode.Model.ReceiveShadows = true;            
            Material groundMaterial = new Material();           

groundMaterial.Diffuse = Color.White.ToVector4();           

groundMaterial.Specular = Color.Blue.ToVector4();           

groundMaterial.SpecularPower = 10;           

groundMaterial.Texture = Content.Load<Texture2D>("brick_wall_14");

            groundNode.Material = groundMaterial;


brick_wall_14 is added to the content and set to always copy when doing this nothing seems to happen the ground does not change to the texture not sure what i am missing

Nov 2, 2011 at 2:44 AM

Geometries in Graphics.Geometry package does not include texture coordinates info. Reasons are mentioned in the User Manual. See how you need to do texture mapping in Tutorial 7.