• Advertisement
Sign in to follow this  

Half of my level is out of purportion?

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

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?

Share this post


Link to post
Share on other sites
Advertisement
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).

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Here is my source:


/*
======================================================
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
Looks a bit like you're backface culling the wrong way. Try CULL_NONE just to test.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement