texture disappear

Started by
11 comments, last by hegel 18 years, 1 month ago
I just found that the .x file exported by Maya sets all MeshVertexColor to black(r:0,g:0,b:0). I deleted all MeshVertexColor field in the .x file, then texture appeared.
I'm just wandering if there is any other programmable way to display textures than directly modifying .x file?
Advertisement
Quote:Original post by hegel
I'm just wandering if there is any other programmable way to display textures than directly modifying .x file?
You could, once loaded, modify the vertex buffer so that the diffuse component is not [0,0,0]...

Use ID3DXMesh::GetDeclaration() and scan the returned list for a usage of D3DDECLUSAGE_COLOR and index of 0. You can then extract the offset for the given field (the stride is D3DXGetDeclVertexSize()) and off you go [grin]

I'm pretty sure you could also use the fixed-function texture blending to skip the diffuse colour as well. I'm a little rusty on that part (Pixel Shaders for the win! [lol]) but a little reading around the SetTextureStageState() function should reveal all...

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

MeshVertexColor is not within vertex format definition. It's a standard template in .x files. Maya's exporter automatically set all MeshVertexColor to black. Directx will use this color information to render mesh if this information is present instead of texures. I think this maya's x file exporter is stupid at this point. Is there anyway to use fix functions of dx9 to overlook this MeshVertexColor information when rendering?

This topic is closed to new replies.

Advertisement