diff --git a/FinModelUtility/Fin/Fin/src/image/BumpMapUtils.cs b/FinModelUtility/Fin/Fin/src/image/BumpMapUtils.cs index 2c199f210..e8b8a4f6d 100644 --- a/FinModelUtility/Fin/Fin/src/image/BumpMapUtils.cs +++ b/FinModelUtility/Fin/Fin/src/image/BumpMapUtils.cs @@ -1,4 +1,5 @@ using fin.image.formats; +using fin.model; using SixLabors.ImageSharp.PixelFormats; @@ -10,7 +11,9 @@ public static class BumpMapUtils { /// https://stackoverflow.com/questions/10652797/whats-the-logic-behind-creating-a-normal-map-from-a-texture /// public static unsafe Rgb24Image ConvertBumpMapImageToNormalImage( - IReadOnlyImage image) { + IReadOnlyImage image, + WrapMode wrapModeS, + WrapMode wrapModeT) { var normalImage = new Rgb24Image(PixelFormat.RGB888, image.Width, image.Height); using var normalImageLock = normalImage.UnsafeLock(); @@ -36,6 +39,14 @@ public static unsafe Rgb24Image ConvertBumpMapImageToNormalImage( out _, out _, out _); + } else if (wrapModeS is WrapMode.REPEAT) { + bumpGetHandler( + image.Width - 1, + y, + out leftIntensity, + out _, + out _, + out _); } else { leftIntensity = centerIntensity; } @@ -49,6 +60,14 @@ public static unsafe Rgb24Image ConvertBumpMapImageToNormalImage( out _, out _, out _); + } else if (wrapModeS is WrapMode.REPEAT) { + bumpGetHandler( + 0, + y, + out rightIntensity, + out _, + out _, + out _); } else { rightIntensity = centerIntensity; } @@ -62,6 +81,14 @@ public static unsafe Rgb24Image ConvertBumpMapImageToNormalImage( out _, out _, out _); + } else if (wrapModeT is WrapMode.REPEAT) { + bumpGetHandler( + x, + image.Height - 1, + out upIntensity, + out _, + out _, + out _); } else { upIntensity = centerIntensity; } @@ -75,15 +102,23 @@ public static unsafe Rgb24Image ConvertBumpMapImageToNormalImage( out _, out _, out _); + } else if (wrapModeT is WrapMode.REPEAT) { + bumpGetHandler( + x, + 0, + out downIntensity, + out _, + out _, + out _); } else { downIntensity = centerIntensity; } var xIntensity - = ((leftIntensity / 255f - rightIntensity / 255f + 1) * .5f) * + = ((rightIntensity / 255f - leftIntensity / 255f + 1) * .5f) * 255; var yIntensity - = ((upIntensity / 255f - downIntensity / 255f + 1) * .5f) * 255; + = ((downIntensity / 255f - upIntensity / 255f + 1) * .5f) * 255; normalImageScan0[y * image.Width + x] = new Rgb24((byte) xIntensity, (byte) yIntensity, 255); diff --git a/FinModelUtility/Fin/Fin/src/language/equations/fixedFunction/FixedFunctionEquationsGlslPrinter.cs b/FinModelUtility/Fin/Fin/src/language/equations/fixedFunction/FixedFunctionEquationsGlslPrinter.cs index 076c041e1..32a85a8a6 100644 --- a/FinModelUtility/Fin/Fin/src/language/equations/fixedFunction/FixedFunctionEquationsGlslPrinter.cs +++ b/FinModelUtility/Fin/Fin/src/language/equations/fixedFunction/FixedFunctionEquationsGlslPrinter.cs @@ -6,6 +6,7 @@ using fin.model; using fin.shaders.glsl; using fin.util.asserts; +using fin.util.enumerables; using fin.util.image; namespace fin.language.equations.fixedFunction; @@ -36,6 +37,13 @@ public void Print( sb.AppendLine(GlslConstants.FLOAT_PRECISION); sb.AppendLine(); + var usesSphericalReflectionMapping + = shaderRequirements.UsesSphericalReflectionMapping; + if (usesSphericalReflectionMapping) { + sb.AppendLine(GlslUtil.GetMatricesHeader(model)); + sb.AppendLine(); + } + var hasIndividualLights = Enumerable .Range(0, MaterialConstants.MAX_LIGHTS) @@ -60,6 +68,7 @@ public void Print( ]); var dependsOnLights = dependsOnMergedLights || dependsOnAnIndividualLight; + var dependsOnNormals = dependsOnLights || usesSphericalReflectionMapping; var dependsOnAmbientLight = equations.DoOutputsDependOn( [ @@ -83,7 +92,8 @@ public void Print( dependsOnIndividualTextures .Select((dependsOnTexture, i) => (i, dependsOnTexture)) .Where(tuple => tuple.dependsOnTexture) - .Select(tuple => textures[tuple.i]), + .Select(tuple => textures[tuple.i]) + .ConcatIfNonnull(material.NormalTexture), this.animations_); var hadUniform = false; @@ -126,21 +136,13 @@ public void Print( } }; - if (shaderRequirements.UsesSphericalReflectionMapping) { - AppendLineBetweenUniformsAndIns(); - sb.AppendLine( - $"in vec2 {GlslConstants.IN_SPHERICAL_REFLECTION_UV_NAME};"); - } - - if (shaderRequirements.UsesLinearReflectionMapping) { + if (dependsOnLights) { AppendLineBetweenUniformsAndIns(); - sb.AppendLine( - $"in vec2 {GlslConstants.IN_LINEAR_REFLECTION_UV_NAME};"); + sb.AppendLine("in vec3 vertexPosition;"); } - if (dependsOnLights) { + if (dependsOnNormals) { AppendLineBetweenUniformsAndIns(); - sb.AppendLine("in vec3 vertexPosition;"); sb.AppendLine("in vec3 vertexNormal;"); if (hasNormalTexture && @@ -193,7 +195,7 @@ public void Print( sb.AppendLine("void main() {"); // Calculate lighting - if (dependsOnLights) { + if (dependsOnNormals) { if (!hasNormalTexture) { sb.AppendLine( """ @@ -204,10 +206,10 @@ public void Print( } else { sb.AppendLine( """ - // Have to renormalize because the vertex normals can become distorted when interpolated. - vec3 fragNormal = normalize(vertexNormal); + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); - """); + """); if (shaderRequirements.TangentType is TangentType.CALCULATED) { // Shamelessly stolen from: @@ -234,6 +236,13 @@ var texCoordName """); } + if (usesSphericalReflectionMapping) { + sb.AppendLine($""" + vec2 {GlslConstants.IN_SPHERICAL_REFLECTION_UV_NAME} = acos(normalize({GlslConstants.UNIFORM_PROJECTION_MATRIX_NAME} * {GlslConstants.UNIFORM_VIEW_MATRIX_NAME} * vec4(fragNormal, 0)).xy) / 3.14159; + + """); + } + // TODO: Optimize this if the shader depends on merged lighting as well as individual lights for some reason. if (dependsOnAnIndividualLight) { sb.AppendLine( @@ -897,12 +906,6 @@ private string GetTextureValue_(int textureIndex, GlslConstants.IN_SPHERICAL_REFLECTION_UV_NAME, texture, this.animations_), - UvType.LINEAR - => GlslUtil.ReadColorFromTexture( - textureName, - GlslConstants.IN_LINEAR_REFLECTION_UV_NAME, - texture, - this.animations_), }; } diff --git a/FinModelUtility/Fin/Fin/src/model/MaterialInterfaces.cs b/FinModelUtility/Fin/Fin/src/model/MaterialInterfaces.cs index f304e4d34..50829962f 100644 --- a/FinModelUtility/Fin/Fin/src/model/MaterialInterfaces.cs +++ b/FinModelUtility/Fin/Fin/src/model/MaterialInterfaces.cs @@ -345,7 +345,7 @@ IFixedFunctionMaterial SetAlphaCompare( public enum UvType { STANDARD, SPHERICAL, - LINEAR, + LINEAR } public enum WrapMode { diff --git a/FinModelUtility/Fin/Fin/src/model/impl/material/BTextureImpl.cs b/FinModelUtility/Fin/Fin/src/model/impl/material/BTextureImpl.cs index bb648b925..55508f4c6 100644 --- a/FinModelUtility/Fin/Fin/src/model/impl/material/BTextureImpl.cs +++ b/FinModelUtility/Fin/Fin/src/model/impl/material/BTextureImpl.cs @@ -162,7 +162,9 @@ public override bool Equals(object? other) { return this.Name == otherTexture.Name && this.Image == otherTexture.Image && this.WrapModeU == otherTexture.WrapModeU && - this.WrapModeV == otherTexture.WrapModeV; + this.WrapModeV == otherTexture.WrapModeV && + this.UvType == otherTexture.UvType && + this.UvIndex == otherTexture.UvIndex; } return false; diff --git a/FinModelUtility/Fin/Fin/src/shaders/glsl/GlslConstants.cs b/FinModelUtility/Fin/Fin/src/shaders/glsl/GlslConstants.cs index 796900a5e..9c3594190 100644 --- a/FinModelUtility/Fin/Fin/src/shaders/glsl/GlslConstants.cs +++ b/FinModelUtility/Fin/Fin/src/shaders/glsl/GlslConstants.cs @@ -24,7 +24,6 @@ public static class GlslConstants { public const string IN_UV_NAME = "uv"; public const string IN_VERTEX_COLOR_NAME = "vertexColor"; public const string IN_SPHERICAL_REFLECTION_UV_NAME = "sphericalReflectionUv"; - public const string IN_LINEAR_REFLECTION_UV_NAME = "linearReflectionUv"; public const float MIN_ALPHA_BEFORE_DISCARD = .95f; public const string MIN_ALPHA_BEFORE_DISCARD_TEXT = ".95"; diff --git a/FinModelUtility/Fin/Fin/src/shaders/glsl/GlslUtil.cs b/FinModelUtility/Fin/Fin/src/shaders/glsl/GlslUtil.cs index d9d36aa1a..d48e8931b 100644 --- a/FinModelUtility/Fin/Fin/src/shaders/glsl/GlslUtil.cs +++ b/FinModelUtility/Fin/Fin/src/shaders/glsl/GlslUtil.cs @@ -86,20 +86,14 @@ public static string GetVertexSrc(IReadOnlyModel model, var numBones = modelRequirements.NumBones; - vertexSrc.AppendLine($$""" - #version {{GlslConstants.VERTEX_SHADER_VERSION}} + vertexSrc.AppendLine($""" + #version {GlslConstants.VERTEX_SHADER_VERSION} - layout (std140, binding = {{GlslConstants.UBO_MATRICES_BINDING_INDEX}}) uniform {{GlslConstants.UBO_MATRICES_NAME}} { - mat4 {{GlslConstants.UNIFORM_MODEL_MATRIX_NAME}}; - mat4 {{GlslConstants.UNIFORM_VIEW_MATRIX_NAME}}; - mat4 {{GlslConstants.UNIFORM_PROJECTION_MATRIX_NAME}}; - - mat4 {{GlslConstants.UNIFORM_BONE_MATRICES_NAME}}[{{1 + model.Skin.BonesUsedByVertices.Count}}]; - }; + {GetMatricesHeader(model)} - uniform vec3 {{GlslConstants.UNIFORM_CAMERA_POSITION_NAME}}; + uniform vec3 {GlslConstants.UNIFORM_CAMERA_POSITION_NAME}; - layout(location = {{location++}}) in vec3 in_Position; + layout(location = {location++}) in vec3 in_Position; """); if (hasNormals) { @@ -167,16 +161,6 @@ public static string GetVertexSrc(IReadOnlyModel model, vertexSrc.AppendLine("out vec3 binormal;"); } - if (shaderRequirements.UsesSphericalReflectionMapping) { - vertexSrc.AppendLine( - $"out vec2 {GlslConstants.IN_SPHERICAL_REFLECTION_UV_NAME};"); - } - - if (shaderRequirements.UsesLinearReflectionMapping) { - vertexSrc.AppendLine( - $"out vec2 {GlslConstants.IN_LINEAR_REFLECTION_UV_NAME};"); - } - for (var i = 0; i < usedUvs.Length; ++i) { if (usedUvs[i]) { vertexSrc.AppendLine($"out vec2 {GlslConstants.IN_UV_NAME}{i};"); @@ -259,32 +243,6 @@ void main() { if (hasBinormals) { vertexSrc.AppendLine(" binormal = cross(vertexNormal, tangent);"); } - - if (shaderRequirements.UsesSphericalReflectionMapping) { - Asserts.True(hasNormals); - vertexSrc.AppendLine($""" - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - {GlslConstants.IN_SPHERICAL_REFLECTION_UV_NAME} = r.xy / m + .5; - """); - } - - if (shaderRequirements.UsesLinearReflectionMapping) { - Asserts.True(modelRequirements.HasNormals); - vertexSrc.AppendLine( - $" {GlslConstants.IN_LINEAR_REFLECTION_UV_NAME} = acos(normalize(projectionVertexModelMatrix * vec4(in_Normal, 0)).xy) / 3.14159;"); - } } else { vertexSrc.AppendLine($@" gl_Position = mvpMatrix * vec4(in_Position, 1); @@ -304,30 +262,6 @@ void main() { if (hasBinormals) { vertexSrc.AppendLine(" binormal = cross(vertexNormal, tangent);"); } - - if (shaderRequirements.UsesSphericalReflectionMapping) { - Asserts.True(hasNormals); - vertexSrc.AppendLine($""" - - vec3 e = normalize( vec3( mvMatrix * vec4(in_Position, 1)) ); - vec3 n = normalize( vec3( mvMatrix * vec4(in_Normal, 0)) ); - - vec3 r = reflect( e, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - {GlslConstants.IN_SPHERICAL_REFLECTION_UV_NAME} = r.xy / m + .5; - """); - } - - if (shaderRequirements.UsesLinearReflectionMapping) { - Asserts.True(modelRequirements.HasNormals); - vertexSrc.AppendLine( - $" {GlslConstants.IN_LINEAR_REFLECTION_UV_NAME} = acos(normalize(mvpMatrix * vec4(in_Normal, 0)).xy) / 3.14159;"); - } } for (var i = 0; i < usedUvs.Length; ++i) { @@ -348,39 +282,48 @@ void main() { return vertexSrc.ToString(); } - public static string GetLightHeader(bool withAmbientLight) { - return - $$""" - struct Light { - // 0x00 (vec3 needs to be 16-byte aligned) - vec3 position; - bool enabled; - - // 0x10 (vec3 needs to be 16-byte aligned) - vec3 normal; - int sourceType; - - // 0x20 (vec4 needs to be 16-byte aligned) - vec4 color; - - // 0x30 (vec3 needs to be 16-byte aligned) - vec3 cosineAttenuation; - int diffuseFunction; - - // 0x40 (vec3 needs to be 16-byte aligned) - vec3 distanceAttenuation; - int attenuationFunction; - }; - - layout (std140, binding = {{GlslConstants.UBO_LIGHTS_BINDING_INDEX}}) uniform {{GlslConstants.UBO_LIGHTS_NAME}} { - Light lights[{{MaterialConstants.MAX_LIGHTS}}]; - vec4 ambientLightColor; - float {{GlslConstants.UNIFORM_USE_LIGHTING_NAME}}; - }; - - uniform vec3 {{GlslConstants.UNIFORM_CAMERA_POSITION_NAME}}; - """; - } + public static string GetMatricesHeader(IReadOnlyModel model) + => $$""" + layout (std140, binding = {{GlslConstants.UBO_MATRICES_BINDING_INDEX}}) uniform {{GlslConstants.UBO_MATRICES_NAME}} { + mat4 {{GlslConstants.UNIFORM_MODEL_MATRIX_NAME}}; + mat4 {{GlslConstants.UNIFORM_VIEW_MATRIX_NAME}}; + mat4 {{GlslConstants.UNIFORM_PROJECTION_MATRIX_NAME}}; + + mat4 {{GlslConstants.UNIFORM_BONE_MATRICES_NAME}}[{{1 + model.Skin.BonesUsedByVertices.Count}}]; + }; + """; + + public static string GetLightHeader(bool withAmbientLight) + => $$""" + struct Light { + // 0x00 (vec3 needs to be 16-byte aligned) + vec3 position; + bool enabled; + + // 0x10 (vec3 needs to be 16-byte aligned) + vec3 normal; + int sourceType; + + // 0x20 (vec4 needs to be 16-byte aligned) + vec4 color; + + // 0x30 (vec3 needs to be 16-byte aligned) + vec3 cosineAttenuation; + int diffuseFunction; + + // 0x40 (vec3 needs to be 16-byte aligned) + vec3 distanceAttenuation; + int attenuationFunction; + }; + + layout (std140, binding = {{GlslConstants.UBO_LIGHTS_BINDING_INDEX}}) uniform {{GlslConstants.UBO_LIGHTS_NAME}} { + Light lights[{{MaterialConstants.MAX_LIGHTS}}]; + vec4 ambientLightColor; + float {{GlslConstants.UNIFORM_USE_LIGHTING_NAME}}; + }; + + uniform vec3 {{GlslConstants.UNIFORM_CAMERA_POSITION_NAME}}; + """; public static string GetGetIndividualLightColorsFunction() { // Shamelessly stolen from: diff --git a/FinModelUtility/Fin/Fin/src/shaders/glsl/ShaderRequirements.cs b/FinModelUtility/Fin/Fin/src/shaders/glsl/ShaderRequirements.cs index 73f03c8d6..9aa5cbdbf 100644 --- a/FinModelUtility/Fin/Fin/src/shaders/glsl/ShaderRequirements.cs +++ b/FinModelUtility/Fin/Fin/src/shaders/glsl/ShaderRequirements.cs @@ -14,7 +14,6 @@ public enum TangentType { public interface IShaderRequirements { public bool UsesSphericalReflectionMapping { get; } - public bool UsesLinearReflectionMapping { get; } public bool HasNormals { get; } public TangentType TangentType { get; } @@ -34,8 +33,6 @@ private ShaderRequirements(IReadOnlyModel model, this.UsesSphericalReflectionMapping = material?.Textures.Any(t => t.UvType is UvType.SPHERICAL) ?? false; - this.UsesLinearReflectionMapping - = material?.Textures.Any(t => t.UvType is UvType.LINEAR) ?? false; this.TangentType = TangentType.NOT_PRESENT; foreach (var vertex in model.Skin.Meshes @@ -100,6 +97,13 @@ or IStandardMaterial } } + var normalTexture = fixedFunctionMaterial.NormalTexture; + if (normalTexture != null) { + var uvIndex = normalTexture.UvIndex; + Asserts.True(modelRequirements.NumUvs >= uvIndex + 1); + this.UsedUvs[uvIndex] = true; + } + for (var i = 0; i < this.UsedColors.Length; ++i) { if (equations.DoOutputsDependOn([ FixedFunctionSource.VERTEX_COLOR_0 + i, @@ -116,7 +120,6 @@ or IStandardMaterial } public bool UsesSphericalReflectionMapping { get; } - public bool UsesLinearReflectionMapping { get; } public bool HasNormals { get; } public TangentType TangentType { get; } public bool[] UsedUvs { get; } diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material0.fragment.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material0.fragment.glsl index 38e4d8314..2119d6e1a 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material0.fragment.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[41]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -35,7 +43,6 @@ uniform sampler2D texture2; uniform float scalar_3dsAlpha0; uniform float scalar_3dsAlpha1; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -126,6 +133,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material0.vertex.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material0.vertex.glsl index 21b3508df..7c36cf454 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material0.vertex.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material0.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -36,19 +35,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material2.fragment.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material2.fragment.glsl index b1c8b91f6..5fedcd79a 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material2.fragment.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material2.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[41]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -35,7 +43,6 @@ uniform sampler2D texture2; uniform float scalar_3dsAlpha0; uniform float scalar_3dsAlpha1; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -126,6 +133,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material2.vertex.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material2.vertex.glsl index 21b3508df..7c36cf454 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material2.vertex.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/bfire/output/material2.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -36,19 +35,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/opdn/output/material2.fragment.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/opdn/output/material2.fragment.glsl index 324773be9..782e1cb3a 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/opdn/output/material2.fragment.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/opdn/output/material2.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[2]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -37,7 +45,6 @@ uniform vec3 color_3dsColor2; uniform vec3 color_3dsColor3; uniform float scalar_3dsAlpha1; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec4 vertexColor0; @@ -129,6 +136,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/opdn/output/material2.vertex.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/opdn/output/material2.vertex.glsl index 95a9b9df2..7e919eb01 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/opdn/output/material2.vertex.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/luigis_mansion_3d/opdn/output/material2.vertex.glsl @@ -19,7 +19,6 @@ layout(location = 5) in vec4 in_Color0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; out vec4 vertexColor0; @@ -36,20 +35,6 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; vertexColor0 = in_Color0; } diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/majoras_mask_3d/zelda_cow/output/material0.fragment.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/majoras_mask_3d/zelda_cow/output/material0.fragment.glsl index 1ef28c30d..43fa4e111 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/majoras_mask_3d/zelda_cow/output/material0.fragment.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/majoras_mask_3d/zelda_cow/output/material0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[11]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -34,7 +42,6 @@ uniform sampler2D texture0; uniform sampler2D texture1; uniform float scalar_3dsAlpha3; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -125,6 +132,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/majoras_mask_3d/zelda_cow/output/material0.vertex.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/majoras_mask_3d/zelda_cow/output/material0.vertex.glsl index 82074fb1c..54262d0f2 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/majoras_mask_3d/zelda_cow/output/material0.vertex.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/majoras_mask_3d/zelda_cow/output/material0.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -36,19 +35,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/ocarina_of_time_3d/zelda_cow/output/material0.fragment.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/ocarina_of_time_3d/zelda_cow/output/material0.fragment.glsl index 890b43dfb..d2efc8364 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/ocarina_of_time_3d/zelda_cow/output/material0.fragment.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/ocarina_of_time_3d/zelda_cow/output/material0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[11]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -33,7 +41,6 @@ uniform float shininess; uniform sampler2D texture0; uniform sampler2D texture1; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -124,6 +131,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/ocarina_of_time_3d/zelda_cow/output/material0.vertex.glsl b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/ocarina_of_time_3d/zelda_cow/output/material0.vertex.glsl index 82074fb1c..54262d0f2 100644 --- a/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/ocarina_of_time_3d/zelda_cow/output/material0.vertex.glsl +++ b/FinModelUtility/Formats/Grezzo/Grezzo Tests/goldens/cmb/ocarina_of_time_3d/zelda_cow/output/material0.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -36,19 +35,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/000005B4.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/000005B4.fragment.glsl index 8988cdee7..52ce1a7cf 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/000005B4.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/000005B4.fragment.glsl @@ -1,13 +1,26 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[5]; +}; + uniform sampler2D texture0; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = texture(texture0, sphericalReflectionUv).rgb; float alphaComponent = 1.0; diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/000005B4.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/000005B4.vertex.glsl index 3cea4288d..29e998152 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/000005B4.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/000005B4.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/00000674.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/00000674.fragment.glsl index 8988cdee7..52ce1a7cf 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/00000674.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/00000674.fragment.glsl @@ -1,13 +1,26 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[5]; +}; + uniform sampler2D texture0; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = texture(texture0, sphericalReflectionUv).rgb; float alphaComponent = 1.0; diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/00000674.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/00000674.vertex.glsl index 3cea4288d..29e998152 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/00000674.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_plug/output/00000674.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_robo/output/00002200.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_robo/output/00002200.fragment.glsl index 4c4b4e2e7..28ef2ba5c 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_robo/output/00002200.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_robo/output/00002200.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[71]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_robo/output/00002200.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_robo/output/00002200.vertex.glsl index b5653f192..4c448ac8a 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_robo/output/00002200.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/chibi_robo/cb_robo/output/00002200.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A7B0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A7B0.fragment.glsl index 181b894cb..b06a4cda5 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A7B0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A7B0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[62]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A7B0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A7B0.vertex.glsl index dc3e0a29e..594bdae6a 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A7B0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A7B0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in vec3 in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -34,18 +33,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A850.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A850.fragment.glsl index 181b894cb..b06a4cda5 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A850.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A850.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[62]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A850.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A850.vertex.glsl index dc3e0a29e..594bdae6a 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A850.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/PlMr/output/0000A850.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in vec3 in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -34,18 +33,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E820.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E820.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E820.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E820.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E820.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E820.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E820.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E820.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E8C0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E8C0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E8C0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E8C0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E8C0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E8C0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E8C0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E8C0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E960.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E960.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E960.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E960.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E960.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E960.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E960.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002E960.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EA00.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EA00.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EA00.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EA00.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EA00.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EA00.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EA00.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EA00.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EAA0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EAA0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EAA0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EAA0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EAA0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EAA0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EAA0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EAA0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EB40.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EB40.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EB40.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EB40.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EB40.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EB40.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EB40.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EB40.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EBE0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EBE0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EBE0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EBE0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EBE0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EBE0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EBE0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EBE0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EC80.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EC80.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EC80.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EC80.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EC80.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EC80.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EC80.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EC80.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002ED20.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002ED20.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002ED20.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002ED20.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002ED20.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002ED20.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002ED20.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002ED20.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EDC0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EDC0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EDC0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EDC0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EDC0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EDC0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EDC0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EDC0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EE60.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EE60.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EE60.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EE60.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EE60.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EE60.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EE60.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EE60.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EF00.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EF00.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EF00.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EF00.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EF00.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EF00.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EF00.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EF00.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EFA0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EFA0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EFA0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EFA0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EFA0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EFA0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EFA0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002EFA0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F040.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F040.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F040.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F040.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F040.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F040.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F040.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F040.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F0E0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F0E0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F0E0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F0E0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F0E0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F0E0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F0E0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F0E0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F180.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F180.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F180.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F180.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F180.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F180.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F180.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F180.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F220.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F220.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F220.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F220.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F220.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F220.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F220.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F220.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F2C0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F2C0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F2C0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F2C0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F2C0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F2C0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F2C0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F2C0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F360.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F360.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F360.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F360.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F360.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F360.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F360.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F360.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F400.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F400.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F400.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F400.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F400.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F400.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F400.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F400.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F4A0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F4A0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F4A0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F4A0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F4A0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F4A0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F4A0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F4A0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F540.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F540.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F540.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F540.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F540.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F540.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F540.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F540.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F5E0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F5E0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F5E0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F5E0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F5E0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F5E0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F5E0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F5E0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F680.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F680.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F680.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F680.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F680.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F680.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F680.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F680.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F720.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F720.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F720.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F720.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F720.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F720.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F720.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F720.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F7C0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F7C0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F7C0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F7C0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F7C0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F7C0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F7C0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F7C0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F860.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F860.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F860.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F860.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F860.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F860.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F860.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F860.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F900.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F900.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F900.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F900.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F900.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F900.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F900.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F900.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F9A0.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F9A0.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F9A0.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F9A0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F9A0.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F9A0.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F9A0.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002F9A0.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FA40.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FA40.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FA40.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FA40.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FA40.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FA40.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FA40.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FA40.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FB0C.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FB0C.fragment.glsl index 5c262b425..bb3e76bfb 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FB0C.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FB0C.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FB0C.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FB0C.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FB0C.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FB0C.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FBD8.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FBD8.fragment.glsl index 5c262b425..bb3e76bfb 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FBD8.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FBD8.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FBD8.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FBD8.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FBD8.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FBD8.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FC78.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FC78.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FC78.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FC78.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FC78.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FC78.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FC78.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FC78.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FD18.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FD18.fragment.glsl index 332835fbf..e2db40eef 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FD18.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FD18.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FD18.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FD18.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FD18.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyAndruf/output/0002FD18.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000B5F8.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000B5F8.fragment.glsl index 4a7998a54..c2337a4c2 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000B5F8.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000B5F8.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[7]; +}; + struct Texture { sampler2D sampler; @@ -16,11 +24,16 @@ vec2 transformUv3d(mat4 transform3d, vec2 inUv) { uniform Texture texture0; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = texture(texture0.sampler, transformUv3d(texture0.transform3d, sphericalReflectionUv)).rgb; float alphaComponent = 1.0; diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000B5F8.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000B5F8.vertex.glsl index fe4a66df3..d4cfb7c5f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000B5F8.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000B5F8.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C068.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C068.fragment.glsl index 05f590b84..7628c340f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C068.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C068.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[7]; +}; + struct Texture { sampler2D sampler; @@ -17,12 +25,17 @@ vec2 transformUv3d(mat4 transform3d, vec2 inUv) { uniform Texture texture0; uniform Texture texture1; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; in vec2 uv0; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = vec3(2.0)*texture(texture0.sampler, transformUv3d(texture0.transform3d, uv0)).rgb*texture(texture1.sampler, transformUv3d(texture1.transform3d, sphericalReflectionUv)).rgb; float alphaComponent = 1.0; diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C068.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C068.vertex.glsl index 511b80501..4e97f150f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C068.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C068.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C1A8.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C1A8.fragment.glsl index 2b757c92c..b59c8bb47 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C1A8.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C1A8.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[7]; +}; + struct Texture { sampler2D sampler; @@ -16,12 +24,17 @@ vec2 transformUv3d(mat4 transform3d, vec2 inUv) { uniform Texture texture0; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; in vec4 vertexColor0; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = vec3(2.0)*vertexColor0.rgb*vec3(0.5) + texture(texture0.sampler, transformUv3d(texture0.transform3d, sphericalReflectionUv)).rgb*vec3(0.5); float alphaComponent = 0.34999999404*vertexColor0.a; diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C1A8.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C1A8.vertex.glsl index d77940a87..63dc4d027 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C1A8.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C1A8.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 5) in vec4 in_Color0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec4 vertexColor0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; vertexColor0 = in_Color0; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C7A8.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C7A8.fragment.glsl index 05f590b84..7628c340f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C7A8.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C7A8.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[7]; +}; + struct Texture { sampler2D sampler; @@ -17,12 +25,17 @@ vec2 transformUv3d(mat4 transform3d, vec2 inUv) { uniform Texture texture0; uniform Texture texture1; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; in vec2 uv0; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = vec3(2.0)*texture(texture0.sampler, transformUv3d(texture0.transform3d, uv0)).rgb*texture(texture1.sampler, transformUv3d(texture1.transform3d, sphericalReflectionUv)).rgb; float alphaComponent = 1.0; diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C7A8.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C7A8.vertex.glsl index 511b80501..4e97f150f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C7A8.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000C7A8.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000CC68.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000CC68.fragment.glsl index 05f590b84..7628c340f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000CC68.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000CC68.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[7]; +}; + struct Texture { sampler2D sampler; @@ -17,12 +25,17 @@ vec2 transformUv3d(mat4 transform3d, vec2 inUv) { uniform Texture texture0; uniform Texture texture1; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; in vec2 uv0; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = vec3(2.0)*texture(texture0.sampler, transformUv3d(texture0.transform3d, uv0)).rgb*texture(texture1.sampler, transformUv3d(texture1.transform3d, sphericalReflectionUv)).rgb; float alphaComponent = 1.0; diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000CC68.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000CC68.vertex.glsl index 511b80501..4e97f150f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000CC68.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000CC68.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000D128.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000D128.fragment.glsl index 05f590b84..7628c340f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000D128.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000D128.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[7]; +}; + struct Texture { sampler2D sampler; @@ -17,12 +25,17 @@ vec2 transformUv3d(mat4 transform3d, vec2 inUv) { uniform Texture texture0; uniform Texture texture1; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; in vec2 uv0; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = vec3(2.0)*texture(texture0.sampler, transformUv3d(texture0.transform3d, uv0)).rgb*texture(texture1.sampler, transformUv3d(texture1.transform3d, sphericalReflectionUv)).rgb; float alphaComponent = 1.0; diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000D128.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000D128.vertex.glsl index 511b80501..4e97f150f 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000D128.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyBField/output/0000D128.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00047A98.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00047A98.fragment.glsl index 181b894cb..2f5fb7021 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00047A98.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00047A98.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00047A98.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00047A98.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00047A98.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00047A98.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00048078.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00048078.fragment.glsl index 2d1d819e1..2f896c1b5 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00048078.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00048078.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00048078.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00048078.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00048078.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00048078.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049A78.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049A78.fragment.glsl index 2d1d819e1..2f896c1b5 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049A78.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049A78.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049A78.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049A78.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049A78.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049A78.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049BF8.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049BF8.fragment.glsl index 2d1d819e1..2f896c1b5 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049BF8.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049BF8.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049BF8.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049BF8.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049BF8.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049BF8.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049CB8.fragment.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049CB8.fragment.glsl index 2d1d819e1..2f896c1b5 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049CB8.fragment.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049CB8.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[4]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -32,7 +40,6 @@ uniform vec3 cameraPosition; uniform float shininess; uniform sampler2D texture0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 mergedLightDiffuseColor = vec4(0); vec4 mergedLightSpecularColor = vec4(0); getMergedLightColors(vertexPosition, fragNormal, shininess, mergedLightDiffuseColor, mergedLightSpecularColor); diff --git a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049CB8.vertex.glsl b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049CB8.vertex.glsl index f31827532..6b912223d 100644 --- a/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049CB8.vertex.glsl +++ b/FinModelUtility/Formats/Hsd/Hsd Tests/goldens/super_smash_bros_melee/TyDaisy/output/00049CB8.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/IP2V_damaind3.png b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/IP2V_damaind3.png index f6a6da632..1edf11bdd 100644 Binary files a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/IP2V_damaind3.png and b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/IP2V_damaind3.png differ diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ashi_mat.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ashi_mat.fragment.glsl index db7277b82..5d8cb8168 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ashi_mat.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ashi_mat.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[16]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -44,7 +52,6 @@ uniform vec3 color_GxMaterialColor0; uniform vec3 color_GxAmbientColor0; uniform float scalar_GxAlphaRegister0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -133,6 +140,8 @@ void main() { vec3 textureNormal = texture(normalTexture.sampler, normalTexture.transform2d * vec3((uv0).x, (uv0).y, 1)).xyz * 2.0 - 1.0; fragNormal = normalize(mat3(tangent, binormal, fragNormal) * textureNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ashi_mat.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ashi_mat.vertex.glsl index c6a287a8f..a66a2406a 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ashi_mat.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ashi_mat.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -35,19 +34,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/body_mat.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/body_mat.fragment.glsl index 22ce47749..7d6e75593 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/body_mat.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/body_mat.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[16]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -44,7 +52,6 @@ uniform vec3 color_GxMaterialColor0; uniform vec3 color_GxAmbientColor0; uniform float scalar_GxAlphaRegister0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -133,6 +140,8 @@ void main() { vec3 textureNormal = texture(normalTexture, uv0).xyz * 2.0 - 1.0; fragNormal = normalize(mat3(tangent, binormal, fragNormal) * textureNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/body_mat.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/body_mat.vertex.glsl index c6a287a8f..a66a2406a 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/body_mat.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/body_mat.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -35,19 +34,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/enemy_0.png b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/enemy_0.png index 61c10af0e..5c3af8f87 100644 Binary files a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/enemy_0.png and b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/enemy_0.png differ diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/enemy_2.png b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/enemy_2.png index f6a6da632..1edf11bdd 100644 Binary files a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/enemy_2.png and b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/enemy_2.png differ diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ooashi_footind_h.png b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ooashi_footind_h.png index 61c10af0e..5c3af8f87 100644 Binary files a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ooashi_footind_h.png and b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/ooashi_footind_h.png differ diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/tama_mat.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/tama_mat.fragment.glsl index b5190dd48..474c77077 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/tama_mat.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/tama_mat.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[16]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -44,7 +52,6 @@ uniform vec3 color_GxMaterialColor0; uniform vec3 color_GxAmbientColor0; uniform float scalar_GxAlphaRegister0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -133,6 +140,8 @@ void main() { vec3 textureNormal = texture(normalTexture.sampler, normalTexture.transform2d * vec3((uv0).x, (uv0).y, 1)).xyz * 2.0 - 1.0; fragNormal = normalize(mat3(tangent, binormal, fragNormal) * textureNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/tama_mat.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/tama_mat.vertex.glsl index c6a287a8f..a66a2406a 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/tama_mat.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_BigFoot/output/tama_mat.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -35,19 +34,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_iron_v.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_iron_v.fragment.glsl index 9366a0409..97042cdd1 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_iron_v.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_iron_v.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[2]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -41,7 +49,6 @@ uniform Texture texture1; uniform Texture texture2; uniform vec3 color_GxAmbientColor0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec4 vertexColor0; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_iron_v.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_iron_v.vertex.glsl index 20cca764f..8d1d41116 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_iron_v.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_iron_v.vertex.glsl @@ -20,7 +20,6 @@ layout(location = 6) in vec4 in_Color0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; out vec2 uv1; out vec4 vertexColor0; @@ -38,20 +37,6 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; uv1 = in_Uv1; vertexColor0 = in_Color0; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_plate_v.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_plate_v.fragment.glsl index 51cb7ef60..90e211382 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_plate_v.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_plate_v.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[2]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -41,7 +49,6 @@ uniform Texture texture1; uniform sampler2D texture2; uniform vec3 color_GxAmbientColor0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec4 vertexColor0; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_plate_v.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_plate_v.vertex.glsl index 20cca764f..8d1d41116 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_plate_v.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/a_plate_v.vertex.glsl @@ -20,7 +20,6 @@ layout(location = 6) in vec4 in_Color0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; out vec2 uv1; out vec4 vertexColor0; @@ -38,20 +37,6 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; uv1 = in_Uv1; vertexColor0 = in_Color0; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/w_Nuki_tile_v_x.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/w_Nuki_tile_v_x.fragment.glsl index ba4b34181..a1d084b2c 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/w_Nuki_tile_v_x.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/w_Nuki_tile_v_x.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[2]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -36,7 +44,6 @@ uniform sampler2D texture2; uniform sampler2D texture3; uniform vec3 color_GxAmbientColor0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec4 vertexColor0; @@ -117,6 +124,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/w_Nuki_tile_v_x.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/w_Nuki_tile_v_x.vertex.glsl index 20cca764f..8d1d41116 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/w_Nuki_tile_v_x.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_forest/output/w_Nuki_tile_v_x.vertex.glsl @@ -20,7 +20,6 @@ layout(location = 6) in vec4 in_Color0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; out vec2 uv1; out vec4 vertexColor0; @@ -38,20 +37,6 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; uv1 = in_Uv1; vertexColor0 = in_Color0; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/body.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/body.fragment.glsl index 303193b4b..10c70a7de 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/body.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/body.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[14]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -44,7 +52,6 @@ uniform vec3 color_GxAmbientColor0; uniform vec3 color_GxColorRegister0; uniform float scalar_GxMaterialAlpha0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -123,6 +130,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/body.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/body.vertex.glsl index 0c36f36d8..09191e04e 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/body.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/body.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/cocpit1_cov1.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/cocpit1_cov1.fragment.glsl index 9f6db7ffd..958c91dc1 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/cocpit1_cov1.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/cocpit1_cov1.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[14]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -43,7 +51,6 @@ uniform vec3 color_GxMaterialColor1; uniform vec3 color_GxColorRegister3; uniform float scalar_GxMaterialAlpha1; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; @@ -121,6 +128,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/cocpit1_cov1.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/cocpit1_cov1.vertex.glsl index 82d493ba0..1b40c8592 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/cocpit1_cov1.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/cocpit1_cov1.vertex.glsl @@ -17,7 +17,6 @@ layout(location = 3) in float in_BoneWeights; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; void main() { mat4 mvMatrix = viewMatrix * modelMatrix; @@ -32,18 +31,4 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; } diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/light_blue_r1.fragment.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/light_blue_r1.fragment.glsl index 1a9b13028..998ca349d 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/light_blue_r1.fragment.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/light_blue_r1.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[14]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -44,7 +52,6 @@ uniform vec3 color_GxAmbientColor1; uniform vec3 color_GxMaterialColor3; uniform float scalar_GxMaterialAlpha3; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -123,6 +130,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/light_blue_r1.vertex.glsl b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/light_blue_r1.vertex.glsl index 0c36f36d8..09191e04e 100644 --- a/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/light_blue_r1.vertex.glsl +++ b/FinModelUtility/Formats/JSystem/JSystem Tests/goldens/pikmin_2_ufo/output/light_blue_r1.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material1.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material1.fragment.glsl index 3583d064c..ac62e7d59 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material1.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material1.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[19]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -36,7 +44,6 @@ uniform sampler2D texture2; uniform vec3 color_GxAmbientColor1; uniform float scalar_GxMaterialAlpha1; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec4 vertexColor0; @@ -116,6 +123,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material1.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material1.vertex.glsl index c362a7751..b9d533441 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material1.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material1.vertex.glsl @@ -19,7 +19,6 @@ layout(location = 6) in vec4 in_Color0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; out vec4 vertexColor0; @@ -36,20 +35,6 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; vertexColor0 = in_Color0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material19.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material19.fragment.glsl index 71e8b69b9..953a471e0 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material19.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material19.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[19]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -44,7 +52,6 @@ uniform vec3 color_GxMaterialColor19; uniform vec3 color_GxAmbientColor19; uniform float scalar_GxMaterialAlpha19; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -123,6 +130,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material19.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material19.vertex.glsl index fdb34efda..b6419d1d8 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material19.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material19.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material27.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material27.fragment.glsl index 239e074ab..ebcd5f6a6 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material27.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material27.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[19]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -36,7 +44,6 @@ uniform sampler2D texture2; uniform vec3 color_GxAmbientColor27; uniform float scalar_GxMaterialAlpha27; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec4 vertexColor0; @@ -116,6 +123,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material27.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material27.vertex.glsl index c362a7751..b9d533441 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material27.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material27.vertex.glsl @@ -19,7 +19,6 @@ layout(location = 6) in vec4 in_Color0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; out vec4 vertexColor0; @@ -36,20 +35,6 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; vertexColor0 = in_Color0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material3.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material3.fragment.glsl index bb43cd43d..5ac539d52 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material3.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material3.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[19]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -42,7 +50,6 @@ uniform vec3 color_GxMaterialColor3; uniform vec3 color_GxAmbientColor3; uniform float scalar_GxMaterialAlpha3; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -121,6 +128,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material3.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material3.vertex.glsl index fdb34efda..b6419d1d8 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material3.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material3.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material4.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material4.fragment.glsl index bcef01d88..4e7e5482d 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material4.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material4.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[19]; +}; + struct Texture { sampler2D sampler; @@ -10,12 +18,17 @@ struct Texture { uniform Texture texture0; uniform Texture texture1; -in vec2 sphericalReflectionUv; +in vec3 vertexNormal; in vec2 uv0; out vec4 fragColor; void main() { + // Have to renormalize because the vertex normals can become distorted when interpolated. + vec3 fragNormal = normalize(vertexNormal); + + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec3 colorComponent = clamp(clamp((texture(texture0.sampler, texture0.transform2d * vec3((uv0).x, (uv0).y, 1)).rgb + vec3(-0.5))*vec3(0.5), 0.0, 1.0) + (texture(texture0.sampler, texture0.transform2d * vec3((uv0).x, (uv0).y, 1)).rgb + vec3(-0.5))*vec3(0.5)*(vec3(1.0) + vec3(-1.0)*texture(texture1.sampler, texture1.transform2d * vec3((sphericalReflectionUv).x, (sphericalReflectionUv).y, 1)).rgb) + texture(texture1.sampler, texture1.transform2d * vec3((sphericalReflectionUv).x, (sphericalReflectionUv).y, 1)).rgb*texture(texture1.sampler, texture1.transform2d * vec3((sphericalReflectionUv).x, (sphericalReflectionUv).y, 1)).rgb, 0.0, 1.0); float alphaComponent = 0.0; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material4.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material4.vertex.glsl index fdb34efda..b6419d1d8 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material4.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material4.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material47.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material47.fragment.glsl index edafa1f59..9ccba9fc3 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material47.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material47.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[19]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -42,7 +50,6 @@ uniform Texture texture2; uniform vec3 color_GxAmbientColor47; uniform float scalar_GxMaterialAlpha47; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec4 vertexColor0; @@ -122,6 +129,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material47.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material47.vertex.glsl index c362a7751..b9d533441 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material47.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material47.vertex.glsl @@ -19,7 +19,6 @@ layout(location = 6) in vec4 in_Color0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; out vec4 vertexColor0; @@ -36,20 +35,6 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; vertexColor0 = in_Color0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material76.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material76.fragment.glsl index c995c2759..441072bda 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material76.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material76.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[19]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -42,7 +50,6 @@ uniform vec3 color_GxMaterialColor76; uniform vec3 color_GxAmbientColor76; uniform float scalar_GxMaterialAlpha76; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -121,6 +128,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material76.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material76.vertex.glsl index fdb34efda..b6419d1d8 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material76.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material76.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material79.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material79.fragment.glsl index 0eaab5110..433e31087 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material79.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material79.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[19]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -44,7 +52,6 @@ uniform vec3 color_GxMaterialColor79; uniform vec3 color_GxAmbientColor79; uniform float scalar_GxMaterialAlpha79; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -123,6 +130,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material79.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material79.vertex.glsl index fdb34efda..b6419d1d8 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material79.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/cave/output/material79.vertex.glsl @@ -18,7 +18,6 @@ layout(location = 4) in vec2 in_Uv0; out vec3 vertexPosition; out vec3 vertexNormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -34,19 +33,5 @@ void main() { vertexPosition = vec3(vertexModelMatrix * vec4(in_Position, 1)); vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material0.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material0.fragment.glsl index 018fb424c..632914fc5 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material0.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material0.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[8]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -37,7 +45,6 @@ uniform vec3 color_GxAmbientColor0; uniform vec3 color_GxColorRegister0; uniform float scalar_GxMaterialAlpha0; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -116,6 +123,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material0.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material0.vertex.glsl index f953bfa03..5f8c48370 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material0.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material0.vertex.glsl @@ -21,7 +21,6 @@ out vec3 vertexPosition; out vec3 vertexNormal; out vec3 tangent; out vec3 binormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -39,19 +38,5 @@ void main() { vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; tangent = normalize(vertexModelMatrix * vec4(in_Tangent)).xyz; binormal = cross(vertexNormal, tangent); - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material2.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material2.fragment.glsl index 37b72a393..68a3f323c 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material2.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material2.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[8]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -37,7 +45,6 @@ uniform vec3 color_GxAmbientColor2; uniform vec3 color_GxColorRegister6; uniform float scalar_GxMaterialAlpha2; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -116,6 +123,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material2.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material2.vertex.glsl index f953bfa03..5f8c48370 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material2.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material2.vertex.glsl @@ -21,7 +21,6 @@ out vec3 vertexPosition; out vec3 vertexNormal; out vec3 tangent; out vec3 binormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -39,19 +38,5 @@ void main() { vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; tangent = normalize(vertexModelMatrix * vec4(in_Tangent)).xyz; binormal = cross(vertexNormal, tangent); - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material3.fragment.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material3.fragment.glsl index 395537fbc..6e5155853 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material3.fragment.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material3.fragment.glsl @@ -1,6 +1,14 @@ #version 310 es precision mediump float; +layout (std140, binding = 1) uniform Matrices { + mat4 modelMatrix; + mat4 viewMatrix; + mat4 projectionMatrix; + + mat4 boneMatrices[8]; +}; + struct Light { // 0x00 (vec3 needs to be 16-byte aligned) vec3 position; @@ -40,7 +48,6 @@ uniform vec3 color_GxColorRegister9; uniform float scalar_GxMaterialAlpha3; uniform float scalar_GxAlphaRegister11; -in vec2 sphericalReflectionUv; in vec3 vertexPosition; in vec3 vertexNormal; in vec2 uv0; @@ -119,6 +126,8 @@ void main() { // Have to renormalize because the vertex normals can become distorted when interpolated. vec3 fragNormal = normalize(vertexNormal); + vec2 sphericalReflectionUv = acos(normalize(projectionMatrix * viewMatrix * vec4(fragNormal, 0)).xy) / 3.14159; + vec4 individualLightDiffuseColors[8]; vec4 individualLightSpecularColors[8]; diff --git a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material3.vertex.glsl b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material3.vertex.glsl index f953bfa03..5f8c48370 100644 --- a/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material3.vertex.glsl +++ b/FinModelUtility/Formats/Mod/Mod Tests/goldens/kogane/output/material3.vertex.glsl @@ -21,7 +21,6 @@ out vec3 vertexPosition; out vec3 vertexNormal; out vec3 tangent; out vec3 binormal; -out vec2 sphericalReflectionUv; out vec2 uv0; void main() { @@ -39,19 +38,5 @@ void main() { vertexNormal = normalize(vertexModelMatrix * vec4(in_Normal, 0)).xyz; tangent = normalize(vertexModelMatrix * vec4(in_Tangent)).xyz; binormal = cross(vertexNormal, tangent); - - vec3 u = normalize( vec3( mvMatrix * mergedBoneMatrix * vec4(in_Position, 1)) ); - - mat3 normalMatrix = transpose(inverse(mat3(mvMatrix * mergedBoneMatrix))); - vec3 n = normalize( normalMatrix * in_Normal ); - - vec3 r = reflect( u, n ); - float m = 2. * sqrt( - pow( r.x, 2. ) + - pow( r.y, 2. ) + - pow( r.z + 1., 2. ) - ); - - sphericalReflectionUv = r.xy / m + .5; uv0 = in_Uv0; } diff --git a/FinModelUtility/Platforms/Gx/src/impl/GxFixedFunctionMaterial.cs b/FinModelUtility/Platforms/Gx/src/impl/GxFixedFunctionMaterial.cs index ace90b5a6..1c84e5769 100644 --- a/FinModelUtility/Platforms/Gx/src/impl/GxFixedFunctionMaterial.cs +++ b/FinModelUtility/Platforms/Gx/src/impl/GxFixedFunctionMaterial.cs @@ -85,13 +85,17 @@ var texCoordGen : null; var wrapModeOverrides = populatedMaterial.TextureWrapModeOverrides?[(int) textureIndex]; + + var wrapModeS = wrapModeOverrides?.wrapModeS ?? gxTexture.WrapModeS; + var wrapModeT = wrapModeOverrides?.wrapModeT ?? gxTexture.WrapModeT; + gxTexture = new GxTexture2d( gxTexture.Name, gxTexture.MipmapImages - .Select(BumpMapUtils.ConvertBumpMapImageToNormalImage) + .Select(i => BumpMapUtils.ConvertBumpMapImageToNormalImage(i, wrapModeS.ToFinWrapMode(), wrapModeT.ToFinWrapMode())) .ToArray(), - wrapModeOverrides?.wrapModeS ?? gxTexture.WrapModeS, - wrapModeOverrides?.wrapModeT ?? gxTexture.WrapModeT, + wrapModeS, + wrapModeT, gxTexture.MinTextureFilter, gxTexture.MagTextureFilter, gxTexture.ColorType);