From f0704c3228580461abefe1c9ccf8ad9ebb2884f5 Mon Sep 17 00:00:00 2001 From: wyrdough Date: Mon, 30 Dec 2024 18:14:07 -0500 Subject: [PATCH] Remove noise from solo effect and tweak effect colors. Also fixes unwanted scaling of solo transition objects and removes unneeded GreyscaleNoise texture. --- .../Gameplay/Track/SoloEffectTransition.mat | 6 +- .../Materials/Gameplay/Track/SoloEffects.mat | 6 +- .../Art/Textures/Gameplay/Track/SoloTrack.png | 4 +- .../Gameplay/Track/SoloTransition.png | 4 +- Assets/Art/Textures/GreyscaleNoise.png | 3 - Assets/Art/Textures/GreyscaleNoise.png.meta | 111 ------------------ .../Visuals/TrackElements/SoloElement.cs | 34 +++++- 7 files changed, 43 insertions(+), 125 deletions(-) delete mode 100644 Assets/Art/Textures/GreyscaleNoise.png delete mode 100644 Assets/Art/Textures/GreyscaleNoise.png.meta diff --git a/Assets/Art/Materials/Gameplay/Track/SoloEffectTransition.mat b/Assets/Art/Materials/Gameplay/Track/SoloEffectTransition.mat index b2cf6dcb7b..9c7c6b2bec 100644 --- a/Assets/Art/Materials/Gameplay/Track/SoloEffectTransition.mat +++ b/Assets/Art/Materials/Gameplay/Track/SoloEffectTransition.mat @@ -43,7 +43,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _EmissionMap: - m_Texture: {fileID: 2800000, guid: c4c44d2ae22032e4990e0c567fbdf72c, type: 3} + m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: @@ -116,8 +116,8 @@ Material: - _ZWrite: 1 m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - - _Color: {r: 0, g: 0.79607844, b: 0.8784314, a: 0.6666667} - - _EmissionColor: {r: 0, g: 2.995996, b: 3.7647054, a: 0.6745098} + - _Color: {r: 0, g: 0.2980392, b: 0.47450978, a: 1} + - _EmissionColor: {r: 0, g: 0.07227186, b: 0.19120172, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] --- !u!114 &2562951267628346201 diff --git a/Assets/Art/Materials/Gameplay/Track/SoloEffects.mat b/Assets/Art/Materials/Gameplay/Track/SoloEffects.mat index 815adaab64..a1ee66a448 100644 --- a/Assets/Art/Materials/Gameplay/Track/SoloEffects.mat +++ b/Assets/Art/Materials/Gameplay/Track/SoloEffects.mat @@ -43,7 +43,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _EmissionMap: - m_Texture: {fileID: 2800000, guid: c4c44d2ae22032e4990e0c567fbdf72c, type: 3} + m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: @@ -117,8 +117,8 @@ Material: - _ZWrite: 0 m_Colors: - _BaseColor: {r: 0.19607845, g: 0.19607845, b: 0.19607845, a: 1} - - _Color: {r: 0, g: 0.7960785, b: 0.87843144, a: 0.6666667} - - _EmissionColor: {r: 0, g: 2.995996, b: 3.7647054, a: 0.6745098} + - _Color: {r: 0, g: 0.2980392, b: 0.47450978, a: 1} + - _EmissionColor: {r: 0, g: 0.07227186, b: 0.1878208, a: 1} - _Solo_Color: {r: 0, g: 1, b: 1, a: 1} - _Solo_End: {r: 0, g: 0, b: 0, a: 0} - _Solo_Start: {r: 0, g: 0, b: 0, a: 0} diff --git a/Assets/Art/Textures/Gameplay/Track/SoloTrack.png b/Assets/Art/Textures/Gameplay/Track/SoloTrack.png index 7edac0b584..31ab99edf0 100644 --- a/Assets/Art/Textures/Gameplay/Track/SoloTrack.png +++ b/Assets/Art/Textures/Gameplay/Track/SoloTrack.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e4f2c1c3a59941fa83eecaf1a40b9c59e5b2074af783d9560ec16429742742f -size 227807 +oid sha256:56432bca20b763358a0fa3669001497878eddb0cda5f884bd43878848a1086eb +size 27244 diff --git a/Assets/Art/Textures/Gameplay/Track/SoloTransition.png b/Assets/Art/Textures/Gameplay/Track/SoloTransition.png index f81381ec4a..149e87e58c 100644 --- a/Assets/Art/Textures/Gameplay/Track/SoloTransition.png +++ b/Assets/Art/Textures/Gameplay/Track/SoloTransition.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68232b99bf7c46e04edd194dd436761e43cfcf8858c0eebf53f755f9e76abaa0 -size 7454 +oid sha256:1215a01c5fb66929aa61db6aedea435cd93817cb24c583ccebb968a9a3109c04 +size 1803 diff --git a/Assets/Art/Textures/GreyscaleNoise.png b/Assets/Art/Textures/GreyscaleNoise.png deleted file mode 100644 index 52a74e840c..0000000000 --- a/Assets/Art/Textures/GreyscaleNoise.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0dec0987c5fbc79b1ebe02b2241cef61d0f37e7ea42e1b7a16ddc56d95268b27 -size 276866 diff --git a/Assets/Art/Textures/GreyscaleNoise.png.meta b/Assets/Art/Textures/GreyscaleNoise.png.meta deleted file mode 100644 index 9e940d86d6..0000000000 --- a/Assets/Art/Textures/GreyscaleNoise.png.meta +++ /dev/null @@ -1,111 +0,0 @@ -fileFormatVersion: 2 -guid: c4c44d2ae22032e4990e0c567fbdf72c -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 12 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMasterTextureLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 0 - wrapV: 0 - wrapW: 0 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - cookieLightType: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - nameFileIdTable: {} - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Script/Gameplay/Visuals/TrackElements/SoloElement.cs b/Assets/Script/Gameplay/Visuals/TrackElements/SoloElement.cs index 9c66223c1b..3a69c1689c 100644 --- a/Assets/Script/Gameplay/Visuals/TrackElements/SoloElement.cs +++ b/Assets/Script/Gameplay/Visuals/TrackElements/SoloElement.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -18,9 +19,40 @@ public class SoloElement : TrackElement protected override void InitializeElement() { - var zScale = (float) (SoloRef.EndTime - SoloRef.StartTime) * Player.NoteSpeed / 10; + // More correctly, this would get the unscaled size of the object + // Since we currently use Unity's plane, this works + const float zSize = 10.0f; + float childZBasePosition = zSize / 2; + var zScale = (float) (SoloRef.EndTime - SoloRef.StartTime) * Player.NoteSpeed / zSize; var cachedTransform = _meshRenderer.transform; + + // A bit of hackery is necessary to avoid the rescaling of the + // parent from messing up the scaling of the children + var children = cachedTransform.GetComponentsInChildren(); + var scaleFactor = zScale / zSize; + foreach (var child in children) + { + if (child == cachedTransform) + { + continue; + } + // Change the child's scale such that their world size remains the same after the parent scales + var originalScale = 0.005f; // this should be child.localScale.z, but that causes issues if the object gets reused + var newScale = originalScale / scaleFactor; + child.localScale = child.localScale.WithZ(newScale); + // Adjust the child's position to reflect the new scale + var signFactor = Math.Sign(child.localPosition.z); + var newZ = (childZBasePosition + newScale * childZBasePosition) * signFactor; + // This fudge shouldn't be necessary, but without it there is sometimes + // a visible gap in the rail between the transition and main section + // I assume this is because of rounding errors with small float values + newZ += 0.001f * -signFactor; + + child.localPosition = child.localPosition.WithZ(newZ); + } + // With the adjustments to the children made, we can scale the + // parent and have everything end up in the right place cachedTransform.localScale = cachedTransform.localScale.WithZ(zScale); }