Jump to content
  • Advertisement
Sign in to follow this  
Anddos

Problem with .X format

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

 I am following this tutorial

 

http://www.chadvernon.com/blog/resources/directx9/frustum-culling/

 

What i am trying todo is add my own model instead of a box,i exported a model fine from 3dsmax to .x and test in the .x viewer it apears fine,when it comes to loading my model in the frustrum demo, the model is apearing with no details, just white and unnatrual, i dont know what the problem is.

 

I am using this exporter , http://www.cgdev.net/download.php for 3dsmax 2011 64bit

 

Thanks if you can help

Edited by Anddos

Share this post


Link to post
Share on other sites
Advertisement
Can you post your (rendering) code?
Maybe it's your textures that are not being used, or weird lighting effects

Share this post


Link to post
Share on other sites

Can you post your (rendering) code?
Maybe it's your textures that are not being used, or weird lighting effects

 

void CMeshInstance::Render( LPDIRECT3DDEVICE9 pDevice )
{
    if ( pDevice && m_pMesh )
    {
        pDevice->SetTransform( D3DTS_WORLD, GetTransform() );
        DWORD numMaterials = m_pMesh->GetNumMaterials();
        for ( DWORD i = 0; i < numMaterials; i++ )
        {
            pDevice->SetMaterial( m_pMesh->GetMeshMaterial( i ) );
            pDevice->SetTexture( 0, m_pMesh->GetMeshTexture( i ) );
            m_pMesh->GetMesh()->DrawSubset( i );
        }
    }
}

Share this post


Link to post
Share on other sites

Can you show the parts of the X file that describe the (u,v) coordinates and the material texture array? Also what path do you provide when opening the files from disk? Is it specified relatively or absolutely? Maybe the file couldn't be opened and so a white texture is used.

 

Try setting the color of the material on the monitor to a very reddish material (1.0f, 0.0f, 0.0f) and see if your render is tinted red, at least then you just know your problem is with either your (u,v) coordinates or your texture file loading.

Edited by Steve_Segreto

Share this post


Link to post
Share on other sites
Hello.
If this is the free version. There is no normals. Run it in mesh view then save it and it will work.

Share this post


Link to post
Share on other sites
@ankhd The free version is the same as pro version which never use old template: MeshNormals and MeshTextureCoords because the new template DeclData can hold more per-vertex information: Tangent, Binormal, TexCoord0, TexCoord1, TexCoord2, ... ,TexCoord10. If I add support the MeshTextureCoords it will conflict with DeclData, so it's not recommended that use mview.exe to convert it back. @Anddos I think you should check the return pointer of m_pMesh->GetMeshMaterial( i ) or D3DXCreateTextureFromFile after D3DXLoadMeshFromX to make sure you have create the texture correctly. Note that the exporter will remove the path of texture file, so maybe you should add your absolute path to these texture filename, for exsampe: D3DXCreateTextureFromFile(pd3dDevice, strPath + strTextureFilename, &g_textures);

Share this post


Link to post
Share on other sites

Oh is that what DeclData is. I did see it in the exported .X file and It has lots of data.

 

I will need to update my loader as well How Does the DeclData Work. Whats it lay out.

By the way Its the best .Xfile Exporter Ive use in 15 years. Thanks.

Share this post


Link to post
Share on other sites
OT: can you check what the createtexturefromfile functions gives as return value?
Maybe the textures are not loaded.

If you export the X file using txt/ascii instead of binary, you can check the file and see which texturefiles it tries to find

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!