cgdev

Members
  • Content count

    27
  • Joined

  • Last visited

Community Reputation

411 Neutral

About cgdev

  • Rank
    Member

Personal Information

  1. I think you may delete this line   The for loop is not correct, you should use: for(DWORD ctr = 0; ctr < vertexcount; ctr++) {    for(DWORD ctr = 0; ctr < nElements; ctr++)   {       ...   } } Take a simple sample: a plane has 4 vertex  (the x file DeclData_Plane1_2011.zip can be found on my download page ) every vertex has a position, normal, texcoord, then the layout is: DeclData { 2; // nElements == 2 2;0;3;0;, // type == 2 (Float3); usage == 3 (Normal) 1;0;5;0;; // type == 1 (Float2); usage == 5 (Texcoord) 20; // nDWords == 20; This because 1 Normal and 1 Texcoord will use 5 DWORD, so 4 * 5 = 20 0, // normal0.x == 0 1065353216, // normal0.y == 1.0 0, // normal0.z == 0 0, // tex0.x == 0 0, // tex0.y == 0 0, // normal1.x == 0 1065353216, // normal1.y == 1.0 0, // normal1.y == 0 1065353216, // tex1.x == 1.0 0, // tex1.y == 0 0, // normal2.x == 0 1065353216, // normal2.y == 1.0 0, // normal2.z == 0 0, // tex2.x == 0 1065353216, // tex2.y == 1 0, // normal3.x == 0 1065353216, // normal3.y == 1.0 0, // normal3.z == 0 1065353216, // tex3.x == 1.0 1065353216; // tex3.y == 1.0 }
  2. Problem with .X format

    @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[i]);
  3. FVF is the old style before dx8 while decl is the new style mainly used in dx9. FVF has no D3DFVF_TANGENT and D3DFVF_BINORMAL while decl has D3DDECLUSAGE_TANGENT and D3DDECLUSAGE_BINORMAL, etc. FVF use fixed vertex format while decl use flexible vertex format and its vertex elements can be specified in any order.
  4. Mesh Format Confusion

    The basic export workflow is as follows: 1) Setup your scene. 2) In 3ds Max, choose File > Export from the main menu. 3) Click the "Save as type" dropdown list, and scroll to the end, where you will find Alin's DirectX Exporter.   Select the output directory and file name, and press OK. The configuration dialog will open. 4) Hit OK when you finish the configuration.
  5. Mesh Format Confusion

    You can use d3dx library for DirectX 9. The dx11 doesn't support any file format, so you'd better define your own file format.
  6. Hello, I have made a exporter for 3ds max 7 ~ 2013.  The latest version has just been updated for CAT animation.  You can download from my site and use it for free. The Softimage exporter is good for mesh export but seems  to stop the development.
  7. Transparent Texture Color

    If you use a constant alpha, simply hardcode it in the fx file, when use more than one alpha value, you can make it into alpha channel in the texture, or use a second alpha texture.
  8. Microsoft confirms XNA is over

    That's really bad news ...
  9. Textures

    It seems like one vertex shared by two faces has different uv coordinates, so you cannot get a smooth face.
  10. You can't export the vertex color If your object doesn't support vertex color channel or you have never changed the default vertex color.
  11. Because the D3DXComputeBoundingBox has a limitation: it can only computes a bounding box align to the coordinate-axis. When you use D3DXCreateBox or use 3ds max to create a box not align to the coordinate-axis you will find that the bounding box always align to the coordinate-axis, not align to the object axis, so the size is much larger than the size of the box.   Alin
  12. How to load a bumpmap

    Suppose you have computed the bump map from a height map, I think you need a environment map in stage 2 for blending. In stage1, add the following code to set the matrix: pd3dDevice->SetTextureStageState(1, D3DTSS_BUMPENVMAT00, F2DW(1)); pd3dDevice->SetTextureStageState(1, D3DTSS_BUMPENVMAT01, F2DW(0)); pd3dDevice->SetTextureStageState(1, D3DTSS_BUMPENVMAT10, F2DW(0)); pd3dDevice->SetTextureStageState(1, D3DTSS_BUMPENVMAT11, F2DW(1));
  13. Restricting Camera

    D3DXVECTOR3 V = m_vUp; D3DXVECTOR3 Y = D3DXVECTOR3( 0.0f, 1.0f, 0.0f ); D3DXVec3Normalize( &V, &V ); D3DXVec3Normalize( &Y, &Y ); float angle = acos( D3DXVec3Dot( &V, &Y ) ) * 180.0f / M_PI; if (angle < 90) { // Rotate the camera up and down according to the cursor Y axis. }
  14. Don't update m_vLookAt with vLook because it is a normalized directional vector while m_vLookAt is a point vector.
  15. Try again, I believe it will work: D3DXMATRIX m_mView; D3DXMatrixIdentity( &m_mView ); D3DXVECTOR3 vLook = m_vLookAt; D3DXVec3Normalize( &vLook, &(vLook - m_vPosition) ); D3DXVECTOR3 vRight = m_vRight; D3DXVec3Cross( &vRight, &m_vUp, &vLook ); D3DXVec3Normalize( &vRight, &vRight ); D3DXVECTOR3 vUp = m_vUp; D3DXVec3Cross( &vUp, &vLook, &vRight ); D3DXVec3Normalize( &vUp, &vUp ); m_mView._11 = vRight.x; m_mView._12 = vUp.x; m_mView._13 = vLook.x; m_mView._14 = 0.0f; m_mView._21 = vRight.y; m_mView._22 = vUp.y; m_mView._23 = vLook.y; m_mView._24 = 0.0f; m_mView._31 = vRight.z; m_mView._32 = vUp.z; m_mView._33 = vLook.z; m_mView._34 = 0.0f; m_mView._41 = -D3DXVec3Dot( &m_vPosition, &vRight ); m_mView._42 = -D3DXVec3Dot( &m_vPosition, &vUp ); m_mView._43 = -D3DXVec3Dot( &m_vPosition, &vLook ); m_mView._44 = 1.0f;