Specific question about model animation in ZDoom

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
Mechie
Posts: 1
Joined: Fri Oct 12, 2018 2:48 am

Specific question about model animation in ZDoom

Post by Mechie »

Hello forum members,

i recently found out, that there is a VR-version of ZDooM. With it come a pk3 file with 3D modeled weapons. These models do fit very well. But i want a better quality of these weapons and modeled my own (It's for testing purposes for now). I had no problem to put it into the game. The only problem i have are the animations.

I made 3 keyframes in 3DS-Max and exported the model with keyframes to a md3-file. So, as far as i understand: to get the animations right, i have to put the keyframes in the *.def file.

Syntax would be: FrameIndex XXXX A 0 0

My question is: Where i do get all the information about the name of the FrameIndex? Where is it stored in? All i have is an animated 3D-model from 3DS-Max.

I tried out some possibilities. e.g.

FrameIndex GUNS A 0 0
FrameIndex GUNS B 0 1
FrameIndex GUNS C 0 16

or

FrameIndex GUNS A 0 0
FrameIndex GUNS B 0 1
.
.
.
FrameIndex GUNS Q 0 16

But nothing works.

I searched the internet to death and found nowhere a solution to this question. All users seems to have these FrameIndex information already. But from where?

So i would be very glad if someone can help me out. Thanks a lot in advance!

Mechie
TheSeventh
Posts: 15
Joined: Wed Oct 24, 2018 9:04 am
Location: +NOGRAVY

Re: Specific question about model animation in ZDoom

Post by TheSeventh »

I'm kind of new to the whole modelling gig and I use blender but I've been working solely with models I've been importing into gzdoom so I hope I can help.
With the models I've made I saved every keyframe back-to-back from 0 to as many frames of animation as I need. So for instance I save a different stage of animation on each of six keyframes (0-5) my ModelDef would look like this:

Code: Select all

Model Zombie(Actor name in Decorate or Class name in ZScript)
{
	Path "models"(My model subfolder of choice)
	Model 0 "Zombie.md3"(An example md3)
	Skin 0 "Zombie.png"(It's skin)
	
	FrameIndex FRAM A 0 0
	FrameIndex FRAM B 0 1
	FrameIndex FRAM C 0 2
	FrameIndex FRAM D 0 3
	FrameIndex FRAM E 0 4
	FrameIndex FRAM F 0 5

}
The sprite lump FRAM is a dummy sprite that doesn't exist that I use in my model-only actors in decorate.
If you don't mind can you post an example model? Even if it's 3ds-max I think I can still import it into blender to look at the keyframes.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Specific question about model animation in ZDoom

Post by Enjay »

In GZDoom, models need to be attached to an actor coded with traditional sprite frame references in DECORATE or ZScript. The modeldef file maps the different frames of the model to the sprites in the underlying actor and the game shows the model in place of those frames.

So, to look at what you typed earlier:

FrameIndex XXXX A 0 0

FrameIndex is used to let GZDoom know that you are going to use the index number of a frame in the model instead of a frame name. As far as I know, the only supported models that use frame names are MD2 models. So, if you are using MD3 models, FrameIndex is correct for you.

XXXX is the sprite name of the underling [wiki]Sprite[/wiki] for that frame.
A sprite has an identifying name that is exactly 4 characters long.

The "A" is which particular frame of the sprite is being mapped (more on that later).

The first 0 is the index of the model being used. GZDoom can allocate up to 4 models per actor frame. If you are only using 1 model, then the model index would normally be set at 0.

The final number is which frame within the model file is being mapped to that sprite. It's as simple as the first frame of animation inside the model file is frame 0, the next 1, the next 2 and so on.

So, with an actor such as the zombieman: [wiki]Classes:ZombieMan[/wiki] it has an spawn sequence like this (in old fashioned DECORATE):

Code: Select all

  Spawn:
    POSS AB 10 A_Look
    Loop
So, it uses sprites called POSS and the spawn sequnce uses frames A and B. Mapping that to a model might look something like:

Code: Select all

Model Zombieman
{
   Path "models"
   Model 0 "Zombie.md3"
   Skin 0 "Zombie.png"
   
   FrameIndex POSS A 0 0
   FrameIndex POSS B 0 1
}
I assume that you have already found the modeldef page but, just in case: [wiki]MODELDEF[/wiki]
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Specific question about model animation in ZDoom

Post by Enjay »

Meh! I decided to throw a quick example together.

Load up the PK3, go into the second room and press [use] in front of the treasure chest to open and close it.

Then, if you like, go into the PK3 and delete or rename the modeldef to something else then re-play the map and you'll see the underlying sprite-based actor instead of the model.

http://www.aspectsweb.co.uk/enjay/doom/ ... PChest.pk3

[not sure where the model came from originally.]
Post Reply

Return to “Assets (and other stuff)”