Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Tools

Archive::Tools Archive area for Tools's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2004, 11:58 AM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default 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
Reply With Quote
  #2  
Old 08-10-2004, 12:22 PM
KhaN's Avatar
KhaN
Dragon
 
Join Date: Mar 2004
Location: France, Bordeaux.
Posts: 677
Default

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 ?
__________________

Reply With Quote
  #3  
Old 08-10-2004, 01:41 PM
Windcatcher
Demi-God
 
Join Date: Jan 2002
Posts: 1,175
Default

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
Reply With Quote
  #4  
Old 08-10-2004, 02:07 PM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

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
Reply With Quote
  #5  
Old 08-11-2004, 12:33 AM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

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
Reply With Quote
  #6  
Old 08-11-2004, 08:27 AM
Windcatcher
Demi-God
 
Join Date: Jan 2002
Posts: 1,175
Default

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
Reply With Quote
  #7  
Old 08-12-2004, 01:17 AM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

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
Reply With Quote
  #8  
Old 08-12-2004, 08:47 AM
Windcatcher
Demi-God
 
Join Date: Jan 2002
Posts: 1,175
Default

That's correct. Rotation is cumulative. If you rotate the bicep 30 degrees, the forearm and hand child pieces rotate as well.

Wc
Reply With Quote
  #9  
Old 08-13-2004, 09:15 AM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

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
Reply With Quote
  #10  
Old 08-13-2004, 09:20 AM
Windcatcher
Demi-God
 
Join Date: Jan 2002
Posts: 1,175
Default

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
Reply With Quote
  #11  
Old 08-13-2004, 10:41 AM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

so :
z = x, x=-y , y=z ?

and rotations ?

pfff i'm bad with maths =(
__________________
Sandy
Reply With Quote
  #12  
Old 08-13-2004, 02:04 PM
Windcatcher
Demi-God
 
Join Date: Jan 2002
Posts: 1,175
Default

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
Reply With Quote
  #13  
Old 08-13-2004, 02:16 PM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

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.
Reply With Quote
  #14  
Old 08-13-2004, 03:02 PM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

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&lt;meshes.GetSize(); i++ )
	{
		Data36* mesh = meshes.GetAt(i);

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

		// builds the vertex buffers

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

		int polygoncount = 0;

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

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

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

			for ( k=0; k&lt;mesh->PolygonTexEntries[j][0]; k++ )
			{
				for ( int numvertex=1; numvertex&lt;=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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:27 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3