From 93f33128d381a2307960a204ccb784d05bc5f59f Mon Sep 17 00:00:00 2001 From: Aster <45804670+AsteroidPizza39@users.noreply.github.com> Date: Sun, 22 Sep 2024 14:01:04 -0400 Subject: [PATCH] Additional Sampler Compatibility (#692) * Improved compatibility * cleanup --- .../FileFormats/BFRES/BfresSwitch.cs | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/File_Format_Library/FileFormats/BFRES/BfresSwitch.cs b/File_Format_Library/FileFormats/BFRES/BfresSwitch.cs index b98a1e50..be963d81 100644 --- a/File_Format_Library/FileFormats/BFRES/BfresSwitch.cs +++ b/File_Format_Library/FileFormats/BFRES/BfresSwitch.cs @@ -778,6 +778,7 @@ namespace FirstPlugin m.HasNormalMap = true; texture.Type = MatTexture.TextureType.Normal; } + else if (texture.SamplerName == "_e0") { m.HasEmissionMap = true; @@ -795,9 +796,30 @@ namespace FirstPlugin } else if (texture.SamplerName == "_gn0") //Damage { - + } - } + // EOW Samplers + else if (useSampler == "_albedo0") + { + m.HasDiffuseMap = true; + texture.Type = MatTexture.TextureType.Diffuse; + } + else if (useSampler == "_metallic0") + { + m.HasMetalnessMap = true; + texture.Type = MatTexture.TextureType.Metalness; + } + else if (useSampler == "_normal0") + { + m.HasNormalMap = true; + texture.Type = MatTexture.TextureType.Normal; + } + else if (useSampler == "_smoothness0") + { + m.HasLightMap = true; + texture.Type = MatTexture.TextureType.Light; + } + } else if (mat.ShaderAssign.ShaderArchiveName == "ssg" || mat.ShaderAssign.ShaderArchiveName == "rf4cmv") { @@ -1041,6 +1063,7 @@ namespace FirstPlugin m.HasEmissionMap = true; texture.Type = MatTexture.TextureType.Emission; } + else if (texture.SamplerName == "_s0" || useSampler == "_s0") { m.HasSpecularMap = true; @@ -1061,11 +1084,40 @@ namespace FirstPlugin m.HasLightMap = true; texture.Type = MatTexture.TextureType.Light; } + else if (texture.SamplerName == "bake0") { m.HasShadowMap = true; texture.Type = MatTexture.TextureType.Shadow; } + + // EOW Frag Samplers + + else if (useSampler == "Albedo0") + { + m.HasDiffuseLayer = true; + texture.Type = MatTexture.TextureType.Diffuse; + } + else if (useSampler == "Normal0") + { + m.HasNormalMap = true; + texture.Type = MatTexture.TextureType.Normal; + } + else if (useSampler == "Emissive1") + { + m.HasEmissionMap = true; + texture.Type = MatTexture.TextureType.Emission; + } + else if (useSampler == "Smoothness0") + { + m.HasLightMap = true; + texture.Type = MatTexture.TextureType.Light; + } + else if (useSampler == "Metalness0") + { + m.HasMetalnessMap = true; + texture.Type = MatTexture.TextureType.Metalness; + } } texture.Name = TextureName;