[Added] [GZDoom] SurfaceSkin property for MODELDEF

Moderator: GZDoom Developers

[GZDoom] SurfaceSkin property for MODELDEF

Postby StrikerMan780 » Fri Jul 15, 2016 9:24 pm

I've added a feature to GZDoom that I feel has been much needed for a long time. The ability to manipulate and override per-surface skins in MD3 files. Before, you were restricted to whatever textures that were defined in the file, but now, you can change the skins at will. This allows doing things such as alternate skins and texture animation on multi-skinned MD3s without needing to duplicate (thus bloating size) or split the model (which can only work if your model has 4 or fewer surfaces/parts).

The pull request, and more information is here: https://github.com/coelckers/gzdoom/pull/58

I would have put this on the GZDoom forum, but the feature requests board is locked.

EDIT: Here's a test build with a test PK3 demonstrating what this can do. http://www.mediafire.com/download/c299r ... n_Test.zip
Last edited by StrikerMan780 on Fri Jul 15, 2016 11:37 pm, edited 1 time in total.
StrikerMan780
 
Joined: 29 Nov 2005
Location: In a dead-end shithole.
Discord: StrikerTheHedgefox#6299

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby NeuralStunner » Fri Jul 15, 2016 9:36 pm

I can see this being super-useful. ("Baking" the texture paths into the model file is pretty limiting.)

As an aside:
StrikerMan780 wrote:or split the model (which can only work if your model has 4 or fewer surfaces/parts).
You could still use multiple definitions and bind to other frames, couldn't you?
The Wiki wrote:While you are limited to using 4 model 'pieces' in each definition, you can re-define the same actor again to add more. This way, you are not limited to any given skin animation length, or by the number of model parts.
User avatar
NeuralStunner
Cuddly but Packin'
 
 
 
Joined: 21 Jul 2009
Location: Indiana, USA
Discord: NeuralStunner#1293
Operating System: Windows Vista/7 64-bit

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby StrikerMan780 » Fri Jul 15, 2016 9:55 pm

NeuralStunner wrote:I can see this being super-useful. ("Baking" the texture paths into the model file is pretty limiting.)

Extremely so, and that's why I am implementing this.

NeuralStunner wrote:As an aside:
StrikerMan780 wrote:or split the model (which can only work if your model has 4 or fewer surfaces/parts).
You could still use multiple definitions and bind to other frames, couldn't you?
The Wiki wrote:While you are limited to using 4 model 'pieces' in each definition, you can re-define the same actor again to add more. This way, you are not limited to any given skin animation length, or by the number of model parts.

Still only 4 models/parts per frame though, as far as I last tested. Then again, it's been a while. Either way, this makes things far more convenient, and less copypasta-spammy.
Last edited by StrikerMan780 on Fri Jul 15, 2016 11:40 pm, edited 1 time in total.
StrikerMan780
 
Joined: 29 Nov 2005
Location: In a dead-end shithole.
Discord: StrikerTheHedgefox#6299

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby Nash » Fri Jul 15, 2016 11:39 pm

Wow, very useful indeed! I've always thought it was a better idea to be able define all of the surfaces inside the MODELDEF, rather than during export-time in Blender (or - ugh - fixing it with npherno's MD3 tool). I really hope this gets added!

Also, Striker, this is just an inquiry - would it be possible to add a command to change the textures during run-time via either DECORATE or ACS? I've always wanted to toy around the idea of monsters with detachable limbs... via texturing (if the arm is cut off, replace the texture of just the arm polygons with a transparent variant so it "looks" like the arm has been cut off).
Last edited by Nash on Fri Jul 15, 2016 11:42 pm, edited 2 times in total.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby StrikerMan780 » Fri Jul 15, 2016 11:41 pm

I wouldn't know where to begin to do that unfortunately. Kind of beyond the scope of what I've done so far.

However, next I will implement being able to define RenderStyle overrides for surfaces. (Allowing one part to be opaque, while the other is additive translucent, for example.)
Last edited by StrikerMan780 on Fri Jul 15, 2016 11:44 pm, edited 2 times in total.
StrikerMan780
 
Joined: 29 Nov 2005
Location: In a dead-end shithole.
Discord: StrikerTheHedgefox#6299

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby Nash » Fri Jul 15, 2016 11:42 pm

Question pertaining to OP feature... how do you know what "number" a surface/mesh group is?
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby StrikerMan780 » Fri Jul 15, 2016 11:44 pm

Nash wrote:Question pertaining to OP feature... how do you know what "number" a surface/mesh group is?

You can tell by looking at the order they appear in, using a tool like Misfit Modeler, Milkshape, NPherno's MD3 Tool, etc... or just by trial and error.

By the way, I have an edit of Misfit Modeler 3D that raises the limit to how many polys/vertexes are allowed per group, allowing one to work with ports of high poly models.

Here it is: http://shadowmavericks.com/files/Apps/m ... removed.7z

Hope it helps.
StrikerMan780
 
Joined: 29 Nov 2005
Location: In a dead-end shithole.
Discord: StrikerTheHedgefox#6299

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby Graf Zahl » Sat Jul 16, 2016 1:20 am

One question:

Surfaceskin uses a full path to it's skin, instead of using the "path" property, this is for ease of use, and falls in line with how skins are defined in the MD3 format itself.


Is it really necessary to do this differently than anything else in the MODELDEF file?
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby StrikerMan780 » Sat Jul 16, 2016 1:32 am

This:
Code: Select allExpand view
Model Pistol
{
   Path "Models\HUD\BFG10K"
   Model 0 "BFG10K.md3"
   SurfaceSkin 0 0 "Models\HUD\BFG10K\BFG10k.png"
   SurfaceSkin 0 1 "Textures\SHLDGRN.png"
   
   Scale -5.0 3.5 5.0
   ZOffset -6

   FrameIndex PISG A 0 0
}

Model Pistol
{
   Path "Models\HUD\BFG10K"
   Model 0 "BFG10K.md3"
   SurfaceSkin 0 0 "Models\HUD\BFG10K\BFG10k.png"
   SurfaceSkin 0 1 "Textures\PLASBLUE.png"
   
   Scale -5.0 3.5 5.0
   ZOffset -6

   FrameIndex PISG B 0 0
   FrameIndex PISG C 0 0
}


Is better than doing this if the textures are in different places:
Code: Select allExpand view
Model Pistol
{
   Path "Models\HUD\BFG10K"
   Model 0 "BFG10K.md3"

   Path "Models\HUD\BFG10K"
   SurfaceSkin 0 0 "BFG10k.png"
   Path "Textures"
   SurfaceSkin 0 1 "SHLDGRN.png"
   
   Scale -5.0 3.5 5.0
   ZOffset -6

   FrameIndex PISG A 0 0
}

Now imagine that last one if there were 10 different surfaces in a model?

To be honest, I dunno why MODELDEF didn't allow putting the path directly in properties such as "skin" and "model" to begin with. Not nearly as messy that way. (If you'd like, I can implement that for model and skin, while still keeping compatibility with the old way. Unless, it's already possible and I wasn't aware, in that case I'll change surfaceskin to take both.)
StrikerMan780
 
Joined: 29 Nov 2005
Location: In a dead-end shithole.
Discord: StrikerTheHedgefox#6299

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby Graf Zahl » Sat Jul 16, 2016 2:00 am

I think the better course of action would be to define proper semantics for all cases, not implement different ways to specify the properties, i.e., if no path is set, always use the root as a base, otherwise use the path.

The reason this was added is that in most cases, models and skins are grouped in the same directory so it'd save some typing.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby StrikerMan780 » Sat Jul 16, 2016 2:04 am

After taking a closer look, it seems if you exclude Path from your model definition, all properties can take absolute paths already. Tested it, and it works. Perhaps this should be said on the Wiki.

I'll update my pull request, and put path.GetChars() on the loadskin line so it's like the rest.

EDIT: Done. Should be good to go now.
StrikerMan780
 
Joined: 29 Nov 2005
Location: In a dead-end shithole.
Discord: StrikerTheHedgefox#6299

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby Graf Zahl » Sat Jul 16, 2016 2:24 am

Yeah, I expected so. Yes, this should be clearly stated on the Wiki.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [GZDoom] SurfaceSkin property for MODELDEF

Postby StrikerMan780 » Sat Jul 16, 2016 2:40 pm

Updated the Wiki with the SurfaceSkin syntax.
StrikerMan780
 
Joined: 29 Nov 2005
Location: In a dead-end shithole.
Discord: StrikerTheHedgefox#6299


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest