Textures in a .X Model

Mar 7, 2011 at 12:17 AM

Hi everyone...

I'm new in XNA and Goblin, so I already load a .X model but the textures is not showed here is the code where i load the model

// Cargar el modelo de Alicia
            LuminaryModelLoader loader = new LuminaryModelLoader();
            aliciaModel = (LuminaryModel)loader.Load("", "Modelo/Alicia");
            // Creamos un GeometryNode con la geometria de alicia
            aliciaNodo = new GeometryNode("Alicia");
            aliciaNodo.Model = aliciaModel;

            aliciaNodo.AddToPhysicsEngine = true;
            aliciaNodo.Physics.Shape = ShapeType.Cylinder;
            aliciaNodo.Model.CastShadows = true;
            aliciaNodo.Model.ReceiveShadows = true;
// Posicionar el modelo de alicia 
            TransformNode aliciaTransformNode = new TransformNode();
            aliciaTransformNode.Translation = new Vector3(40, 26, 10);

            // Material solo de prueba nomas
            Material aliciaMaterial = new Material();
            //aliciaMaterial.Diffuse = new Vector4(0, 0.5f, 0, 1);
            aliciaMaterial.Specular = Color.White.ToVector4();
            aliciaMaterial.SpecularPower = 10;

            aliciaNodo.Material = aliciaMaterial;

            // Agregar los nodos al grafo de la escena 

If you see in the line  (aliciaNodo.Material = aliciaMaterial;) I assign a material for debuggin, but if I remove that line, the model appear black...

I know that XNA manages the information about textures, but I'm not sure how this work with Goblin...


PD. Sorry for the bad english, I'm spanish...

Mar 7, 2011 at 3:39 AM

you need to set

((Model)aliciaModel).UseInternalMatrerials = true;

assuming your LuminaryModel is extended from Model class.

When you use the internal material associated with the model, whatever material you assign yourself is ignored except it's alpha value (material.Diffuse.W)


Mar 7, 2011 at 3:54 AM

=) it works...

thank you very much, i really appreciate your time and help...


Carlos Lucero