Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Tutorial Request MD3 and attachment support Goto page 1, 2 Next

| Inside3d Forums Forum Index -> Programming Tutorials

View previous topic :: View next topic
Author | Message
--- | ---
ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Mon Dec 14, 2009 8:03 pm Post subject: Tutorial Request MD3 and attachment support |

Iv found tutorials for implementing md2's but not md3's i was wondering if anyone would be kind enough to make up a tutorial for it. id be extremely appreciative if who did would. thanks for if anyone does! _________________ QuakeDB - Quake ModDB Group

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Tue Dec 15, 2009 2:57 am Post subject: Re: Tutorial Request MD3 and attachment support |

ceriux wrote:
Iv found tutorials for implementing md2's but not md3's i was wondering if anyone would be kind enough to make up a tutorial for it. id be extremely appreciative if who did would. thanks for if anyone does!

Depending on how things go, this could happen this week.
And if not this week, it is an automatic for by the end of the year.
By the way, do have any links for the md2 implementation? I know MH has a mostly written tutorial for md2, but I'd just like to lazily assess where the changes are while trying to wrap up a few things this week.

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Tue Dec 15, 2009 3:13 am Post subject: |

this is the only one i know of. http://www.quake-1.com/docs/quakesrc.org/98.html _________________ QuakeDB - Quake ModDB Group

Back to top |

Downsider Joined: 16 Sep 2008 Posts: 478 |

Posted: Tue Dec 15, 2009 3:59 pm Post subject: |

Wouldn't implementing some kind of MD3 tagging require a change to Quake's protocol?

Back to top |

mh Joined: 12 Jan 2008 Posts: 909 |

Posted: Tue Dec 15, 2009 7:05 pm Post subject: Re: Tutorial Request MD3 and attachment support |

Baker wrote:
I know MH has a mostly written tutorial for md2.

That reminds me, I need to drag that one out from wherever I've hidden it, finalize it and post it.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines

Back to top |

reckless Joined: 24 Jan 2008 Posts: 390 Location: inside tha debugger |

Posted: Wed Dec 16, 2009 4:03 am Post subject: |

i had one in the tutorial discussion section on quakesrc once but after the site went down most got lost so might be hard recovering. i still have the engine i fiddled with back then but its an older version and doesnt have shadows implemented yet (later version had) and is based on code from dr labman where the new one was based of harvens md3 code.
ill see if i can polish it up to the code i posted back then.

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Wed Dec 23, 2009 7:48 am Post subject: |

any updates? sorry i leave around the first of the year so =/ i been gettin kinda blah about stuff lol... -.- i can make visual content for engine tutorial trade =D _________________ QuakeDB - Quake ModDB Group

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Wed Dec 23, 2009 8:02 am Post subject: |

Well ... I'm working on the Universal Servers project at the moment (amazing stuff!) ... but let me see what I can do. It won't have attachment support, that's an extension --- someone else will have to add their 2 cents in on how to best achieve attachment support. And it'll be standard single model md3 ... no torso, legs, head stuff.
Let me quickly assess how long it would take to write up the md3 tutorial and build a test GLQuake .... if it will take approximately an hour or less I'll do it right now ...

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Wed Dec 23, 2009 8:04 am Post subject: |

oh dont rush yourself. like i said im leaving around the first of the year. my needs arnt that important as to those of the entire community! _________________ QuakeDB - Quake ModDB Group

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Wed Dec 23, 2009 8:20 am Post subject: |

ceriux wrote:
oh dont rush yourself. like i said im leaving around the first of the year. my needs arnt that important as to those of the entire community!

Changes are located in almost exclusively:
gl_model.h
gl_model.c
gl_rmain.c
Ah, it'd be funny to add md3 support into crusty old GLQuake just for fun and doesn't look too hard. I think I'll do it now just because it'd be funny.

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Wed Dec 23, 2009 9:14 am Post subject: |

Planning .... 1) Will need to check for md3 vs. mdl format header on load 2) Mark such models 3) Load their textures; they are 24 bit. Have the textures loaded from the progs folder like DarkPlaces does it. The default GLQuake 8-bit texture extension cannot be used; software renderer is 8-bit (WinQuake) can't be used [I wonder if FTEQW's 24-bit software render does Q3 models? Hmmm]
4) When drawing all the entities, handle md3 separately
5) The code to render and light the md3 models.

Back to top |

reckless Joined: 24 Jan 2008 Posts: 390 Location: inside tha debugger |

Posted: Wed Dec 23, 2009 9:30 am Post subject: |

on it still takes a while though i had made some very massive changes to get shadows etc. to work on the new code i started out having two different rendering sections one that handled nor mal mdl and one for md3 the latter code had all this wrapped up in the same function (was pretty messy before) .
hmm with csqc this could become very interresting indeed

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Wed Dec 30, 2009 11:36 am Post subject: Part 1 |

Part 1 ... revision possible ... modelling after JoeQuake and the Qrack implementation 1a. gl_model.h Add mod_md3 to the model types ...

Quote:
typedef enum {mod_brush, mod_sprite, mod_alias, mod_md3} modtype_t;

1b. Locate the following ...

Code:
// // Whole model //

And insert the Q3 model header declarations before ...

Code:
//=================================================================== /* ============================================================================== Q3 MODELS ==============================================================================
*/
typedef struct
{
int ident;
int version;
char name[MAX_QPATH];
int flags;
int numframes;
int numtags;
int numsurfs;
int numskins;
int ofsframes;
int ofstags;
int ofssurfs;
int ofsend;
} md3header_t;
typedef struct
{
vec3_t mins, maxs;
vec3_t pos;
float radius;
char name[16];
} md3frame_t;
typedef struct
{
char name[MAX_QPATH];
vec3_t pos;
vec3_t rot[3];
} md3tag_t;
typedef struct
{
int ident;
char name[MAX_QPATH];
int flags;
int numframes;
int numshaders;
int numverts;
int numtris;
int ofstris;
int ofsshaders;
int ofstc;
int ofsverts;
int ofsend;
} md3surface_t;
typedef struct
{
char name[MAX_QPATH];
int index;
} md3shader_t;
typedef struct
{
char name[MAX_QPATH];
int index;
int gl_texnum, fb_texnum;
} md3shader_mem_t;
typedef struct
{
int indexes[3];
} md3triangle_t;
typedef struct
{
float s, t;
} md3tc_t;
typedef struct
{
short vec[3];
unsigned short normal;
} md3vert_t;
typedef struct
{
vec3_t vec;
vec3_t normal;
byte anorm_pitch, anorm_yaw;
unsigned short oldnormal; // needed for normal lighting
} md3vert_mem_t;
#define MD3_XYZ_SCALE (1.0 / 64)
#define MAXMD3FRAMES 1024
#define MAXMD3TAGS 16
#define MAXMD3SURFS 32
#define MAXMD3SHADERS 256
#define MAXMD3VERTS 4096
#define MAXMD3TRIS 8192
typedef struct animdata_s
{
int offset;
int num_frames;
int loop_frames;
float interval;
} animdata_t;

1c. Locate and add the yellow, allowing us to know the type of alias model loaded ...

Quote:
typedef struct model_s { char name[MAX_QPATH]; qboolean needload; // bmodels and sprites don't cache normally modtype_t type;
int aliastype; // Alternate model format support
int numframes;
synctype_t synctype;
int flags;
//
// volume occupied by the model graphics
//
vec3_t mins, maxs;

Remainder of the tutorial will follow as time permits.

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Wed Dec 30, 2009 1:34 pm Post subject: Part 2 |

Continued ... all subject to revision: 2a. gl_rmain.c In R_DrawEntitiesOnList we need to check for MD3 ...

Quote:
// draw sprites seperately, because of alpha blending for (i=0 ; i<cl_numvisedicts ; i++) { currententity = cl_visedicts[i]; switch (currententity->model->type)
{
case mod_alias:
R_DrawAliasModel (currententity);
break;
case mod_md3:
R_DrawQ3Model (currententity);
break;
case mod_brush:
R_DrawBrushModel (currententity);
break;
default:
break;
}
}

2b. Likewise for the view model (R_DrawViewModel), we need to check for MD3 ...

Quote:
// hack the depth range to prevent view model from poking into walls glDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin)); switch (currententity->model->type) { case mod_alias:
R_DrawAliasModel (currententity);
break;
case mod_md3:
R_DrawQ3Model (currententity);
break;
}
glDepthRange (gldepthmin, gldepthmax);

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Wed Dec 30, 2009 7:16 pm Post subject: |

baker all of this is for MD3 support without attachments? _________________ QuakeDB - Quake ModDB Group

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> Programming Tutorials | All times are GMT Goto page 1, 2 Next
Page 1 of 2

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group