Try a new mesh and see if that works if so the there is somthing wrong with that mesh. fist try setting pVertexAttributeWeights Var to NULL.
The SDK says
If pVertexAttributeWeights is set to NULL, the following values are assigned to the default D3DXATTRIBUTEWEIGHTS structure.
D3DXATTRIBUTEWEIGHTS AttributeWeights;
AttributeWeights.Position = 1.0;
AttributeWeights.Boundary = 1.0;
AttributeWeights.Normal = 1.0;
AttributeWeights.Diffuse = 0.0;
AttributeWeights.Specular = 0.0;
AttributeWeights.Tex[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
This default structure is what most applications should use because it considers only geometric and normal adjustment. Only in special cases will the other member fields need to be modified.
//here is how I did it and It works fine
//----------------------------------------------------------------- // Optimize for the vertex cache and build attribute table. DWORD* adj = new DWORD[subMesh->GetNumFaces()*3]; hr = subMesh->GenerateAdjacency(EPSILON, adj); if(FAILED(hr)) MessageBox(NULL, "Terrain Failed To GenerateAdjacency", "Terrain Class buildSubGridMesh()", MB_OK); //we will get the new adj with the same data hr = subMesh->OptimizeInplace(D3DXMESHOPT_VERTEXCACHE|D3DXMESHOPT_ATTRSORT, adj, adj, 0, 0); if(FAILED(hr)) MessageBox(NULL, "Terrain Failed To OptimizeInplace", "Terrain Class buildSubGridMesh()", MB_OK); //delete[] adj;move we need them for pmesh generation ID3DXBuffer* errors = 0; hr = D3DXCleanMesh(D3DXCLEAN_SIMPLIFICATION,//D3DXCLEANTYPE CleanType, subMesh, adj,//CONST DWORD * pAdjacencyIn, &subMesh,//LPD3DXMESH * ppMeshOut, adj,//DWORD * pAdjacencyOut, &errors);//LPD3DXBUFFER * ppErrorsAndWarnings if(errors) MessageBox(0, (char*)errors->GetBufferPointer(), 0, 0); LPD3DXPMESH pPMesh; //D3DXATTRIBUTEWEIGHTS w; //ok we now want a progressive mesh so we can set the lod when viewing far away //so we need the mesh for now then we must release it hr = D3DXGeneratePMesh(subMesh,//the subgrid mesh we just created LPD3DXMESH pMesh, adj,//same we did CONST DWORD * pAdjacency, NULL,//use defaults CONST D3DXATTRIBUTEWEIGHTS * pVertexAttributeWeights, NULL,//CONST FLOAT * pVertexWeights, 1,//DWORD MinValue, D3DXMESHSIMP_FACE,//scale by face DWORD Options, &pPMesh);//LPD3DXPMESH * ppPMesh if(FAILED(hr)) MessageBox(NULL, "Failed to Generate PMesh", "Terrain Class buildSubGridMesh()", MB_OK); if(subcount-1 == 0) { //see what levels we can set sprintf_s(buff, MAX_PATH, "SubMesh[%d] Face LOD Min = %d, Max = %d", (subcount -1),pPMesh->GetMinFaces(), pPMesh->GetMaxFaces() ); ErrorReport.AddErrorMessage(buff, false); }