Page 1 of 3

3d models skins

Posted: Fri Dec 25, 2020 7:38 pm
by JeremyaFr
UPDATE

Hello,
I've updated the 32bpp hook.

There is a new feature: Skins.
With skins, you can customize the appearence of the 3d models.

Suppose that the craft is "FlightModels\[Model].opt".
To create a skin named "[Skin1]", create a folder named "FlightModels\Skins\[Model]\[Skin1]\".
To replace a texture, place it in the skins folder with the same name and dimensions of the original texture.
The supported image formats are bmp, png, jpg. Use the png format to get transparency.
See "Skins\XWing\Default\Tex00033.png" for an example for the vanilla X-Wing.

Suppose that the mission is "[MissionDir]\[Mission].tie".
To define a skin for a craft, create a file named "[MissionDir]\[Mission]_Skins.txt" or create a section named "[Skins]" in "[MissionDir]\[Mission].ini".
The format is
CraftOptName = SkinNameA, SkinNameB
CraftOptName_fg_# = SkinName1, SkinName2, SkinName3
# in CraftOptName_fg_# is an integer for the opt color marking index, starting at 0.
The default SkinName is "Default".
See "Skins.txt"

Re: 3d models skins

Posted: Fri Dec 25, 2020 7:58 pm
by Vince T
This is a historic day! This new function revolutionizes the way we can create FG colors!

So far we were limited to the FG colors that the authors had baked into the OPTs. Not only did this limit creativity it also bloated up the filesize of the individual OPTs (*cough* VSD, ISD2 *cough*)
Now if you want a ship that is worn AND has certain markings you can just add both of these skins (if available) ontop and you're done :)

Great work Jeremy!

Re: 3d models skins

Posted: Fri Dec 25, 2020 8:24 pm
by JeremyaFr
Thanks
and thank you Forceflow for having the idea.

Re: 3d models skins

Posted: Fri Dec 25, 2020 8:37 pm
by Forceflow
JeremyaFr wrote:
Fri Dec 25, 2020 8:24 pm
Thanks
and thank you Forceflow for having the idea.
:D just really glad it was possible to do at all! Many thanks for getting it up and run into. Cannot wait what the guys will come up with using the new hook.

Re: 3d models skins

Posted: Sat Dec 26, 2020 12:54 pm
by Vince T
Here's a little peak of what this could mean...

A VSD with the New Republic AND the Damaged skin:
Skins0.jpg
Or something completely different....
Skins.jpg

Re: 3d models skins

Posted: Sun Dec 27, 2020 1:07 am
by Trevor
Oh wow, so does this mean that some of the FGs baked into eg the x-wing might be removed and replaced with skins leaving FGs to be just FG's (Primary colour groups - red blue etc rather than red 1, red 2, red 5 etc)?

Trev

Re: 3d models skins

Posted: Sun Dec 27, 2020 1:36 am
by Vince T
It sure is worth considering. It's the various HD FG colors which bloat up the OPTs in filesize. But we sure won't force-convert everything to skins all of a sudden, just because we can.

I think a good rule of thumb would be: If it had FG colors in vanilla, use default colors and add the rest as skins, if it had no FG colors in vanilla, go for skins right away.

I for my part am definitely going to implement this for the VSDs and ISDs, since those ships are extremely bloated up by those flightgroup colors. The bare VSD is around 17MB rather than the whapping 70MB it currently is.

Re: 3d models skins

Posted: Sun Dec 27, 2020 12:11 pm
by Trevor
@blue_max @JeremyaFr Will these skins support the materials?
Speaking of materials and rusty VSD's, do you have plans for a future specular map (mapping whats shiny and not by grey values?)

Trev

Re: 3d models skins

Posted: Sun Dec 27, 2020 3:59 pm
by Bman
Brilliant. Thank you Jeremy and Forceflow! Another great X-mas weekend gift. :-)

Re: 3d models skins

Posted: Mon Dec 28, 2020 2:24 am
by blue_max
Trevor wrote:
Sun Dec 27, 2020 12:11 pm
@blue_max @JeremyaFr Will these skins support the materials?
I haven't really tested this yet, but the material system should work the same since it's based on the name of the texture being loaded. So, as long as the name is also replaced, the materials should keep working.

I have plans to add support for specular and normal maps in the future, but it's going to take a little longer ;)

Re: 3d models skins

Posted: Mon Dec 28, 2020 4:48 pm
by JeremyaFr
@blue_max
With the skins feature, "_fg_#" is added to the name of the texture, where # is the color index starting at 0.

Re: 3d models skins

Posted: Mon Dec 28, 2020 8:23 pm
by blue_max
JeremyaFr wrote:
Mon Dec 28, 2020 4:48 pm
@blue_max
With the skins feature, "_fg_#" is added to the name of the texture, where # is the color index starting at 0.
Oh, I see... In that case, new mat files with the corresponding "_fg_#" tokens would need to be added.

Re: 3d models skins

Posted: Tue Dec 29, 2020 6:47 pm
by ArrowLoop
What would be the quickest and easiest way export an OPT's bundled textures to bmp, png, jpg in order to edit them and make your own skins for this hook?

Re: 3d models skins

Posted: Tue Dec 29, 2020 7:46 pm
by Forceflow
ArrowLoop wrote:
Tue Dec 29, 2020 6:47 pm
What would be the quickest and easiest way export an OPT's bundled textures to bmp, png, jpg in order to edit them and make your own skins for this hook?
You can use XwaOptExplorer (bundled in the XwaToolsDownloader which can be found in the downloads section under Additional Files) XwaOptExplorer can export the opt into .obj .3dm and .an8 files. When doing so it will also export the respective textures of the model. That should be a good basis to make your own skins.

Re: 3d models skins

Posted: Wed Dec 30, 2020 11:58 am
by Trevor
Vince T wrote:
Sun Dec 27, 2020 1:36 am
The bare VSD is around 17MB rather than the whapping 70MB it currently is.
Just a thought - Would there be any performance gain from going further and using "default" (64x64?) textures within the opt and then using the skin feature entirely for all FGs/Unique craft?

Would this allow (if XWA doesn't already) different texture sizes to be used for lesser machines?
eg, base folder is your highest res textures, then for n levels you scale down.
if a user chokes on hi-res, then can rename a folder (or babu can) to select a lower res folder

Trev

Re: 3d models skins

Posted: Wed Dec 30, 2020 12:41 pm
by Forceflow
Trevor wrote:
Wed Dec 30, 2020 11:58 am
Vince T wrote:
Sun Dec 27, 2020 1:36 am
The bare VSD is around 17MB rather than the whapping 70MB it currently is.
Just a thought - Would there be any performance gain from going further and using "default" (64x64?) textures within the opt and then using the skin feature entirely for all FGs/Unique craft?

Would this allow (if XWA doesn't already) different texture sizes to be used for lesser machines?
eg, base folder is your highest res textures, then for n levels you scale down.
if a user chokes on hi-res, then can rename a folder (or babu can) to select a lower res folder

Trev
That's something that @JeremyaFr has to answer, but as far as I understand it the replacing texture must have the same size as the existing texture as it would otherwise mess up the UV mapping.

Re: 3d models skins

Posted: Wed Dec 30, 2020 2:46 pm
by JeremyaFr
Trevor wrote:
Wed Dec 30, 2020 11:58 am
Just a thought - Would there be any performance gain from going further and using "default" (64x64?) textures within the opt and then using the skin feature entirely for all FGs/Unique craft?
Would this allow (if XWA doesn't already) different texture sizes to be used for lesser machines?
Hello,
I don't think that reducing textures size will have a significant performance improvement. It has impact on the total memory consumption.

Re: 3d models skins

Posted: Wed Dec 30, 2020 5:18 pm
by Vince T
I've actually tested it at some point, if the replacement texture is larger than the original, you'll only see a part of it which maches the original's size.

Re: 3d models skins

Posted: Wed Dec 30, 2020 11:43 pm
by Prime
This is an amazing new feature. Can't wait to play with it!

Re: 3d models skins

Posted: Thu Dec 31, 2020 9:12 am
by Bman
Does this new hook apply to textures for LOD meshes too ?

Re: 3d models skins

Posted: Thu Dec 31, 2020 9:37 am
by Vince T
Likely, in the OPT format LOD Textures are treated as any other texture.

Re: 3d models skins

Posted: Thu Dec 31, 2020 4:19 pm
by CatMouthwash
So I think I must be doing something wrong. I'm not seeing any changes when I try what JeremyaFr outlined in the first post. It's been over a decade since I've done anything with editing skins in XWA and I need to take some time and look through the forum and tutorials on OPTing. But as an example I'm trying out a skin for the YT-1300. (I'd love to see some FG colors for the YT series ships =] )

So the craft is "FlightModels\CORELLIANTRANSPORT2.opt".
I edited a few of the pngs that I extracted from the opt and placed them as follows: "FlightModels\Skins\CORELLIANTRANSPORT2\CORELLIANTRANSPORT2[TEX*****].png"
The files in the skins folder have the same name and dimensions of the original texture. I did change the color mode from Indexed to RGB, would that cause problems?

I recall when I last tried this with the original Xwing that I had a hard time finding which textures to edit. Is it that I have not done the Cockpit and Exterior opts yet?

I wanted to look over the example but I don't see "Skins\XWing\Default\Tex00033.png" anywhere in my directory. Just to be safe I reinstalled the latest update to the Mega Pack today and looked again, but still not there.

Re: 3d models skins

Posted: Thu Dec 31, 2020 6:13 pm
by Trevor
Vince T wrote:
Wed Dec 30, 2020 5:18 pm
I've actually tested it at some point, if the replacement texture is larger than the original, you'll only see a part of it which maches the original's size.
@JeremyaFr Can the UV's be made relative (-...0-1...+) so any res can be used?

Trev

Re: 3d models skins

Posted: Thu Dec 31, 2020 7:25 pm
by JeremyaFr
Trevor wrote:
Thu Dec 31, 2020 6:13 pm
Can the UV's be made relative (-...0-1...+) so any res can be used?
Hello,
The skins feature doesn't replace the UVs.

Re: 3d models skins

Posted: Thu Dec 31, 2020 11:47 pm
by Trevor
JeremyaFr wrote:
Thu Dec 31, 2020 7:25 pm
Trevor wrote:
Thu Dec 31, 2020 6:13 pm
Can the UV's be made relative (-...0-1...+) so any res can be used?
Hello,
The skins feature doesn't replace the UVs.
hmm, I assume that XWA uses "texel" mapping (lets say a UV of (0.5,0.75) on a 64x64 = s32,t48) so, could s and t's be hooked and replaced by original texture / st * new texture (hope that math is right :P )

Trev