Log in

View Full Version : why so much hate ?


sandy
08-10-2004, 11:58 AM
I don't understand why but see my rendered monsters ...

( replaced images by error )

a skeleton :

http://www.projecteq.net/files/sandy/skelette.jpg

why do they render so ugly ??? =(

see my code, I tried to follow what's done in zoneconverter :


float off_x = shift_x;
float off_y = shift_y;
float off_z = shift_z;

RotateX( parent->rot_x, off_x, off_y, off_z );
RotateY( parent->rot_y, off_x, off_y, off_z );
RotateZ( parent->rot_z, off_x, off_y, off_z );

pos_x = parent->pos_x + off_x;
pos_y = parent->pos_y + off_y;
pos_z = parent->pos_z + off_z;

rot_x = parent->rot_x + rota_x;
rot_y = parent->rot_y + rota_y;
rot_z = parent->rot_z + rota_z;

D3DXMatrixTranslation(&matTranslation, pos_x, pos_z, pos_y );
D3DXMatrixRotationYawPitchRoll(&matRotation, -rot_z, rot_x, rot_y );

matWorld = matRotation * matTranslation;


do you see something wrong ? =(

KhaN
08-10-2004, 12:22 PM
LMAO, your chokidai is soooo Evil.
Btw, how many peoples are working on a model viewer ? :/ Or your still working on what you told me like 2 months ago Sandy ?

Windcatcher
08-10-2004, 01:41 PM
How does DZoneConverter render them? I know for a fact that there are many models that it can't render properly, especially the newer ones...I simply haven't figured out every nuance of model rendering yet.

WC

sandy
08-10-2004, 02:07 PM
i m not working on a model viewer but just a new server editing tool =) ...

in dzoneconverter it loads and displays these models very nicely =(

sandy
08-11-2004, 12:33 AM
what means that ?

// Rotate the offsets using the incoming angle

RotateX(XAngle,XOfs1,YOfs1,ZOfs1);
RotateY(YAngle,XOfs1,YOfs1,ZOfs1);
RotateZ(ZAngle,XOfs1,YOfs1,ZOfs1);

{
RotateZ(ZAngle,XOfs1,YOfs1,ZOfs1);
RotateY(YAngle,XOfs1,YOfs1,ZOfs1);
RotateX(XAngle,XOfs1,YOfs1,ZOfs1);
}

{ } is commentary ?

Windcatcher
08-11-2004, 08:27 AM
Yeah, in Delphi there are three different kinds of remarks:

// for single line remarks

{ for multi-line remarks }

(* for multi-line remarks that can enclose the brace kind {} *)

I was experimenting with different orders of rotation to try to figure out why many of the newer models won't display properly. You should use the X,Y,Z rotation order for your renderer.

WC

sandy
08-12-2004, 01:17 AM
If (D12.Flags And 8) <> 0 Then
Begin
If D12.Data4[FrameNum].RotateDenominator <> 0 Then
Begin
XAng := XAng - (Pi / 2) * D12.Data4[FrameNum].RotateXNumerator / D12.Data4[FrameNum].RotateDenominator;
YAng := YAng - (Pi / 2) * D12.Data4[FrameNum].RotateYNumerator / D12.Data4[FrameNum].RotateDenominator;
ZAng := ZAng - (Pi / 2) * D12.Data4[FrameNum].RotateZNumerator / D12.Data4[FrameNum].RotateDenominator;
End;
End
Else
Begin
If D12.Data8[FrameNum].RotateDenominator <> 0 Then
Begin
XAng := XAng - (Pi / 2) * D12.Data8[FrameNum].RotateXNumerator / D12.Data8[FrameNum].RotateDenominator;
YAng := YAng - (Pi / 2) * D12.Data8[FrameNum].RotateYNumerator / D12.Data8[FrameNum].RotateDenominator;
ZAng := ZAng - (Pi / 2) * D12.Data8[FrameNum].RotateZNumerator / D12.Data8[FrameNum].RotateDenominator;
End
End;


each piece rotation angle must be substracted or added to the parent piece rotation angle ?
I'm confused ...

Windcatcher
08-12-2004, 08:47 AM
That's correct. Rotation is cumulative. If you rotate the bicep 30 degrees, the forearm and hand child pieces rotate as well.

Wc

sandy
08-13-2004, 09:15 AM
I changed everything and did exactly like you windcatcher, I got some models working :

a chokidai :

http://www.projecteq.net/files/sandy/chokidai.jpg

a drake :

http://www.projecteq.net/files/sandy/drake.jpg

innoruuk :

http://www.projecteq.net/files/sandy/innoruuk.jpg

but I still have a pb with this skeleton of pure evil and madness !

http://www.projecteq.net/files/sandy/skeleton.jpg

I had to change some little things to get the 1rst one working,maybe it s because we don't use the same (x,y,z) ???
my z goes in the deep direction, y goes vertically up and x goes horizontally in the right direction ...

Windcatcher
08-13-2004, 09:20 AM
WLD files have X=north/south, Y=east/west, and Z=up/down. X increases towards north and Y increases towards west. It's what's called a right-handed coordinage system, which means this: take your right hand. Extend your index finger out from your arm like you're pointing. This is the X axis. Extend your middle finger so that it points to your left. That's the Y axis. Extend your thumb up at the ceiling. That's the Z axis.

Hope this helps,

WC

sandy
08-13-2004, 10:41 AM
so :
z = x, x=-y , y=z ?

and rotations ?

pfff i'm bad with maths =(

Windcatcher
08-13-2004, 02:04 PM
It sounds like you need to exchange Y and Z after you do all the math and you're ready to render, but I'm guessing since I don't know what you're using to render. Another possibility is that your Z is the negative of my Y coordinate. You should only do the coordinate transofrmation as the final step for rendering.

WC

Cisyouc
08-13-2004, 02:16 PM
By the way Sandy, the tabs on that window makes it look like a really useful program :D Can't wait until its done.

sandy
08-13-2004, 03:02 PM
to render it seems close to opengl except I have to create a vertex buffer for each texture group of polygons instead of creating a model

here's the code :

// build the vertex buffers corresponding to each mesh

ppVBs = new LPDIRECT3DVERTEXBUFFER9 * [meshes.GetSize()];

for ( i=0; i<meshes.GetSize(); i++ )
{
Data36* mesh = meshes.GetAt(i);

// precalculate the scale of the mesh
float scale = (float)(1<<mesh->Scale);

// builds the vertex buffers

ppVBs[i] = new LPDIRECT3DVERTEXBUFFER9 [ mesh->PolygonTexCount ];

int polygoncount = 0;

for ( j=0; j<mesh->PolygonTexCount; j++ )
{
int nbvertex = mesh->PolygonTexEntries[j][0] * 3;

if( FAILED ( pd3dDevice->CreateVertexBuffer(
nbvertex * sizeof ( MODELVERTEX ),
D3DUSAGE_WRITEONLY, D3DFVF_MODELVERTEX,
D3DPOOL_DEFAULT, &ppVBs[i][j] , NULL ) ) )
return E_FAIL;

MODELVERTEX * pVertex;
ppVBs[i][j]->Lock( 0, 0, ( void * * ) & pVertex , 0 );

for ( k=0; k<mesh->PolygonTexEntries[j][0]; k++ )
{
for ( int numvertex=1; numvertex<=3; numvertex++ )
{

int vertexindex = mesh->PolygonEntries[polygoncount][numvertex];

// get the unajusted vertices
float x = mesh->CenterX + mesh->VertexEntries[vertexindex][0]/scale;
float y = mesh->CenterY + mesh->VertexEntries[vertexindex][1]/scale;
float z = mesh->CenterZ + mesh->VertexEntries[vertexindex][2]/scale;

// get the index of the piece that contains this vertex
int pieceindex = GetPieceIndex( mesh, vertexindex );

// rotate the unajusted vertices
RotateX( pieces[pieceindex].XAng, x, y, z );
RotateY( pieces[pieceindex].YAng, x, y, z );
RotateZ( pieces[pieceindex].ZAng, x, y, z );


// add the position of the piece
pVertex->x = x + pieces[pieceindex].XOfs;
pVertex->y = y + pieces[pieceindex].YOfs;
pVertex->z = z + pieces[pieceindex].ZOfs;

pVertex->nx = mesh->VertexNormalEntries[vertexindex][0]/127.0f;
pVertex->ny = mesh->VertexNormalEntries[vertexindex][0]/127.0f;
pVertex->nz = mesh->VertexNormalEntries[vertexindex][0]/127.0f;
pVertex->color = 0xffffffff;
pVertex->u1 = mesh->TextureCoordEntries_w[vertexindex][0]/256.0f;
pVertex->v1 = mesh->TextureCoordEntries_w[vertexindex][1]/256.0f;

pVertex ++;

}

polygoncount++;

}

ppVBs[i][j]->Unlock();

}

}

I followed exactly what you have done in dzoneconverter =)