Jump to content
  • Advertisement
Sign in to follow this  
Link

why a white mesh

This topic is 5471 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

Advertisement
Guest Anonymous Poster
Did you load the materials and textures associated with the mesh? Did you set them? The *.x file only contains vertex data; the textures must be loaded separately.

Share this post


Link to post
Share on other sites
sorry but this what does mean:

 Material {
0.694118;0.694118;0.694118;1.000000;;
50.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
TextureFilename {
"tiger.bmp";
}
}
}
MeshTextureCoords {
303;
0.190860;-0.544059;,

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That tells you the material for that subset of the mesh as well as the texture that is applied to it. However, when you load a .x file using D3DXLoadMeshFromX(FileName, Options,
Device, &Adjacency,
&MaterialBuffer, &EffectInstances,
&NumMaterials, &Mesh);

The MaterialBuffer contains this information and NumMaterials tells you how many materials are stored in the material buffer. YOU must load the materials and textures. There is an example (though somewhat convoluted) in the SDK.


D3DXMATERIAL *Material = (D3DXMATERIAL*)MaterialBuffer->GetBufferPointer();
pMaterials = new D3DMATERIAL9[NumMaterials];

for (int i=0; i < NumMaterials; i++)
{
pMaterials = Material.MatD3D;
pMaterials.Ambient = pMaterials.Diffuse;

// Load the texture.
if (Material.pTextureFilename)
{
int32 NewTexIndex = pGraphicsManager->GetTextureManager()->AddTextureFromFile(Material.pTextureFilename);
}
}



This is from my engine, but I removed the extraneous code and error checking. Also, the AddTextureFromFile() function does just what it says. It adds a texture from the file provided and returns an index to it. You would just do the usual load from file call you're used to.

Chris

Share this post


Link to post
Share on other sites
Sorry, that was me. I don't understand this forum's issue with logging people out. Anyway, I wanted to mention also that you would want to create texture like you do for the materials.

pTextures = new D3DTEXTURE9[NumMaterials];

Then set each texture as it is loaded from file. If Material.pTextureFilename is NULL, then set the corresponding texture to NULL as well.

Chris

Share this post


Link to post
Share on other sites
ok, i've adjusted the .x configuration of padasoft plugin so i get a good .x and i can load it correctly inside my application:
I can see either the mesh and its material, the problem came out when i add ink'n paint effect to the texture.
I export regularly the .x file but i get white mesh in the project.


(i use 3dsmax 6 and pandasoft plugin .x exporter)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i have a mesh i add a texture.
then i export at the first time to .x file and i get this code inside the .x:


....
STRING Value;
}

template EffectParamDWord {

STRING ParamName;
DWORD Value;
}


Material Material__1 {
1.000000;1.000000;1.000000;1.000000;;
0.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
}

Material Material__0 {
1.000000;1.000000;1.000000;1.000000;;
0.000000;
1.000000;1.000000;1.000000;;
0.000000;0.000000;0.000000;;
}

Frame Sphere01 {


FrameTransformMatrix {
-0.000000,-0.000000,-0.057787,0.000000,-0.057787,-0.000000,0.000000,0.000000,-0.000000,0.057787,-0.000000,0.000000,0.844275,3.333877,0.633940,1.000000;;
}

Frame {


FrameTransformMatrix {
1.000000,0.000000,0.000000,0.000000,-0.000000,1.000000,0.000000,0.000000,-
......


then i add a ink'n pain effect in the material editor at the texture i've add and i try to export, i get this code:

...

STRING ParamName;
DWORD Value;
}


Material PDX08_-_Default {
1.000000;1.000000;1.000000;1.000000;;
3.200000;
0.000000;0.000000;0.000000;;
0.000000;0.000000;0.000000;;

TextureFilename {
"D:\\ls\\Meshes\\texture.bmp";
}
}

Material PDX03_-_Default {
0.235294;0.517647;0.623529;1.000000;;
3.200000;
0.000000;0.000000;0.000000;;
0.000000;0.000000;0.000000;;
}

Frame Sphere01 {


FrameTransformMatrix {
-0.000000,-0.000000,-0.057787,0.000000,-0.057787,-0.000000,0.000000,0.000000,-
....



why in the first case get the path of texture inside the .x code while in the second case when i just add ink'n paint effect i don't get it?

I think it is the cause i see a white mesh...
Please explain it to me.

[Edited by - Coder on September 28, 2004 2:57:25 PM]

Share this post


Link to post
Share on other sites
If you don't have your textures in the same directory as your project your model will be white. It's possible that's what's happening.

Share this post


Link to post
Share on other sites
Maybe you have not understand the problem.
I try to explain better.
If i add some simple texture (UVW) to my mesh end i export it using absolute path of the texture it works fine in the direct3d project.
But if i do the same stuff but just adding, as effect beyond the texture like ink'n paint so i export in the same way using absolute path for the texture i use i get two strang things:
1) i can't see inside the .x code, the path of the texture
2) when i load the mesh in the direct3d project i get a white mesh.

Please i would to understand.

Share this post


Link to post
Share on other sites
Here's my best guess based on the data at hand. When you add the special effect, it has to create a new texture to apply to the object. It probably stores this texture in a proprietary format or at least internally to the 3D Software. Your exporter can't see the texture anymore. The 3D software considers it a special texture, so it handles it differently. It's similar to creating a wind or black hole or explosion mesh near the 3D object in question. When you animate it, it appears that the object is exploding or being sucked into a black hole, but that animation cannot be exported that way (on some 3D modeling packages anyway), because in the case of the exploding mesh, it has to be broken apart and that's not allowed in an exported x file. The exported x file would probably just be a static mesh. It's the same idea. The texture is no longer a normal texture, since you're using an internal editor to paint over it. However, the software might save the new texture somewhere else. I would recommend doing it this way:

Build the mesh, add the texture, paint all over it, export everything as a standard 3DS object file (or whatever you use). That texture should now be stored on the disk with the paint effect on it (if the software programmers so allowed it). If the texture is not present, you are out of luck probably (unless you can find it somewhere else on the drive). If it is present, just reload the model, apply that texture to it, then export it as a .x file. Or simply use a conversion utility from 3DS to .x.

This is just a best GUESS. Hope it leads you to some further understanding though.

Good luck,
Chris

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!