From 0571546bb92a18af8644465f36698330806852bc Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Sat, 23 Nov 2019 17:07:31 -0500 Subject: [PATCH] GFBModel shader fixes/improvements --- .../Forms/Dialogs/ExportModelSettings.cs | 2 +- Toolbox/Shader/GFBModel.frag | 4 +++- Toolbox/Shader/GFBModel.vert | 9 ++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Switch_Toolbox_Library/Forms/Dialogs/ExportModelSettings.cs b/Switch_Toolbox_Library/Forms/Dialogs/ExportModelSettings.cs index ab62f5a8..53429616 100644 --- a/Switch_Toolbox_Library/Forms/Dialogs/ExportModelSettings.cs +++ b/Switch_Toolbox_Library/Forms/Dialogs/ExportModelSettings.cs @@ -35,7 +35,7 @@ namespace Toolbox.Library.Forms } private void chkVertexColors_CheckedChanged(object sender, EventArgs e) { - Settings.UseVertexColors = chkOldExporter.Checked; + Settings.UseVertexColors = chkVertexColors.Checked; } } } diff --git a/Toolbox/Shader/GFBModel.frag b/Toolbox/Shader/GFBModel.frag index 06517fa7..50d0576d 100644 --- a/Toolbox/Shader/GFBModel.frag +++ b/Toolbox/Shader/GFBModel.frag @@ -193,7 +193,7 @@ void main() // Global brightness adjustment. - fragColor.rgb *= 2.5; + fragColor.rgb *= 4.5; fragColor.rgb *= min(boneWeightsColored, vec3(1)); @@ -259,6 +259,8 @@ void main() fragColor = vec4(diffuseMapColor.rgb, 1); } + else if (renderType == 4) //Display Normal + fragColor.rgb = texture(NormalMap, displayTexCoord).rgb; else if (renderType == 5) // vertexColor fragColor = vertexColor; else if (renderType == 6) //Display Ambient Occlusion diff --git a/Toolbox/Shader/GFBModel.vert b/Toolbox/Shader/GFBModel.vert index 0cfe80fb..67cda55e 100644 --- a/Toolbox/Shader/GFBModel.vert +++ b/Toolbox/Shader/GFBModel.vert @@ -115,22 +115,21 @@ void main() vec4 objPos = vec4(vPosition.xyz, 1.0); if (vBone.x != -1.0) - objPos = skin(vPosition, index); + objPos = skin(objPos.xyz, index); if(vBone.x != -1.0) normal = normalize((skinNRM(vNormal.xyz, index)).xyz); - vec4 position = mtxCam * mtxMdl * vec4(objPos.xyz, 1.0); + objPos = mtxMdl * vec4(objPos.xyz, 1.0); + + vec4 position = mtxCam * objPos; normal = vNormal; vertexColor = vColor; - position = objPos; f_texcoord0 = vUV0; f_texcoord1 = vUV1; f_texcoord2 = vUV2; tangent = vTangent; - position = mtxCam * mtxMdl * vec4(vPosition.xyz, 1.0); - f_texcoord0.x *= ColorUVScaleU + ColorUVTranslateU; f_texcoord0.y *= ColorUVScaleV + ColorUVTranslateV;