Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
Additional Sampler Compatibility (#692)
Browse files Browse the repository at this point in the history
* Improved compatibility

* cleanup
  • Loading branch information
AsteroidPizza39 authored Sep 22, 2024
1 parent dc19c51 commit 93f3312
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions File_Format_Library/FileFormats/BFRES/BfresSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ public static void ReadTextureRefs(this FMAT m, Material mat)
m.HasNormalMap = true;
texture.Type = MatTexture.TextureType.Normal;
}

else if (texture.SamplerName == "_e0")
{
m.HasEmissionMap = true;
Expand All @@ -795,9 +796,30 @@ public static void ReadTextureRefs(this FMAT m, Material mat)
}
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")
{
Expand Down Expand Up @@ -1041,6 +1063,7 @@ public static void ReadTextureRefs(this FMAT m, Material mat)
m.HasEmissionMap = true;
texture.Type = MatTexture.TextureType.Emission;
}

else if (texture.SamplerName == "_s0" || useSampler == "_s0")
{
m.HasSpecularMap = true;
Expand All @@ -1061,11 +1084,40 @@ public static void ReadTextureRefs(this FMAT m, Material mat)
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;
Expand Down

0 comments on commit 93f3312

Please sign in to comment.