Page 1 of 1

Weird MODELDEF behavior with OBJ (or probably FrameIndex)

Posted: Mon Jun 10, 2019 3:50 am
by boris
So I'm in the process of adding OBJ support to GZDB-BF, and I noticed that OBJ models are handled in an weird (and as I understand incorrect way).

As a test case I used Spooktober, which has a table made ob OBJ models. The table is made from two OBJs, one for the legs, one for the top of the table. The MODELDEF looks like this:

Code: Select all

Model "SchoolTable"
{
	Path "models/flow"
	Model 0 "table1.obj"
	Model 1 "table2.obj"
	Skin 0 "FLOWTEX9"
	Skin 1 "FLOWTEXA"
	Scale 0.5 0.5 0.6
	FrameIndex TABL A 0 0
	FrameIndex TABL A 0 1
}
So, according to the FrameIndex lines it uses Frame 0 and 1 of model 0, which doesn't make sense. However, it works fine in-game. I played around a bit with FrameIndex, and it looks like it's completely irrelevant what you set as model and frame, it always displays all specified models. Even if try to use different models for different frames it will always display all models.

I made a bare-bones example (see attachment) that displays the whole table, even though the FrameIndex line doesn't make sense whatsoever:

Code: Select all

Model SchoolTable
{
	Model 0 "models/table1.obj"
	Model 1 "models/table2.obj"
	Skin 0 "FLOWTEX9"
	Skin 1 "FLOWTEXA"
	Scale 0.5 0.5 0.6
	FrameIndex STIM A 3 -894898
	//FrameIndex STIM A 0 12
}
So model 0 and 1 are defined, FrameIndex says to display frame -894898 of model 3... and it displays model 0 and 1 in-game.

Re: Weird MODELDEF behavior with OBJ (or probably FrameIndex

Posted: Mon Jun 10, 2019 10:55 am
by Cherno
The wiki entry for MODELDEF sems to be incorrect regarding the option to "turn off" a model for certain actor frames if the model's frame is -1. I noticed that before and it makes things like guns that should only show a muzzleflash sub-model for one frame a hassle because you have to have two MODELDEF entries for that (one with all frames without the muzzleflash, one for the single frame with the muzzleflash).

[MD3] Using "-1" for model frame numbers to hide them

Re: Weird MODELDEF behavior with OBJ (or probably FrameIndex

Posted: Tue Jun 11, 2019 8:52 am
by boris
Well,

Code: Select all

Model SchoolTable
{
   Model 0 "models/table1.obj"
   Model 1 "models/table2.obj"
   Skin 0 "FLOWTEX9"
   Skin 1 "FLOWTEXA"
   Scale 0.5 0.5 0.6
   FrameIndex STIM A 0 -1
   FrameIndex STIM A 1 0
}
still renders both models for me.

Re: Weird MODELDEF behavior with OBJ (or probably FrameIndex

Posted: Wed Jun 12, 2019 3:08 am
by Marisa the Magician
Ah, that was a typo from my part it seems. I was meant to set the model indices to 0 and 1 but instead I set the frames. (I'm surprised it worked anyway)

Re: Weird MODELDEF behavior with OBJ (or probably FrameIndex

Posted: Wed Jun 12, 2019 1:29 pm
by boris
Marisa Kirisame wrote:(I'm surprised it worked anyway)
Exactly! It just accepts anything you throw at it, it's not even printing out an warning.

Re: Weird MODELDEF behavior with OBJ (or probably FrameIndex

Posted: Fri Aug 09, 2019 1:38 am
by Graf Zahl
Marisa Kirisame wrote:Ah, that was a typo from my part it seems. I was meant to set the model indices to 0 and 1 but instead I set the frames. (I'm surprised it worked anyway)
So what about a fix?

Re: Weird MODELDEF behavior with OBJ (or probably FrameIndex

Posted: Fri Aug 09, 2019 8:24 am
by Major Cooke
He was referring to setting it wrong in Spooktober's MODELDEF file. Talon1024 is the one you want if something with OBJs is broken. He's the one I had to contact when I discovered that the triangle loader was backwards and he fixed it.

Re: Weird MODELDEF behavior with OBJ (or probably FrameIndex

Posted: Fri Aug 09, 2019 1:28 pm
by Marisa the Magician
Yeah, this is user (or modder, more like) error.

The fact that it works despite being incorrect, however... that's another story.