   Texture Wrapping and Tilling issues
  I am a beginner in DirectX but have tried a lot to implement a basic mesh loading model.The Mesh is loaded using frame hierarchy as followsCreateMeshContainer function:...// Adjacency data - holds information about triangle adjacency, required by the ID3DMESH objectDWORD dwFaces = pMeshData->pMesh->GetNumFaces();newMeshContainer->pAdjacency = new DWORD[dwFaces*3];memcpy(newMeshContainer->pAdjacency, pAdjacency, sizeof(DWORD) * dwFaces*3);// Get the Direct3D device, luckily this is held in the mesh itself (Note: must release it when done with it)LPDIRECT3DDEVICE9 pd3dDevice = 0;pMeshData->pMesh->GetDevice(&pd3dDevice);// Changed 24/09/07 - can just assign pointer and add a ref rather than need to clonenewMeshContainer->MeshData.pMesh=pMeshData->pMesh;newMeshContainer->MeshData.pMesh->AddRef();// Create material and texture arrays. Note that I always want to have at least onenewMeshContainer->NumMaterials = max(NumMaterials,1);newMeshContainer->exMaterials = new D3DMATERIAL9[newMeshContainer->NumMaterials];newMeshContainer->exTextures  = new LPDIRECT3DTEXTURE9[newMeshContainer->NumMaterials];ZeroMemory(newMeshContainer->exTextures, sizeof(LPDIRECT3DTEXTURE9) * newMeshContainer->NumMaterials);if (NumMaterials>0){// Load all the textures and copy the materials overfor(DWORD i = 0; i < NumMaterials; ++i){newMeshContainer->exTextures = 0;newMeshContainer->exMaterials= pMaterials.MatD3D;newMeshContainer->exMaterials.Ambient = pMaterials.MatD3D.Diffuse ;if(pMaterials.pTextureFilename){// Find the texture in the texture Manager itselfBSTR pTexturePath = convertMultiByteToWideChar(pMaterials.pTextureFilename) ;if(FAILED(D3DXCreateTextureFromFile(pd3dDevice, pTexturePath,&newMeshContainer->exTextures))){int  k = 0 ;}::SysFreeString(pTexturePath) ;} //end of if} // end of for}// end of if....Since I am using texture wrapping and texture tiling in my meshes ( when they were created in 3D Studio Max, at that time tiling and wrapping were used).My Rendering Code is as follows:For each meshDXUTGetD3D9Device()->SetFVF(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 );//DXUTGetD3D9Device()->SetRenderState(D3DRS_COLORVERTEX, FALSE);DXUTGetD3D9Device()->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE , D3DMCS_MATERIAL);DXUTGetD3D9Device()->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TEXTURE);DXUTGetD3D9Device()->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);DXUTGetD3D9Device()->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);// Add alpha stage// 0DXUTGetD3D9Device()->SetTextureStageState(0, D3DTSS_ALPHAOP,  D3DTOP_MODULATE );DXUTGetD3D9Device()->SetTextureStageState(0, D3DTSS_ALPHAARG1,D3DTA_TEXTURE );DXUTGetD3D9Device()->SetTextureStageState(0, D3DTSS_ALPHAARG2,D3DTA_DIFFUSE );// 1DXUTGetD3D9Device()->SetTextureStageState(1, D3DTSS_ALPHAOP,  D3DTOP_ADD);DXUTGetD3D9Device()->SetTextureStageState(1, D3DTSS_ALPHAARG1,D3DTA_CURRENT );DXUTGetD3D9Device()->SetTextureStageState(1, D3DTSS_ALPHAARG2,D3DTA_SPECULAR);DXUTGetD3D9Device()->SetTextureStageState(2, D3DTSS_ALPHAOP,  D3DTOP_DISABLE );// Loop through all the materials in the mesh rendering each subsetfor (unsigned int iMaterial = 0; iMaterial < NumMaterials; iMaterial++){exMaterials[iMaterial].Power = 0.0;DXUTGetD3D9Device()->SetMaterial( &exMaterials[iMaterial] );DXUTGetD3D9Device()->SetTexture( 0,exTextures[iMaterial] );// Finally Call the mesh draw functionthis->MeshData.pMesh->DrawSubset(iMaterial);}.. The issue with the rendered image is :<html> http://img4.imageshack.us/img4/1060/42583434.jpg </html>The issue seems to be either due to mesh normals or texture wrapping and tiling.Any help will be greatly appreciated, I am stuc at since the last week.thanksAmber[Edited by - duskndreamz on May 7, 2010 6:49:31 AM]
  I would run it to find out?   ;  @Dave:I am able to run it and render it but there is some isue with the texturing. The texture is not rendering properly in some areas.Is it possible to attach an image in this forum, so that i could show the problem.   ;Quote:Original post by duskndreamzIs it possible to attach an image in this forum, so that i could show the problem.You'll need to upload it to a free hosting service like photobucket, imageshack, etc and then post the image here using HTML tags (Or just the URL of the image).   ;Quote:Original post by Evil SteveQuote:Original post by duskndreamzIs it possible to attach an image in this forum, so that i could show the problem.You'll need to upload it to a free hosting service like photobucket, imageshack, etc and then post the image here using HTML tags (Or just the URL of the image).Thanks a lot for the help. The issue image is poste herehttp://img4.imageshack.us/img4/1060/42583434.jpgFor some reason the texturing of the vehicle is not showing correctly. the tyres on the far side are getting rendered instead of being hidden.Also the white portion below the tyres is a blackish material the car which was generated along with the object in 3dmax, but it is getting rendered as white.   ;  And the texturing state changes with camera movement.After a lot of analyisi, i think the issue is either with the loading process and some issue with material creation, or there is an issue with the rendering process.;Quote:Original post by Evil SteveQuote:Original post by duskndreamzIs it possible to attach an image in this forum, so that i could show the problem.You'll need to upload it to a free hosting service like photobucket, imageshack, etc and then post the image here using HTML tags (Or just the URL of the image).@evil SteveCan you tell me how to close this thread, so that i can post a new thread with better title and more clear description of the problem.It was my first post, and i wasn't able to do it properly.   ;Quote:Original post by duskndreamz@evil SteveCan you tell me how to close this thread, so that i can post a new thread with better title and more clear description of the problem.It was my first post, and i wasn't able to do it properly.Only moderators and staff can close threads - You can edit the original post by clicking the "Edit" button in the top right of your original post - I won't close this thread unless you really want to, it's still relevant and your post really isn't as bad as you might think it is [smile]   ;Quote:Original post by Evil SteveQuote:Original post by duskndreamz@evil SteveCan you tell me how to close this thread, so that i can post a new thread with better title and more clear description of the problem.It was my first post, and i wasn't able to do it properly.Only moderators and staff can close threads - You can edit the original post by clicking the "Edit" button in the top right of your original post - I won't close this thread unless you really want to, it's still relevant and your post really isn't as bad as you might think it is [smile]Thanks;). have edited the post.   ;  Your image looks like you don't use a Z-Buffer. Have a look at your code when initializing the DirectX-Device.   