Sign in to follow this  

My models are bright white

This topic is 3587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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???

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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[i] = mtrl[i].Material3D;
if ((mtrl[i].TextureFilename != null) && (mtrl[i].TextureFilename != string.Empty))
{
// We have a texture, try to load it
meshTextures[i] = TextureLoader.FromFile(dev, @"..\..\" + mtrl[i].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[i];
device.SetTexture(0, meshTextures[i]);
mesh.DrawSubset(i);
}
}

Share this post


Link to post
Share on other sites
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[i]==NULL, you'll get what you're seeing.

You should always check for errors, BTW.

Share this post


Link to post
Share on other sites
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 texture
for (int i = 0; i < mtrl.Length; i++)
{
meshMaterials[i] = mtrl[i].Material3D; //<--- No ambientColor Info
mtrl[i].AmbientColor = mtrl[i].DiffuseColor; //<--- AmbientColor = DiffuseColor
}










please let met know if this helps you

[Edited by - fladur on February 17, 2008 9:39:47 PM]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this