My models are bright white

Started by
5 comments, last by Meshboy 16 years, 2 months ago
Same Code different gfx-card. Old Card 6600GT and now 8800GTX. Why are my models almose completely white, when running on my old computer with old gfx card they looked perfect. any idéas???
Advertisement
Could you post your mesh rendering code?

Could be you need to set a material or the texture is incorrect.

Is your texture powers of 2 on each side?

Do you set a material before you render the mesh?

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

heres my mesh code. didn´t understand 100% of what you mean, maybe the code can answer your questions. =)

public class GameMesh
{
public Mesh mesh = null;
public Material[] meshMaterials = null;
public Texture[] meshTextures = null;
public float roll = 0.0f;
public float yaw = 0.00f;
public float pitch = 0.0f;
public tVector3 meshPos = new tVector3(0, 0, 0);
public float scale = 1;

public void LoadMesh(string file, ref Device dev)
{
ExtendedMaterial[] mtrl;
GraphicsStream adj;
// Load our mesh
mesh = Mesh.FromFile(file, MeshFlags.Managed, dev, out adj, out mtrl);
// If we have any materials, store them
if ((mtrl != null) && (mtrl.Length > 0))
{
meshMaterials = new Material[mtrl.Length];
meshTextures = new Texture[mtrl.Length];
// Store each material and texture
for (int i = 0; i < mtrl.Length; i++)
{
meshMaterials = mtrl.Material3D;
if ((mtrl.TextureFilename != null) && (mtrl.TextureFilename != string.Empty))
{
// We have a texture, try to load it
meshTextures = TextureLoader.FromFile(dev, @"..\..\" + mtrl.TextureFilename);
}
}
}
}

public void DrawMesh(ref Device device)
{
device.Transform.World = Matrix.Multiply(Matrix.Scaling(scale, scale, scale), Matrix.RotationYawPitchRoll(yaw, pitch, roll) * Matrix.Translation(meshPos.x, meshPos.y, meshPos.z));
for (int i = 0; i < meshMaterials.Length; i++)
{
device.Material = meshMaterials;
device.SetTexture(0, meshTextures);
mesh.DrawSubset(i);
}
}

Are all the texture loads successful? (I program in C++ so I don't know if you'll get an indication of an error from the TextureLoader)

Do you do error-checking for all your calls? That might help.

I'm thinking if the material is white and meshTextures==NULL, you'll get what you're seeing.

You should always check for errors, BTW.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Is just a common D3DX mistake, when you pass info from the ExtendendMaterial[] to the Material[], D3DX dont pass AmbientColor info so just make it the same that Diffuse Color, something like this

// Store each material and texturefor (int i = 0; i < mtrl.Length; i++){    meshMaterials = mtrl.Material3D;  //<--- No ambientColor Info    mtrl.AmbientColor = mtrl.DiffuseColor; //<--- AmbientColor = DiffuseColor}


please let met know if this helps you

[Edited by - fladur on February 17, 2008 9:39:47 PM]
Don't forget to visit my blog here.
Hey! Just let noobs be noobs, after all, we once were noobs right?
Things to look out for when you have this kind of problem.

What does the Debug output say?
Are there any errors loading anything?
If you are using materials, are your lights enabled?
Have the correct rendering states been set?

Take a step backwards and create your own material just to see where the problem exists. If you have the same problem using your own material, then the problem might be the lighting model that you are using.

I hope this helps.
Take care.
sorry for late response. will try your code later.
thanks for all help, will notify if it helps =)

This topic is closed to new replies.

Advertisement