From e6aac3e6ea27c4a8bb2673ec3994263e5aab7e9a Mon Sep 17 00:00:00 2001 From: Manuel Rauber Date: Sun, 21 Jan 2024 13:55:42 +0100 Subject: [PATCH] feat: use a decal projector for target indication #393 --- .../Assets/_Game/Materials/Target.mat | 6 +- .../Prefabs/Targets/TargetIndicator.prefab | 90 +--- .../_Game/Shaders/Ring_Shader.shadergraph | 446 ++++-------------- 3 files changed, 109 insertions(+), 433 deletions(-) diff --git a/FairyTaleDefender/Assets/_Game/Materials/Target.mat b/FairyTaleDefender/Assets/_Game/Materials/Target.mat index 85d4d6edd..68cb93e4c 100644 --- a/FairyTaleDefender/Assets/_Game/Materials/Target.mat +++ b/FairyTaleDefender/Assets/_Game/Materials/Target.mat @@ -30,7 +30,7 @@ Material: m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: 4000 + m_CustomRenderQueue: -1 stringTagMap: {} disabledShaderPasses: [] m_LockedProperties: @@ -104,8 +104,12 @@ Material: - _ClearCoatSmoothness: 0 - _Cull: 2 - _Cutoff: 0.5 + - _DecalMeshBiasType: 0 + - _DecalMeshDepthBias: 0 + - _DecalMeshViewBias: 0 - _DetailAlbedoMapScale: 1 - _DetailNormalMapScale: 1 + - _DrawOrder: 0 - _DstBlend: 0 - _DstBlendAlpha: 0 - _EnvironmentReflections: 1 diff --git a/FairyTaleDefender/Assets/_Game/Prefabs/Targets/TargetIndicator.prefab b/FairyTaleDefender/Assets/_Game/Prefabs/Targets/TargetIndicator.prefab index 803a2c14a..68d6ebbac 100644 --- a/FairyTaleDefender/Assets/_Game/Prefabs/Targets/TargetIndicator.prefab +++ b/FairyTaleDefender/Assets/_Game/Prefabs/Targets/TargetIndicator.prefab @@ -9,9 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 6014485345876166067} - - component: {fileID: 1984820504121016342} - - component: {fileID: 7883231429546155381} - - component: {fileID: 1224370384995479385} + - component: {fileID: 1177121223215039244} m_Layer: 0 m_Name: TargetIndicator m_TagString: Untagged @@ -28,81 +26,33 @@ Transform: m_GameObject: {fileID: 3949593316030231720} serializedVersion: 2 m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0, y: 0.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} ---- !u!33 &1984820504121016342 -MeshFilter: +--- !u!114 &1177121223215039244 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3949593316030231720} - m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &7883231429546155381 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3949593316030231720} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: d67ac06f02370410eb993e8ae83ecc15, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!64 &1224370384995479385 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3949593316030231720} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 m_Enabled: 1 - serializedVersion: 5 - m_Convex: 0 - m_CookingOptions: 30 - m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0777d029ed3dffa4692f417d4aba19ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: d67ac06f02370410eb993e8ae83ecc15, type: 2} + m_DrawDistance: 1000 + m_FadeScale: 0.9 + m_StartAngleFade: 180 + m_EndAngleFade: 180 + m_UVScale: {x: 1, y: 1} + m_UVBias: {x: 0, y: 0} + m_DecalLayerMask: 1 + m_ScaleMode: 0 + m_Offset: {x: 0, y: 0, z: 0.5} + m_Size: {x: 1, y: 1, z: 1} + m_FadeFactor: 1 diff --git a/FairyTaleDefender/Assets/_Game/Shaders/Ring_Shader.shadergraph b/FairyTaleDefender/Assets/_Game/Shaders/Ring_Shader.shadergraph index 91d633f4a..af9ea26f1 100644 --- a/FairyTaleDefender/Assets/_Game/Shaders/Ring_Shader.shadergraph +++ b/FairyTaleDefender/Assets/_Game/Shaders/Ring_Shader.shadergraph @@ -39,21 +39,6 @@ { "m_Id": "1ddf486e48114975ba5d799ce07eb6c9" }, - { - "m_Id": "f468af6e91424f8c9f09e8d41bb57fbc" - }, - { - "m_Id": "d1b1887c756b45ae8973f9055dc0e212" - }, - { - "m_Id": "b78b90ff8a9241d4a207e4dd17806158" - }, - { - "m_Id": "5d9a097e3a804375b563fcd6aadbeb31" - }, - { - "m_Id": "f4b9bc1cab834a0798685dbf0e55dbb1" - }, { "m_Id": "afef10d503944741ab8bfb3f774ed678" }, @@ -97,7 +82,7 @@ "m_Id": "0fca7cbd2b2a4f3c963a513ca7501e61" }, { - "m_Id": "33937cde39904be7bc6d227757b6eb37" + "m_Id": "d6d917961dd14b68b58b17f1c0df1d6c" } ], "m_GroupDatas": [], @@ -336,7 +321,7 @@ }, "m_InputSlot": { "m_Node": { - "m_Id": "b78b90ff8a9241d4a207e4dd17806158" + "m_Id": "d6d917961dd14b68b58b17f1c0df1d6c" }, "m_SlotId": 0 } @@ -368,26 +353,11 @@ { "m_Id": "56c9b2e8eb99436a86c73cd7f66ca7e5" }, - { - "m_Id": "f468af6e91424f8c9f09e8d41bb57fbc" - }, - { - "m_Id": "d1b1887c756b45ae8973f9055dc0e212" - }, - { - "m_Id": "b78b90ff8a9241d4a207e4dd17806158" - }, - { - "m_Id": "5d9a097e3a804375b563fcd6aadbeb31" - }, - { - "m_Id": "f4b9bc1cab834a0798685dbf0e55dbb1" - }, { "m_Id": "0fca7cbd2b2a4f3c963a513ca7501e61" }, { - "m_Id": "33937cde39904be7bc6d227757b6eb37" + "m_Id": "d6d917961dd14b68b58b17f1c0df1d6c" } ] }, @@ -411,21 +381,6 @@ ] } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", - "m_ObjectId": "09f14d6d05cd407ea93e08fbeb250a7e", - "m_Id": 0, - "m_DisplayName": "Ambient Occlusion", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "Occlusion", - "m_StageCapability": 2, - "m_Value": 1.0, - "m_DefaultValue": 1.0, - "m_Labels": [] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -568,40 +523,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.BlockNode", - "m_ObjectId": "33937cde39904be7bc6d227757b6eb37", - "m_Group": { - "m_Id": "" - }, - "m_Name": "SurfaceDescription.AlphaClipThreshold", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": 0.0, - "y": 0.0, - "width": 0.0, - "height": 0.0 - } - }, - "m_Slots": [ - { - "m_Id": "bb840af4867c4303a5c37dab6ca2dabb" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_DismissedVersion": 0, - "m_PreviewMode": 0, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_SerializedDescriptor": "SurfaceDescription.AlphaClipThreshold" -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -689,21 +610,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", - "m_ObjectId": "44f4ff05ca7646af9454c8c4fe917ed3", - "m_Id": 0, - "m_DisplayName": "Metallic", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "Metallic", - "m_StageCapability": 2, - "m_Value": 0.0, - "m_DefaultValue": 0.0, - "m_Labels": [] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -951,21 +857,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", - "m_ObjectId": "55b7e8a9c4fa4637b9aab57def40c125", - "m_Id": 0, - "m_DisplayName": "Smoothness", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "Smoothness", - "m_StageCapability": 2, - "m_Value": 0.5, - "m_DefaultValue": 0.5, - "m_Labels": [] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.BlockNode", @@ -1073,40 +964,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.BlockNode", - "m_ObjectId": "5d9a097e3a804375b563fcd6aadbeb31", - "m_Group": { - "m_Id": "" - }, - "m_Name": "SurfaceDescription.Occlusion", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": 0.0, - "y": 0.0, - "width": 0.0, - "height": 0.0 - } - }, - "m_Slots": [ - { - "m_Id": "09f14d6d05cd407ea93e08fbeb250a7e" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_DismissedVersion": 0, - "m_PreviewMode": 0, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_SerializedDescriptor": "SurfaceDescription.Occlusion" -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -1223,6 +1080,36 @@ } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "692e2324468d4f678ad5025fcac81b77", + "m_Id": 0, + "m_DisplayName": "Emission", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Emission", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_ColorMode": 1, + "m_DefaultColor": { + "r": 0.0, + "g": 0.0, + "b": 0.0, + "a": 1.0 + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -1339,6 +1226,22 @@ } } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalDecalSubTarget", + "m_ObjectId": "82a30f9922564340b3fcb31ed4665a68", + "m_DecalData": { + "affectsAlbedo": false, + "affectsNormalBlend": false, + "affectsNormal": false, + "affectsMAOS": false, + "affectsEmission": true, + "drawOrder": 0, + "supportLodCrossFade": false, + "angleFade": false + } +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.PropertyNode", @@ -1610,16 +1513,6 @@ ] } -{ - "m_SGVersion": 2, - "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalLitSubTarget", - "m_ObjectId": "a6e6215e0320447f8888e0b04e713a9f", - "m_WorkflowMode": 1, - "m_NormalDropOffSpace": 0, - "m_ClearCoat": false, - "m_BlendModePreserveSpecular": true -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -1796,40 +1689,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.BlockNode", - "m_ObjectId": "b78b90ff8a9241d4a207e4dd17806158", - "m_Group": { - "m_Id": "" - }, - "m_Name": "SurfaceDescription.Emission", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": 0.0, - "y": 0.0, - "width": 0.0, - "height": 0.0 - } - }, - "m_Slots": [ - { - "m_Id": "c19ff669e4ff45a28e6e6ddffbf102af" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_DismissedVersion": 0, - "m_PreviewMode": 0, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_SerializedDescriptor": "SurfaceDescription.Emission" -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.OneMinusNode", @@ -1894,21 +1753,6 @@ "m_Space": 0 } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", - "m_ObjectId": "bb840af4867c4303a5c37dab6ca2dabb", - "m_Id": 0, - "m_DisplayName": "Alpha Clip Threshold", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "AlphaClipThreshold", - "m_StageCapability": 2, - "m_Value": 0.5, - "m_DefaultValue": 0.5, - "m_Labels": [] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -2015,43 +1859,13 @@ "m_OutputChannel": 0 } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", - "m_ObjectId": "c19ff669e4ff45a28e6e6ddffbf102af", - "m_Id": 0, - "m_DisplayName": "Emission", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "Emission", - "m_StageCapability": 2, - "m_Value": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_DefaultValue": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_Labels": [], - "m_ColorMode": 1, - "m_DefaultColor": { - "r": 0.0, - "g": 0.0, - "b": 0.0, - "a": 1.0 - } -} - { "m_SGVersion": 1, "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", "m_ObjectId": "c52ba73fd4104ffb9b52845f3c20ba94", "m_Datas": [], "m_ActiveSubTarget": { - "m_Id": "a6e6215e0320447f8888e0b04e713a9f" + "m_Id": "82a30f9922564340b3fcb31ed4665a68" }, "m_AllowMaterialOverride": false, "m_SurfaceType": 1, @@ -2156,40 +1970,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.BlockNode", - "m_ObjectId": "d1b1887c756b45ae8973f9055dc0e212", - "m_Group": { - "m_Id": "" - }, - "m_Name": "SurfaceDescription.NormalTS", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": 0.0, - "y": 0.0, - "width": 0.0, - "height": 0.0 - } - }, - "m_Slots": [ - { - "m_Id": "e69abb22a58a4d54a12d7e692dddeb7a" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_DismissedVersion": 0, - "m_PreviewMode": 0, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_SerializedDescriptor": "SurfaceDescription.NormalTS" -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", @@ -2229,6 +2009,40 @@ "m_Labels": [] } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "d6d917961dd14b68b58b17f1c0df1d6c", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Emission", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "692e2324468d4f678ad5025fcac81b77" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Emission" +} + { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.MultiplyNode", @@ -2369,64 +2183,6 @@ "m_Labels": [] } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", - "m_ObjectId": "e69abb22a58a4d54a12d7e692dddeb7a", - "m_Id": 0, - "m_DisplayName": "Normal (Tangent Space)", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "NormalTS", - "m_StageCapability": 2, - "m_Value": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_DefaultValue": { - "x": 0.0, - "y": 0.0, - "z": 0.0 - }, - "m_Labels": [], - "m_Space": 3 -} - -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.BlockNode", - "m_ObjectId": "f468af6e91424f8c9f09e8d41bb57fbc", - "m_Group": { - "m_Id": "" - }, - "m_Name": "SurfaceDescription.Smoothness", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": 0.0, - "y": 0.0, - "width": 0.0, - "height": 0.0 - } - }, - "m_Slots": [ - { - "m_Id": "55b7e8a9c4fa4637b9aab57def40c125" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_DismissedVersion": 0, - "m_PreviewMode": 0, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_SerializedDescriptor": "SurfaceDescription.Smoothness" -} - { "m_SGVersion": 1, "m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty", @@ -2455,40 +2211,6 @@ } } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.BlockNode", - "m_ObjectId": "f4b9bc1cab834a0798685dbf0e55dbb1", - "m_Group": { - "m_Id": "" - }, - "m_Name": "SurfaceDescription.Metallic", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": 0.0, - "y": 0.0, - "width": 0.0, - "height": 0.0 - } - }, - "m_Slots": [ - { - "m_Id": "44f4ff05ca7646af9454c8c4fe917ed3" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_DismissedVersion": 0, - "m_PreviewMode": 0, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_SerializedDescriptor": "SurfaceDescription.Metallic" -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.BlockNode",