Half of my level is out of purportion?
When I render my Doom III map, half of the level is out of purportion, and the other half is rendered correctlly. Here is what it looks like
Screenshot 1
And this is what it is supposed to look like(ignoring the static meshes):
Correct level screenshot
Ignore the fact that I load a test texture instead of the correct shader.
Any ideas?
Not sure what could be causing it, but it looks as if something is garbling the geometry data. I notice some messed up texture coordinates. It makes me wonder if everything is being loaded in poperly. (But then again, I have never tried loading Doom 3 levels or anything of the like).
i dont have any suggestions unless you post code... but speaking of code, where are you learning the details on the file format? ;-) linky linky?
thanks
-Dan
thanks
-Dan
Here is my source:
Doom 3 Unoffical File Formats
The above link gives you all the various for Doom III except the AAS format, which is the AI helper file.
Everything is being loaded correctlly. Ive debugged the points being added to the final arrays(NormalTexVertex *verts, and WORD *indicies), and they are all correct.
Makes me wonder if Doom III has any type of scaling to do before you render the points?
EDIT:
TExture corrds are probley wrong because the polygons are streched out to much.
/*======================================================void dx9System::RenderPlane(model thisplane);======================================================*/void dx9System::RenderPlane(model thisplane){ int i,a; int texcoordnum = 0; device->SetRenderState(D3DRS_COLORWRITEENABLE, 0xf); if(thisplane.numofsurfaces < 1) sys_error("RenderPlane: Numofsurfaces is invalid for this model\n"); for(a = 0; a<thisplane.numofsurfaces; a++) { IDirect3DVertexBuffer9 *vb; IDirect3DIndexBuffer9 *ib; if(thisplane.mapsurfaces[a].numofverts < 1 || thisplane.mapsurfaces[a].numofindexs < 1) sys_error("RenderPlane: This surface has a illegal number of verts or indexs\n"); device->CreateVertexBuffer(thisplane.mapsurfaces[a].numofverts * sizeof(NormalTexVertex), D3DUSAGE_WRITEONLY,FVF_NORMAL_TEX, D3DPOOL_MANAGED, &vb,0); device->CreateIndexBuffer(thisplane.mapsurfaces[a].numofindexs * sizeof(WORD), D3DUSAGE_WRITEONLY,D3DFMT_INDEX16, D3DPOOL_MANAGED, &ib,0); NormalTexVertex *verts; vb->Lock(0,0,(void **)&verts,0); int c = 0; for(i = 0; i < thisplane.mapsurfaces[a].numofverts; i++) { float trixyz[3]; float oldxyz[3]; if(thisplane.mapsurfaces[a].verts[c] == 0 && thisplane.mapsurfaces[a].verts[c+1] == 0 && thisplane.mapsurfaces[a].verts[c+2] == 0) sys_error("RenderPlane: Invalid triangle found\n"); trixyz[0] = thisplane.mapsurfaces[a].verts[c]; trixyz[1] = thisplane.mapsurfaces[a].verts[c+2]; trixyz[2] = -thisplane.mapsurfaces[a].verts[c+1]; verts = NormalTexVertex(trixyz[0],trixyz[1], trixyz[2], thisplane.mapsurfaces[a].normals[c], thisplane.mapsurfaces[a].normals[c+2], -thisplane.mapsurfaces[a].normals[c+1], thisplane.mapsurfaces[a].texcoords[texcoordnum], thisplane.mapsurfaces[a].texcoords[texcoordnum+1]); texcoordnum += 2; c += 3; } vb->Unlock(); WORD *indicies; ib->Lock(0,0,(void **)&indicies,0); for(i = 0; i< thisplane.mapsurfaces[a].numofindexs; i++) { indicies = thisplane.mapsurfaces[a].indexs; } ib->Unlock(); device->SetTexture(0,testtexture); device->SetStreamSource(0,vb,0,sizeof(NormalTexVertex)); device->SetIndices(ib); device->SetFVF(FVF_NORMAL_TEX); device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,thisplane.mapsurfaces[a].numofverts,0,thisplane.mapsurfaces[a].numofverts / 3); }}
Doom 3 Unoffical File Formats
The above link gives you all the various for Doom III except the AAS format, which is the AI helper file.
Everything is being loaded correctlly. Ive debugged the points being added to the final arrays(NormalTexVertex *verts, and WORD *indicies), and they are all correct.
Makes me wonder if Doom III has any type of scaling to do before you render the points?
EDIT:
TExture corrds are probley wrong because the polygons are streched out to much.
It looks like some triangles are at 504 -288 8 -1.9583332539, when most are only at -100-100, any idea on how to scale them correctlly so they are the same size?
Looks like you have error either in your data as it is read, or your creation of your vertex buffers, (size, count, offset, stride etc). The give away is the funky skewed texture coordinates, and planes appear to span forever.
Also your code above is not near enough complete for anyone to help you. Try posting some more.
Also your code above is not near enough complete for anyone to help you. Try posting some more.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement