|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Archive::Tools Archive area for Tools's posts that were moved here after an inactivity period of 90 days. |
08-10-2004, 11:58 AM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 212
|
|
why so much hate ?
I don't understand why but see my rendered monsters ...
( replaced images by error )
a skeleton :
why do they render so ugly ??? =(
see my code, I tried to follow what's done in zoneconverter :
Code:
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 ? =(
__________________
Sandy
|
08-10-2004, 12:22 PM
|
|
Dragon
|
|
Join Date: Mar 2004
Location: France, Bordeaux.
Posts: 677
|
|
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 ?
__________________
|
08-10-2004, 01:41 PM
|
Demi-God
|
|
Join Date: Jan 2002
Posts: 1,175
|
|
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
|
08-10-2004, 02:07 PM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 212
|
|
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
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 212
|
|
what means that ?
Code:
// 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 ?
__________________
Sandy
|
08-11-2004, 08:27 AM
|
Demi-God
|
|
Join Date: Jan 2002
Posts: 1,175
|
|
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
|
|
|
|
08-12-2004, 01:17 AM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 212
|
|
Code:
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 ...
__________________
Sandy
|
|
|
|
08-12-2004, 08:47 AM
|
Demi-God
|
|
Join Date: Jan 2002
Posts: 1,175
|
|
That's correct. Rotation is cumulative. If you rotate the bicep 30 degrees, the forearm and hand child pieces rotate as well.
Wc
|
08-13-2004, 09:15 AM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 212
|
|
I changed everything and did exactly like you windcatcher, I got some models working :
a chokidai :
a drake :
innoruuk :
but I still have a pb with this skeleton of pure evil and madness !
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 ...
__________________
Sandy
|
08-13-2004, 09:20 AM
|
Demi-God
|
|
Join Date: Jan 2002
Posts: 1,175
|
|
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
|
08-13-2004, 10:41 AM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 212
|
|
so :
z = x, x=-y , y=z ?
and rotations ?
pfff i'm bad with maths =(
__________________
Sandy
|
08-13-2004, 02:04 PM
|
Demi-God
|
|
Join Date: Jan 2002
Posts: 1,175
|
|
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
|
08-13-2004, 02:16 PM
|
Demi-God
|
|
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
|
|
By the way Sandy, the tabs on that window makes it look like a really useful program Can't wait until its done.
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
|
|
|
|
08-13-2004, 03:02 PM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 212
|
|
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 :
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 =)
__________________
Sandy
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 07:27 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|