Some shader and sampler fixes

This commit is contained in:
KillzXGaming 2019-08-21 17:08:24 -04:00
parent 4a137d34cc
commit a6c691bd82
4 changed files with 37 additions and 2 deletions

View file

@ -289,6 +289,8 @@ namespace Bfres.Structs
if (ShaderName == "alRenderMaterial" || ShaderName == "alRenderCloudLayer" || ShaderName == "alRenderSky")
Runtime.activeGame = Runtime.ActiveGame.SMO;
else if (ShaderName == "forward_plus_char")
Runtime.activeGame = Runtime.ActiveGame.Bezel;
else if (ShaderName == "Turbo_UBER")
Runtime.activeGame = Runtime.ActiveGame.MK8D;
else if (ShaderName.Contains("uking_mat"))

View file

@ -707,8 +707,8 @@ namespace FirstPlugin
string useSampler = texture.SamplerName;
//Use the fragment sampler in the shader assign section. It's usually more accurate this way
if (m.shaderassign.samplers.ContainsKey(texture.SamplerName))
useSampler = m.shaderassign.samplers[texture.SamplerName];
if (m.shaderassign.samplers.ContainsValue(texture.SamplerName))
useSampler = m.shaderassign.samplers.FirstOrDefault(x => x.Value == texture.SamplerName).Key;
bool IsAlbedo = Misc.HackyTextureList.Any(TextureName.Contains);
@ -765,6 +765,35 @@ namespace FirstPlugin
texture.Type = MatTexture.TextureType.Shadow;
}
}
else if (Runtime.activeGame == Runtime.ActiveGame.Bezel)
{
bool IsAlbedo0 = useSampler == "_a0";
bool IsNormal = useSampler == "_n0";
bool IsRoughness = useSampler == "_r0";
bool IsMetalness = useSampler == "_m0";
bool IsEmissive = useSampler == "_e0";
if (IsAlbedo0) {
m.HasDiffuseMap = true;
texture.Type = MatTexture.TextureType.Diffuse;
}
if (IsNormal) {
m.HasNormalMap = true;
texture.Type = MatTexture.TextureType.Normal;
}
if (IsRoughness) {
m.HasRoughnessMap = true;
texture.Type = MatTexture.TextureType.Roughness;
}
if (IsMetalness) {
m.HasMetalnessMap = true;
texture.Type = MatTexture.TextureType.Metalness;
}
if (IsEmissive) {
m.HasEmissionMap = true;
texture.Type = MatTexture.TextureType.Emission;
}
}
else if (Runtime.activeGame == Runtime.ActiveGame.Splatoon2)
{
bool IsAlbedo0 = useSampler == "_a0";

View file

@ -219,6 +219,7 @@ namespace Toolbox.Library
Splatoon2,
BOTW,
KSA,
Bezel,
}
public enum PictureBoxBG

View file

@ -379,6 +379,9 @@ void main()
fragColor.a = alpha;
}
if (renderVertColor == 1)
fragColor *= min(vert.vertexColor, vec4(1));
if (RenderAsLighting)
{
diffuseIblColor = texture(irradianceMap, N).rgb;