LordAshes / TaleSpire-CustomMiniPlugin

Adds support for unlimited number of custom minis in TaleSpire software
MIT License
3 stars 2 forks source link

.obj and .mtl imports ignore normal maps and metallic maps. #7

Open Roxfall opened 3 years ago

Roxfall commented 3 years ago

I might be losing my mind or unable to follow simple instructions.

Using this same post https://www.reddit.com/r/talespire/comments/of0qgf/stepbystep_guide_to_import_your_hero_forge_minis/

I cannot, for the life of me, figure out how to make talespire recognize the blah_metal.png or blah_normal.png and have them produce any effects on the actual mini. No matter how bright, dark, transparent or solid the blah_metal.png is, the miniature remains shiny plastic everywhere. The only texture that seems to matter is blah_diffuse.png.

Deleting other textures from the folder and .mtl file makes no difference on the appearance.

Please send help.

LordAshes commented 3 years ago

Please provide a sample MTL file.

Note that the CMP MTL loader only supports the following maps (texture files): map_Kd (diffuse), map_Bump (bump) and map_Ka (ambient).

In addition Kd, Ka, Ks, d and Tr are supported as values.

However, please note that the TaleSpire Shader does not support all of these options. For example, as far as I know, map_Kd is supported but Kd is not.

Since Minis use the TaleSpire Shader wereas Effects use the Standard shader you may get differences between using an asset as a mini or an effect.

Lord Ashes

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Jul 20, 2021 at 10:19 PM Roxfall @.***> wrote:

I might be losing my mind or unable to follow simple instructions.

Using this same post https://www.reddit.com/r/talespire/comments/of0qgf/stepbystep_guide_to_import_your_hero_forge_minis/

I cannot, for the life of me, figure out how to make talespire recognize the blah_metal.png or blah_normal.png and have them produce any effects on the actual mini. No matter how bright, dark, transparent or solid the blah_metal.png is, the miniature remains shiny plastic everywhere. The only texture that seems to matter is blah_diffuse.png.

Deleting other textures from the folder and .mtl file makes no difference on the appearance.

Please send help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGQ5Y6GPUUSS4AN6TY3GLNTTYYVEFANCNFSM5AXALNMA .

Roxfall commented 3 years ago

Here is an example model file. Comments inside .mtl. Thank you so much for looking!

I have not tried yet using Unity to export it as an asset. Tarniel.zip

LordAshes commented 3 years ago

First: Try using different file formats than PNG. PNG sometimes has issues depending on which variant it is. Remember that if you change the type, you need to update the extension in the MTL file. Second: Kd values are not supported by the TaleSpire shader. Map_Kd (diffuse textures) is but not Kd values. Third: Ke values are not supported by the MTL loader. So even if the TaleSpire Shader accepts them, the MTL loader does not.

Lord Ashes

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Jul 20, 2021 at 11:30 PM Roxfall @.***> wrote:

Here is an example model file. Comments inside .mtl. Thank you so much for looking!

I have not tried yet using Unity to export it as an asset. Tarniel.zip https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/files/6852624/Tarniel.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/issues/7#issuecomment-883858680, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGQ5Y6FUJY7BFUOSVTEE233TYY5M7ANCNFSM5AXALNMA .

Roxfall commented 3 years ago

Are these differences in shader specs written down somewhere? I don't mind looking at the code.

Format isnt a problem, each of my textures loads when it is the only or last texture in the mtl file.

Well, normal maps look weird because they are not bump maps... Dont think it is even possible to make mod -> talespire pipeline understand what a normal map is.

On Wed, Jul 21, 2021, 8:23 AM Lord Ashes @.***> wrote:

First: Try using different file formats than PNG. PNG sometimes has issues depending on which variant it is. Remember that if you change the type, you need to update the extension in the MTL file. Second: Kd values are not supported by the TaleSpire shader. Map_Kd (diffuse textures) is but not Kd values. Third: Ke values are not supported by the MTL loader. So even if the TaleSpire Shader accepts them, the MTL loader does not.

Lord Ashes

< http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail

Virus-free. www.avg.com < http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Jul 20, 2021 at 11:30 PM Roxfall @.***> wrote:

Here is an example model file. Comments inside .mtl. Thank you so much for looking!

I have not tried yet using Unity to export it as an asset. Tarniel.zip < https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/files/6852624/Tarniel.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/issues/7#issuecomment-883858680 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AGQ5Y6FUJY7BFUOSVTEE233TYY5M7ANCNFSM5AXALNMA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/issues/7#issuecomment-884147817, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHKAX555M3W4QCPFEWYTG63TY2333ANCNFSM5AXALNMA .

LordAshes commented 3 years ago

What is supported by the CMP MTL loader can be found in code. If you look at the CMP code (available in GitHub) there is a folder called "OBJ And MTL" or something like that. Inside, one of the files is MTLLoader. Somewhere in the middle of that file is the code for parsing the MTL file (I suggest doing a search for something like 'Kd' or 'map_Kd'). This will tell you which features the MTL Loader supports. If the MTL Loader does not support it then it doesn't matter if the shader does because the data will never get to the shader. If the MTL Loader does support it then the data is passed to the shader but then the shader needs to support it.

I believe there should be documentation on what the Unity shader supports somewhere on the internet. There is a lot less available on the TaleSpire Shader but you can ask around the Developement, Support or Modelling-Help channels.

I, myself, know almost nothing about it.

Lord Ashes

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#m_-8970445199087317640_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Jul 21, 2021 at 8:57 AM Roxfall @.***> wrote:

Are these differences in shader specs written down somewhere? I don't mind looking at the code.

Format isnt a problem, each of my textures loads when it is the only or last texture in the mtl file.

Well, normal maps look weird because they are not bump maps... Dont think it is even possible to make mod -> talespire pipeline understand what a normal map is.

On Wed, Jul 21, 2021, 8:23 AM Lord Ashes @.***> wrote:

First: Try using different file formats than PNG. PNG sometimes has issues depending on which variant it is. Remember that if you change the type, you need to update the extension in the MTL file. Second: Kd values are not supported by the TaleSpire shader. Map_Kd (diffuse textures) is but not Kd values. Third: Ke values are not supported by the MTL loader. So even if the TaleSpire Shader accepts them, the MTL loader does not.

Lord Ashes

<

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail

Virus-free. www.avg.com <

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Jul 20, 2021 at 11:30 PM Roxfall @.***> wrote:

Here is an example model file. Comments inside .mtl. Thank you so much for looking!

I have not tried yet using Unity to export it as an asset. Tarniel.zip <

https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/files/6852624/Tarniel.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/issues/7#issuecomment-883858680

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AGQ5Y6FUJY7BFUOSVTEE233TYY5M7ANCNFSM5AXALNMA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/issues/7#issuecomment-884147817 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHKAX555M3W4QCPFEWYTG63TY2333ANCNFSM5AXALNMA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/issues/7#issuecomment-884168004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGQ5Y6AAVPQU4WD224443MLTY27Z5ANCNFSM5AXALNMA .

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Roxfall commented 3 years ago

Will take a look, thank you.

So far in all my experiments I could not create an .mtl file where more than one texture had any effect at all.

Interesting caveat: if you add new file names, need to restart Talespire, because it looks like it parses the folders when it launches so putting a new file with a new name while it is running makes it unable to find it.

Roxfall commented 3 years ago

https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/blob/main/TaleSpireContentPlugin/OBJ%20and%20MTL/MTLLoader.cs

Line 168 has a typo, glass instead of gloss. not sure if this breaks anything.

Roxfall commented 3 years ago

So I was able to affect a mini by more than one texture, however, the result is unfortunate. It looks a bit like two-face. I think the bump map is not being read correctly.

image

It does not look like mtl loader supports occlusion or metallic textures yet. Is that correct?

Here is the model zip file. I included both versions of the normal map. They are both similarly messed up.

Emissive map does nothing, guessing it is not supported by the shader.

There is a memory leak. If you repeatedly LCtrl+T on a small map with five custom minis, modifying textures in between reloads, you eventually crash due to running out of memory (for textures, I am guessing).

Does not look like Ns "glossiness" value does anything either: for values between 300 and 0.5 there was no difference in appearance. TarnielTheTwoFace.zip

Roxfall commented 3 years ago

By emissive map I mean map_Ka.

LordAshes commented 3 years ago

Thanks. I will look into that. I think that was part of some old code that isn't really used anymore but I will check.

Lord Ashes

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Wed, Jul 21, 2021 at 3:59 PM Roxfall @.***> wrote:

https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/blob/main/TaleSpireContentPlugin/OBJ%20and%20MTL/MTLLoader.cs

Line 168 has a typo, glass instead of gloss. not sure if this breaks anything.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LordAshes/TaleSpire-CustomMiniPlugin/issues/7#issuecomment-884459315, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGQ5Y6FO5PFIIBFTUKWX4ETTY4RJRANCNFSM5AXALNMA .