From 90caaa07c47027121c78237894c8bf249ca66042 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Dec 2025 20:28:32 -0500 Subject: [PATCH] feat: new basestructuremat and defaultlit (for comparison) including shader --- Assets/Map/Materials/Structure Materials.meta | 8 + .../Structure Materials/BaseStructureMat.mat | 156 ++++ .../BaseStructureMat.mat.meta | 8 + .../Structure Materials/DefaultLit.mat | 137 ++++ .../Structure Materials/DefaultLit.mat.meta | 8 + .../ResetBaseStructureShader.shader | 770 ++++++++++++++++++ .../ResetBaseStructureShader.shader.meta | 12 + 7 files changed, 1099 insertions(+) create mode 100644 Assets/Map/Materials/Structure Materials.meta create mode 100644 Assets/Map/Materials/Structure Materials/BaseStructureMat.mat create mode 100644 Assets/Map/Materials/Structure Materials/BaseStructureMat.mat.meta create mode 100644 Assets/Map/Materials/Structure Materials/DefaultLit.mat create mode 100644 Assets/Map/Materials/Structure Materials/DefaultLit.mat.meta create mode 100644 Assets/Map/Materials/Structure Materials/ResetBaseStructureShader.shader create mode 100644 Assets/Map/Materials/Structure Materials/ResetBaseStructureShader.shader.meta diff --git a/Assets/Map/Materials/Structure Materials.meta b/Assets/Map/Materials/Structure Materials.meta new file mode 100644 index 0000000..b4e02be --- /dev/null +++ b/Assets/Map/Materials/Structure Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a6f950bb852729c41b4006f899e578b8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Map/Materials/Structure Materials/BaseStructureMat.mat b/Assets/Map/Materials/Structure Materials/BaseStructureMat.mat new file mode 100644 index 0000000..e2590c0 --- /dev/null +++ b/Assets/Map/Materials/Structure Materials/BaseStructureMat.mat @@ -0,0 +1,156 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-2228814748603009970 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BaseStructureMat + m_Shader: {fileID: 4800000, guid: 0327dc75d6819d949942e18f52b16935, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _NORMALMAP + m_InvalidKeywords: + - _PARALLAXMAP + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: e4da0c5e5eed1124f9e599f0edbc3ead, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: e4da0c5e5eed1124f9e599f0edbc3ead, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 2800000, guid: e76e0cdaf5291124e9c207baedccaae8, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 0.08 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _RampSmoothing: 0.42 + - _RampThreshold: 0.621 + - _ReceiveShadows: 1 + - _ReceiveShadowsOff: 1 + - _RimMax: 0.778 + - _RimMin: 0.493 + - _ShadowLineSmoothing: 0.1 + - _ShadowLineStrength: 1 + - _ShadowLineThreshold: 0.128 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UseNormalMap: 1 + - _UseRim: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 + - _ZWrite: 1 + - __BeginGroup_ShadowHSV: 0 + - __EndGroup: 0 + - __dummy__: 0 + m_Colors: + - _BaseColor: {r: 0.745283, g: 0.745283, b: 0.745283, a: 1} + - _Color: {r: 0.5849056, g: 0.5849056, b: 0.5849056, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _HColor: {r: 0.66522783, g: 0.8139915, b: 0.9339623, a: 1} + - _RimColor: {r: 0, g: 0.46489573, b: 1, a: 0.5} + - _RimDir: {r: 0, g: 0, b: -1, a: 0} + - _SColor: {r: 0.2924528, g: 0.15517698, b: 0.13656995, a: 1} + - _ShadowLineColor: {r: 1, g: 0, b: 0, a: 0.08627451} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/Map/Materials/Structure Materials/BaseStructureMat.mat.meta b/Assets/Map/Materials/Structure Materials/BaseStructureMat.mat.meta new file mode 100644 index 0000000..a7d17b5 --- /dev/null +++ b/Assets/Map/Materials/Structure Materials/BaseStructureMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bf0cac97127c10f4e92189f8ae62a1e0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Map/Materials/Structure Materials/DefaultLit.mat b/Assets/Map/Materials/Structure Materials/DefaultLit.mat new file mode 100644 index 0000000..49183ce --- /dev/null +++ b/Assets/Map/Materials/Structure Materials/DefaultLit.mat @@ -0,0 +1,137 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7216474951084939940 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DefaultLit + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/Map/Materials/Structure Materials/DefaultLit.mat.meta b/Assets/Map/Materials/Structure Materials/DefaultLit.mat.meta new file mode 100644 index 0000000..d5fa895 --- /dev/null +++ b/Assets/Map/Materials/Structure Materials/DefaultLit.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7f57b98b9625ec741b84af7f523be6cb +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Map/Materials/Structure Materials/ResetBaseStructureShader.shader b/Assets/Map/Materials/Structure Materials/ResetBaseStructureShader.shader new file mode 100644 index 0000000..2fdcc51 --- /dev/null +++ b/Assets/Map/Materials/Structure Materials/ResetBaseStructureShader.shader @@ -0,0 +1,770 @@ +// Toony Colors Pro+Mobile 2 +// (c) 2014-2025 Jean Moreno + +Shader "Reset/BaseStructureShader" +{ + Properties + { + [TCP2HeaderHelp(Base)] + _BaseColor ("Color", Color) = (1,1,1,1) + [TCP2ColorNoAlpha] _HColor ("Highlight Color", Color) = (0.75,0.75,0.75,1) + [TCP2ColorNoAlpha] _SColor ("Shadow Color", Color) = (0.2,0.2,0.2,1) + [MainTexture] _BaseMap ("Albedo", 2D) = "white" {} + [TCP2Separator] + + [TCP2Header(Ramp Shading)] + + _RampThreshold ("Threshold", Range(0.01,1)) = 0.5 + _RampSmoothing ("Smoothing", Range(0.001,1)) = 0.5 + [TCP2Separator] + + [TCP2HeaderHelp(Rim Lighting)] + [Toggle(TCP2_RIM_LIGHTING)] _UseRim ("Enable Rim Lighting", Float) = 0 + [TCP2ColorNoAlpha] _RimColor ("Rim Color", Color) = (0.8,0.8,0.8,0.5) + _RimMin ("Rim Min", Range(0,2)) = 0.5 + _RimMax ("Rim Max", Range(0,2)) = 1 + //Rim Direction + _RimDir ("Rim Direction", Vector) = (0,0,1,1) + [TCP2Separator] + + [TCP2HeaderHelp(Normal Mapping)] + [Toggle(_NORMALMAP)] _UseNormalMap ("Enable Normal Mapping", Float) = 0 + [NoScaleOffset] _BumpMap ("Normal Map", 2D) = "bump" {} + _BumpScale ("Scale", Float) = 1 + [NoScaleOffset] _ParallaxMap ("Height Map", 2D) = "black" {} + _Parallax ("Height", Range(0.005,0.08)) = 0.02 + [TCP2Separator] + [HideInInspector] __BeginGroup_ShadowHSV ("Shadow Line", Float) = 0 + _ShadowLineThreshold ("Threshold", Range(0,1)) = 0.5 + _ShadowLineSmoothing ("Smoothing", Range(0.001,0.1)) = 0.015 + _ShadowLineStrength ("Strength", Float) = 1 + _ShadowLineColor ("Color (RGB) Opacity (A)", Color) = (0,0,0,1) + [HideInInspector] __EndGroup ("Shadow Line", Float) = 0 + + [ToggleOff(_RECEIVE_SHADOWS_OFF)] _ReceiveShadowsOff ("Receive Shadows", Float) = 1 + + // Avoid compile error if the properties are ending with a drawer + [HideInInspector] __dummy__ ("unused", Float) = 0 + } + + SubShader + { + Tags + { + "RenderPipeline" = "UniversalPipeline" + "RenderType"="Opaque" + } + + HLSLINCLUDE + #define fixed half + #define fixed2 half2 + #define fixed3 half3 + #define fixed4 half4 + + #if UNITY_VERSION >= 202020 + #define URP_10_OR_NEWER + #endif + #if UNITY_VERSION >= 202120 + #define URP_12_OR_NEWER + #endif + #if UNITY_VERSION >= 202220 + #define URP_14_OR_NEWER + #endif + + // Texture/Sampler abstraction + #define TCP2_TEX2D_WITH_SAMPLER(tex) TEXTURE2D(tex); SAMPLER(sampler##tex) + #define TCP2_TEX2D_NO_SAMPLER(tex) TEXTURE2D(tex) + #define TCP2_TEX2D_SAMPLE(tex, samplertex, coord) SAMPLE_TEXTURE2D(tex, sampler##samplertex, coord) + #define TCP2_TEX2D_SAMPLE_LOD(tex, samplertex, coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler##samplertex, coord, lod) + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + + // Uniforms + + // Shader Properties + TCP2_TEX2D_WITH_SAMPLER(_ParallaxMap); + TCP2_TEX2D_WITH_SAMPLER(_BumpMap); + TCP2_TEX2D_WITH_SAMPLER(_BaseMap); + + CBUFFER_START(UnityPerMaterial) + + // Shader Properties + float _Parallax; + float _BumpScale; + float4 _BaseMap_ST; + fixed4 _BaseColor; + float _RampThreshold; + float _RampSmoothing; + float _ShadowLineThreshold; + float _ShadowLineStrength; + float _ShadowLineSmoothing; + fixed4 _ShadowLineColor; + float4 _RimDir; + float _RimMin; + float _RimMax; + fixed4 _RimColor; + fixed4 _SColor; + fixed4 _HColor; + CBUFFER_END + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ParallaxMapping.hlsl" + + // Calculates UV offset for parallax bump mapping + inline float2 TCP2_ParallaxOffset( half h, half height, half3 viewDir ) + { + h = h * height - height/2.0; + float3 v = normalize(viewDir); + v.z += 0.42; + return h * (v.xy / v.z); + } + + // Cubic pulse function + // Adapted from: http://www.iquilezles.org/www/articles/functions/functions.htm (c) 2017 - Inigo Quilez - MIT License + float linearPulse(float c, float w, float x) + { + x = abs(x - c); + if (x > w) + { + return 0; + } + x /= w; + return 1 - x; + } + + // Built-in renderer (CG) to SRP (HLSL) bindings + #define UnityObjectToClipPos TransformObjectToHClip + #define _WorldSpaceLightPos0 _MainLightPosition + + ENDHLSL + + Pass + { + Name "Main" + Tags + { + "LightMode"="UniversalForward" + } + + HLSLPROGRAM + // Required to compile gles 2.0 with standard SRP library + // All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma target 3.0 + + // ------------------------------------- + // Material keywords + #pragma shader_feature_local _ _RECEIVE_SHADOWS_OFF + + // ------------------------------------- + // Universal Render Pipeline keywords + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH + + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ _CLUSTER_LIGHT_LOOP + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + + // ------------------------------------- + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + + #pragma vertex Vertex + #pragma fragment Fragment + + //-------------------------------------- + // Toony Colors Pro 2 keywords + #pragma shader_feature_local_fragment TCP2_RIM_LIGHTING + #pragma shader_feature_local _NORMALMAP + + // vertex input + struct Attributes + { + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + // vertex output / fragment input + struct Varyings + { + float4 positionCS : SV_POSITION; + float3 normal : NORMAL; + float4 worldPosAndFog : TEXCOORD0; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD1; // compute shadow coord per-vertex for the main light + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + half3 vertexLights : TEXCOORD2; + #endif + float3 pack0 : TEXCOORD3; /* pack0.xyz = tangent */ + float3 pack1 : TEXCOORD4; /* pack1.xyz = bitangent */ + float2 pack2 : TEXCOORD5; /* pack2.xy = texcoord0 */ + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + #if USE_FORWARD_PLUS || USE_CLUSTER_LIGHT_LOOP + // Fake InputData struct needed for Forward+ macro + struct InputDataForwardPlusDummy + { + float3 positionWS; + float2 normalizedScreenSpaceUV; + }; + #endif + + Varyings Vertex(Attributes input) + { + Varyings output = (Varyings)0; + + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + // Texture Coordinates + output.pack2.xy.xy = input.texcoord0.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + + float3 worldPos = mul(UNITY_MATRIX_M, input.vertex).xyz; + VertexPositionInputs vertexInput = GetVertexPositionInputs(input.vertex.xyz); + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + output.shadowCoord = GetShadowCoord(vertexInput); + #endif + + VertexNormalInputs vertexNormalInput = GetVertexNormalInputs(input.normal, input.tangent); + #ifdef _ADDITIONAL_LIGHTS_VERTEX + // Vertex lighting + output.vertexLights = VertexLighting(vertexInput.positionWS, vertexNormalInput.normalWS); + #endif + + // world position + output.worldPosAndFog = float4(vertexInput.positionWS.xyz, 0); + + // normal + output.normal = normalize(vertexNormalInput.normalWS); + + // tangent + output.pack0.xyz = vertexNormalInput.tangentWS; + output.pack1.xyz = vertexNormalInput.bitangentWS; + + // clip position + output.positionCS = vertexInput.positionCS; + + return output; + } + + half4 Fragment(Varyings input + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + float3 positionWS = input.worldPosAndFog.xyz; + float3 normalWS = normalize(input.normal); + half3 viewDirWS = GetWorldSpaceNormalizeViewDir(positionWS); + half3 tangentWS = input.pack0.xyz; + half3 bitangentWS = input.pack1.xyz; + #if defined(_NORMALMAP) + half3x3 tangentToWorldMatrix = half3x3(tangentWS.xyz, bitangentWS.xyz, normalWS.xyz); + //Parallax Offset + float __parallaxHeightMap = ( TCP2_TEX2D_SAMPLE(_ParallaxMap, _ParallaxMap, input.pack2.xy).a ); + float __parallaxHeight = ( _Parallax ); + half height = __parallaxHeightMap; + half3 viewDirTS = GetViewDirectionTangentSpace(half4(tangentWS, 0), normalWS, viewDirWS); + float2 offset = TCP2_ParallaxOffset(height, __parallaxHeight, viewDirTS); + input.pack2.xy += offset; + #endif + + // Shader Properties Sampling + float4 __normalMap = ( TCP2_TEX2D_SAMPLE(_BumpMap, _BumpMap, input.pack2.xy).rgba ); + float __bumpScale = ( _BumpScale ); + float4 __albedo = ( TCP2_TEX2D_SAMPLE(_BaseMap, _BaseMap, input.pack2.xy).rgba ); + float4 __mainColor = ( _BaseColor.rgba ); + float __alpha = ( __albedo.a * __mainColor.a ); + float __ambientIntensity = ( 1.0 ); + float __rampThreshold = ( _RampThreshold ); + float __rampSmoothing = ( _RampSmoothing ); + float __shadowLineThreshold = ( _ShadowLineThreshold ); + float __shadowLineStrength = ( _ShadowLineStrength ); + float __shadowLineSmoothing = ( _ShadowLineSmoothing ); + float4 __shadowLineColor = ( _ShadowLineColor.rgba ); + float3 __rimDir = ( _RimDir.xyz ); + float __rimMin = ( _RimMin ); + float __rimMax = ( _RimMax ); + float3 __rimColor = ( _RimColor.rgb ); + float __rimStrength = ( 1.0 ); + float3 __shadowColor = ( _SColor.rgb ); + float3 __highlightColor = ( _HColor.rgb ); + + #if defined(_NORMALMAP) + half4 normalMap = __normalMap; + half3 normalTS = UnpackNormalScale(normalMap, __bumpScale); + #if defined(_NORMALMAP) + normalWS = normalize( mul(normalTS, tangentToWorldMatrix) ); + #endif + #endif + + // main texture + half3 albedo = __albedo.rgb; + half alpha = __alpha; + + half3 emission = half3(0,0,0); + + albedo *= __mainColor.rgb; + + // main light: direction, color, distanceAttenuation, shadowAttenuation + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord = input.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + float4 shadowCoord = TransformWorldToShadowCoord(positionWS); + #else + float4 shadowCoord = float4(0, 0, 0, 0); + #endif + + #if defined(URP_10_OR_NEWER) + #if defined(SHADOWS_SHADOWMASK) && defined(LIGHTMAP_ON) + half4 shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV); + #elif !defined (LIGHTMAP_ON) + half4 shadowMask = unity_ProbesOcclusion; + #else + half4 shadowMask = half4(1, 1, 1, 1); + #endif + + Light mainLight = GetMainLight(shadowCoord, positionWS, shadowMask); + #else + Light mainLight = GetMainLight(shadowCoord); + #endif + + #if defined(_SCREEN_SPACE_OCCLUSION) || defined(USE_FORWARD_PLUS) || defined(USE_CLUSTER_LIGHT_LOOP) + float2 normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS); + #endif + + // ambient or lightmap + // Samples SH fully per-pixel. SampleSHVertex and SampleSHPixel functions + // are also defined in case you want to sample some terms per-vertex. + half3 bakedGI = SampleSH(normalWS); + half occlusion = 1; + + half3 indirectDiffuse = bakedGI; + indirectDiffuse *= occlusion * albedo * __ambientIntensity; + + half3 lightDir = mainLight.direction; + half3 lightColor = mainLight.color.rgb; + + half atten = mainLight.shadowAttenuation * mainLight.distanceAttenuation; + + half ndl = dot(normalWS, lightDir); + half3 ramp; + + half rampThreshold = __rampThreshold; + half rampSmooth = __rampSmoothing * 0.5; + ndl = saturate(ndl); + ramp = smoothstep(rampThreshold - rampSmooth, rampThreshold + rampSmooth, ndl); + + // apply attenuation + ramp *= atten; + + //Shadow Line + float ndlAtten = ndl * atten; + float shadowLineThreshold = __shadowLineThreshold; + float shadowLineStrength = __shadowLineStrength; + float shadowLineSmoothing = __shadowLineSmoothing; + float shadowLine = min(linearPulse(ndlAtten, shadowLineSmoothing, shadowLineThreshold) * shadowLineStrength, 1.0); + half4 shadowLineColor = __shadowLineColor; + ramp = lerp(ramp.rgb, shadowLineColor.rgb, shadowLine * shadowLineColor.a); + half3 color = half3(0,0,0); + // Rim Lighting + #if defined(TCP2_RIM_LIGHTING) + half3 rViewDir = viewDirWS; + half3 rimDir = __rimDir; + rViewDir = normalize(UNITY_MATRIX_V[0].xyz * rimDir.x + UNITY_MATRIX_V[1].xyz * rimDir.y + UNITY_MATRIX_V[2].xyz * rimDir.z); + half rim = 1.0f - saturate(dot(rViewDir, normalWS)); + rim = ( rim ); + half rimMin = __rimMin; + half rimMax = __rimMax; + rim = smoothstep(rimMin, rimMax, rim); + half3 rimColor = __rimColor; + half rimStrength = __rimStrength; + //Rim light mask + emission.rgb += ndl * atten * rim * rimColor * rimStrength; + #endif + half3 accumulatedRamp = ramp * max(lightColor.r, max(lightColor.g, lightColor.b)); + half3 accumulatedColors = ramp * lightColor.rgb; + + // Additional lights loop + #ifdef _ADDITIONAL_LIGHTS + uint pixelLightCount = GetAdditionalLightsCount(); + + #if USE_FORWARD_PLUS || USE_CLUSTER_LIGHT_LOOP + // Additional directional lights in Forward+ + for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++) + { + CLUSTER_LIGHT_LOOP_SUBTRACTIVE_LIGHT_CHECK + + Light light = GetAdditionalLight(lightIndex, positionWS, shadowMask); + + #if defined(_LIGHT_LAYERS) + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + #endif + { + half atten = light.shadowAttenuation * light.distanceAttenuation; + + #if defined(_LIGHT_LAYERS) + half3 lightDir = half3(0, 1, 0); + half3 lightColor = half3(0, 0, 0); + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + { + lightColor = light.color.rgb; + lightDir = light.direction; + } + #else + half3 lightColor = light.color.rgb; + half3 lightDir = light.direction; + #endif + + half ndl = dot(normalWS, lightDir); + half3 ramp; + + ndl = saturate(ndl); + ramp = smoothstep(rampThreshold - rampSmooth, rampThreshold + rampSmooth, ndl); + + // apply attenuation (shadowmaps & point/spot lights attenuation) + ramp *= atten; + + //Shadow Line + float ndlAtten = ndl * atten; + float shadowLineThreshold = __shadowLineThreshold; + float shadowLineStrength = __shadowLineStrength; + float shadowLineSmoothing = __shadowLineSmoothing; + float shadowLine = min(linearPulse(ndlAtten, shadowLineSmoothing, shadowLineThreshold) * shadowLineStrength, 1.0); + half4 shadowLineColor = __shadowLineColor; + ramp = lerp(ramp.rgb, shadowLineColor.rgb, shadowLine * shadowLineColor.a); + accumulatedRamp += ramp * max(lightColor.r, max(lightColor.g, lightColor.b)); + accumulatedColors += ramp * lightColor.rgb; + + #if defined(TCP2_RIM_LIGHTING) + // Rim light mask + half3 rimColor = __rimColor; + half rimStrength = __rimStrength; + emission.rgb += ndl * atten * rim * rimColor * rimStrength; + #endif + } + } + + // Data with dummy struct used in Forward+ macro (LIGHT_LOOP_BEGIN) + InputDataForwardPlusDummy inputData; + inputData.normalizedScreenSpaceUV = normalizedScreenSpaceUV; + inputData.positionWS = positionWS; + #endif + + LIGHT_LOOP_BEGIN(pixelLightCount) + { + #if defined(URP_10_OR_NEWER) + Light light = GetAdditionalLight(lightIndex, positionWS, shadowMask); + #else + Light light = GetAdditionalLight(lightIndex, positionWS); + #endif + half atten = light.shadowAttenuation * light.distanceAttenuation; + + #if defined(_LIGHT_LAYERS) + half3 lightDir = half3(0, 1, 0); + half3 lightColor = half3(0, 0, 0); + if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers)) + { + lightColor = light.color.rgb; + lightDir = light.direction; + } + #else + half3 lightColor = light.color.rgb; + half3 lightDir = light.direction; + #endif + + half ndl = dot(normalWS, lightDir); + half3 ramp; + + ndl = saturate(ndl); + ramp = smoothstep(rampThreshold - rampSmooth, rampThreshold + rampSmooth, ndl); + + // apply attenuation (shadowmaps & point/spot lights attenuation) + ramp *= atten; + + //Shadow Line + float ndlAtten = ndl * atten; + float shadowLineThreshold = __shadowLineThreshold; + float shadowLineStrength = __shadowLineStrength; + float shadowLineSmoothing = __shadowLineSmoothing; + float shadowLine = min(linearPulse(ndlAtten, shadowLineSmoothing, shadowLineThreshold) * shadowLineStrength, 1.0); + half4 shadowLineColor = __shadowLineColor; + ramp = lerp(ramp.rgb, shadowLineColor.rgb, shadowLine * shadowLineColor.a); + accumulatedRamp += ramp * max(lightColor.r, max(lightColor.g, lightColor.b)); + accumulatedColors += ramp * lightColor.rgb; + + #if defined(TCP2_RIM_LIGHTING) + // Rim light mask + half3 rimColor = __rimColor; + half rimStrength = __rimStrength; + emission.rgb += ndl * atten * rim * rimColor * rimStrength; + #endif + } + LIGHT_LOOP_END + #endif + #ifdef _ADDITIONAL_LIGHTS_VERTEX + color += input.vertexLights * albedo; + #endif + + accumulatedRamp = saturate(accumulatedRamp); + half3 shadowColor = (1 - accumulatedRamp.rgb) * __shadowColor; + accumulatedRamp = accumulatedColors.rgb * __highlightColor + shadowColor; + color += albedo * accumulatedRamp; + + // apply ambient + color += indirectDiffuse; + + color += emission; + + return half4(color, alpha); + } + ENDHLSL + } + + // Depth & Shadow Caster Passes + HLSLINCLUDE + + #if defined(SHADOW_CASTER_PASS) || defined(DEPTH_ONLY_PASS) + + #define fixed half + #define fixed2 half2 + #define fixed3 half3 + #define fixed4 half4 + + float3 _LightDirection; + float3 _LightPosition; + + struct Attributes + { + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 texcoord0 : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 positionCS : SV_POSITION; + #if defined(DEPTH_NORMALS_PASS) + float3 normalWS : TEXCOORD0; + #endif + float3 pack0 : TEXCOORD1; /* pack0.xyz = positionWS */ + float2 pack1 : TEXCOORD2; /* pack1.xy = texcoord0 */ + #if defined(DEPTH_ONLY_PASS) + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + #endif + }; + + float4 GetShadowPositionHClip(Attributes input) + { + float3 positionWS = TransformObjectToWorld(input.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(input.normal); + + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - positionWS); + #else + float3 lightDirectionWS = _LightDirection; + #endif + float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS)); + + #if UNITY_REVERSED_Z + positionCS.z = min(positionCS.z, UNITY_NEAR_CLIP_VALUE); + #else + positionCS.z = max(positionCS.z, UNITY_NEAR_CLIP_VALUE); + #endif + + return positionCS; + } + + Varyings ShadowDepthPassVertex(Attributes input) + { + Varyings output = (Varyings)0; + UNITY_SETUP_INSTANCE_ID(input); + #if defined(DEPTH_ONLY_PASS) + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + #endif + + // Texture Coordinates + output.pack1.xy.xy = input.texcoord0.xy * _BaseMap_ST.xy + _BaseMap_ST.zw; + + float3 worldPos = mul(UNITY_MATRIX_M, input.vertex).xyz; + VertexPositionInputs vertexInput = GetVertexPositionInputs(input.vertex.xyz); + output.pack0.xyz = vertexInput.positionWS; + + #if defined(DEPTH_ONLY_PASS) + output.positionCS = TransformObjectToHClip(input.vertex.xyz); + #if defined(DEPTH_NORMALS_PASS) + float3 normalWS = TransformObjectToWorldNormal(input.normal); + output.normalWS = normalWS; // already normalized in TransformObjectToWorldNormal + #endif + #elif defined(SHADOW_CASTER_PASS) + output.positionCS = GetShadowPositionHClip(input); + #else + output.positionCS = float4(0,0,0,0); + #endif + + return output; + } + + half4 ShadowDepthPassFragment( + Varyings input + #if defined(DEPTH_NORMALS_PASS) && defined(_WRITE_RENDERING_LAYERS) + #if UNITY_VERSION >= 60020000 + , out uint outRenderingLayers : SV_Target1 + #else + , out float4 outRenderingLayers : SV_Target1 + #endif + #endif + ) : SV_TARGET + { + #if defined(DEPTH_ONLY_PASS) + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + #endif + + float3 positionWS = input.pack0.xyz; + + // Shader Properties Sampling + float4 __albedo = ( TCP2_TEX2D_SAMPLE(_BaseMap, _BaseMap, input.pack1.xy).rgba ); + float4 __mainColor = ( _BaseColor.rgba ); + float __alpha = ( __albedo.a * __mainColor.a ); + + half3 viewDirWS = GetWorldSpaceNormalizeViewDir(positionWS); + half3 albedo = half3(1,1,1); + half alpha = __alpha; + half3 emission = half3(0,0,0); + + #if defined(DEPTH_NORMALS_PASS) + #if defined(_WRITE_RENDERING_LAYERS) + #if UNITY_VERSION >= 60020000 + outRenderingLayers = EncodeMeshRenderingLayer(); + #else + outRenderingLayers = float4(EncodeMeshRenderingLayer(GetMeshRenderingLayer()), 0, 0, 0); + #endif + #endif + + #if defined(URP_12_OR_NEWER) + return float4(input.normalWS.xyz, 0.0); + #else + return float4(PackNormalOctRectEncode(TransformWorldToViewDir(input.normalWS, true)), 0.0, 0.0); + #endif + #endif + + return 0; + } + + #endif + ENDHLSL + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + ZWrite On + ZTest LEqual + + HLSLPROGRAM + // Required to compile gles 2.0 with standard srp library + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma target 2.0 + + // using simple #define doesn't work, we have to use this instead + #pragma multi_compile SHADOW_CASTER_PASS + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + + #pragma vertex ShadowDepthPassVertex + #pragma fragment ShadowDepthPassFragment + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + + ENDHLSL + } + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + ZWrite On + ColorMask 0 + + HLSLPROGRAM + + // Required to compile gles 2.0 with standard srp library + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma target 2.0 + + //-------------------------------------- + // GPU Instancing + #pragma multi_compile_instancing + + // using simple #define doesn't work, we have to use this instead + #pragma multi_compile DEPTH_ONLY_PASS + + #pragma vertex ShadowDepthPassVertex + #pragma fragment ShadowDepthPassFragment + + ENDHLSL + } + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + ZWrite On + + HLSLPROGRAM + #pragma exclude_renderers gles gles3 glcore + #pragma target 2.0 + + #pragma multi_compile_instancing + + // using simple #define doesn't work, we have to use this instead + #pragma multi_compile DEPTH_ONLY_PASS + #pragma multi_compile DEPTH_NORMALS_PASS + + #pragma vertex ShadowDepthPassVertex + #pragma fragment ShadowDepthPassFragment + + ENDHLSL + } + + } + + FallBack "Hidden/InternalErrorShader" + CustomEditor "ToonyColorsPro.ShaderGenerator.MaterialInspector_SG2" +} + +/* TCP_DATA u config(ver:"2.9.20";unity:"6000.2.1f1";tmplt:"SG2_Template_URP";features:list["UNITY_5_4","UNITY_5_5","UNITY_5_6","UNITY_2017_1","UNITY_2018_1","UNITY_2018_2","UNITY_2018_3","UNITY_2019_1","UNITY_2019_2","UNITY_2019_3","UNITY_2019_4","UNITY_2020_1","UNITY_2021_1","UNITY_2021_2","UNITY_2022_2","UNITY_6000_2","UNITY_6000_1","UNITY_6000_0","ENABLE_DEPTH_NORMALS_PASS","ENABLE_FORWARD_PLUS","BUMP","BUMP_SCALE","BUMP_SHADER_FEATURE","PARALLAX","RIM","SHADOW_LINE","TEMPLATE_LWRP","RIM_DIR","RIM_SHADER_FEATURE","RIM_LIGHTMASK"];flags:list[];flags_extra:dict[];keywords:dict[RENDER_TYPE="Opaque",RampTextureDrawer="[TCP2Gradient]",RampTextureLabel="Ramp Texture",SHADER_TARGET="3.0",RIM_LABEL="Rim Lighting"];shaderProperties:list[];customTextures:list[];codeInjection:codeInjection(injectedFiles:list[];mark:False);matLayers:list[]) */ +/* TCP_HASH 26ac4c997cc75da0155d69e41faede51 */ diff --git a/Assets/Map/Materials/Structure Materials/ResetBaseStructureShader.shader.meta b/Assets/Map/Materials/Structure Materials/ResetBaseStructureShader.shader.meta new file mode 100644 index 0000000..0ec29ac --- /dev/null +++ b/Assets/Map/Materials/Structure Materials/ResetBaseStructureShader.shader.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0327dc75d6819d949942e18f52b16935 +ShaderImporter: + externalObjects: {} + defaultTextures: + - _NoTileNoiseTex: {fileID: 2800000, guid: af5515bfe14f1af4a9b8b3bf306b9261, type: 3} + - _Ramp: {fileID: 2800000, guid: ccad9b0732473ee4e95de81e50e9050f, type: 3} + - _DitherTex: {fileID: 2800000, guid: f059f76a52d0b374c85c681ed571185e, type: 3} + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: