diff --git a/Assets/01.Scenes/03.Sail.unity b/Assets/01.Scenes/03.Sail.unity index fce1ae440..037ff2cae 100644 --- a/Assets/01.Scenes/03.Sail.unity +++ b/Assets/01.Scenes/03.Sail.unity @@ -1843,7 +1843,7 @@ Transform: - {fileID: 721365039} - {fileID: 1498712852} - {fileID: 727333638} - - {fileID: 740990765} + - {fileID: 670561796} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &89219353 @@ -11098,247 +11098,6 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 328888839} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!21 &331812090 -Material: - serializedVersion: 8 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: AllIn1Vfx/AllIn1Vfx - m_Shader: {fileID: 4800000, guid: 6eb86e4931b506a408fd1477edec61ea, type: 3} - m_Parent: {fileID: 0} - m_ModifiedSerializedProperties: 0 - m_ValidKeywords: - - ADDITIVECONFIG_ON - m_InvalidKeywords: [] - m_LightmapFlags: 4 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 - stringTagMap: - RenderType: Transparent - disabledShaderPasses: [] - m_LockedProperties: - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _ColorRampTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ColorRampTexGradient: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DistNormalMap: - m_Texture: {fileID: 2800000, guid: 06907d08092c41f4aa8b5b3cbe5f9fa2, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DistortTex: - m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _FadeBurnTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _FadeTex: - m_Texture: {fileID: 2800000, guid: 854b25bc08516364da5a786b1cad247e, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _GlowTex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 2800000, guid: 5e9ddf7ec70ee3e48bb89664de649cd3, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MaskTex: - m_Texture: {fileID: 2800000, guid: 2f6642b43dc405d498acba7e288c068c, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Shape1MaskTex: - m_Texture: {fileID: 2800000, guid: db8fa36fcfe9738418db54ee0fe17fdf, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Shape2DistortTex: - m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Shape2Tex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Shape3DistortTex: - m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _Shape3Tex: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ShapeDistortTex: - m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _TrailWidthGradient: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _VertOffsetTex: - m_Texture: {fileID: 2800000, guid: 48da24d771916524899d36e4bfe7f762, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Ints: [] - m_Floats: - - _Alpha: 1 - - _AlphaCutoffValue: 0.25 - - _AlphaFadeAmount: -0.1 - - _AlphaFadePow: 1 - - _AlphaFadeSmooth: 0.075 - - _AlphaStepMax: 0.075 - - _AlphaStepMin: 0 - - _CamDistFadeStepMax: 100 - - _CamDistFadeStepMin: 0 - - _CamDistProximityFade: 0 - - _ColorGradingMidPoint: 0.5 - - _ColorMask: 15 - - _ColorRampBlend: 1 - - _ColorRampLuminosity: 0 - - _CullingOption: 0 - - _DebugShape: 1 - - _DepthGlow: 1 - - _DepthGlowDist: 0.5 - - _DepthGlowGlobal: 1 - - _DepthGlowPow: 1 - - _DistortAmount: 0.5 - - _DistortTexXSpeed: 5 - - _DistortTexYSpeed: 5 - - _DistortionBlend: 1 - - _DistortionPower: 10 - - _DistortionScrollXSpeed: 0 - - _DistortionScrollYSpeed: 0 - - _DstMode: 1 - - _EditorDrawers: 60 - - _FadeAmount: -0.1 - - _FadeBurnGlow: 5 - - _FadeBurnWidth: 0.01 - - _FadePower: 1 - - _FadeScrollXSpeed: 0 - - _FadeScrollYSpeed: 0 - - _FadeTransition: 0.075 - - _Glow: 0 - - _GlowGlobal: 1 - - _HandDrawnAmount: 10 - - _HandDrawnSpeed: 5 - - _HsvBright: 1 - - _HsvSaturation: 1 - - _HsvShift: 180 - - _LightAmount: 0 - - _MaskPow: 1 - - _OffsetSh1: 1 - - _OffsetSh2: 1 - - _OffsetSh3: 1 - - _PixelateSize: 32 - - _PosterizeNumColors: 5 - - _RandomSh1Mult: 1 - - _RandomSh2Mult: 1 - - _RandomSh3Mult: 1 - - _RenderingMode: 1 - - _RimAddAmount: 1 - - _RimBias: 0 - - _RimErodesAlpha: 0 - - _RimIntensity: 1 - - _RimPower: 5 - - _RimScale: 1 - - _RoundWaveSpeed: 2 - - _RoundWaveStrength: 0.7 - - _ScreenUvSh2DistScale: 1 - - _ScreenUvSh3DistScale: 1 - - _ScreenUvShDistScale: 1 - - _Sh1BlendOffset: 0 - - _Sh2BlendOffset: 0 - - _Sh3BlendOffset: 0 - - _ShadowAmount: 0.4 - - _ShadowStepMax: 1 - - _ShadowStepMin: 0 - - _ShakeUvSpeed: 20 - - _ShakeUvX: 5 - - _ShakeUvY: 4 - - _Shape1MaskPow: 1 - - _Shape2AlphaWeight: 2 - - _Shape2Brightness: 0 - - _Shape2ColorWeight: 2 - - _Shape2Contrast: 1 - - _Shape2DistortAmount: 0.5 - - _Shape2DistortXSpeed: 0.1 - - _Shape2DistortYSpeed: 0.1 - - _Shape2RotationOffset: 0 - - _Shape2RotationSpeed: 0 - - _Shape2XSpeed: 0 - - _Shape2YSpeed: 0 - - _Shape3AlphaWeight: 2 - - _Shape3Brightness: 0 - - _Shape3ColorWeight: 2 - - _Shape3Contrast: 1 - - _Shape3DistortAmount: 0.5 - - _Shape3DistortXSpeed: 0.1 - - _Shape3DistortYSpeed: 0.1 - - _Shape3RotationOffset: 0 - - _Shape3RotationSpeed: 0 - - _Shape3XSpeed: 0 - - _Shape3YSpeed: 0 - - _ShapeAlphaWeight: 1 - - _ShapeBrightness: 0 - - _ShapeColorWeight: 1 - - _ShapeContrast: 1 - - _ShapeDistortAmount: 0.5 - - _ShapeDistortXSpeed: 0.1 - - _ShapeDistortYSpeed: 0.1 - - _ShapeRotationOffset: 0 - - _ShapeRotationSpeed: 0 - - _ShapeXSpeed: 0 - - _ShapeYSpeed: 0 - - _SoftFactor: 0.5 - - _SrcMode: 1 - - _TextureScrollXSpeed: 1 - - _TextureScrollYSpeed: 0 - - _TimingSeed: 0 - - _TrailWidthPower: 1 - - _TwistUvAmount: 1 - - _TwistUvPosX: 0.5 - - _TwistUvPosY: 0.5 - - _TwistUvRadius: 0.75 - - _VertOffsetAmount: 0.5 - - _VertOffsetPower: 1 - - _VertOffsetTexXSpeed: 0.1 - - _VertOffsetTexYSpeed: 0.1 - - _WaveAmount: 7 - - _WaveSpeed: 10 - - _WaveStrength: 7.5 - - _WaveX: 0 - - _WaveY: 0.5 - - _ZTestMode: 4 - - _ZWrite: 0 - m_Colors: - - _BackFaceTint: {r: 0.5, g: 0.5, b: 0.5, a: 1} - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _ColorGradingDark: {r: 1, g: 1, b: 1, a: 1} - - _ColorGradingLight: {r: 1, g: 1, b: 1, a: 1} - - _ColorGradingMiddle: {r: 1, g: 1, b: 1, a: 1} - - _DepthGlowColor: {r: 1, g: 1, b: 1, a: 1} - - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} - - _FrontFaceTint: {r: 1, g: 1, b: 1, a: 1} - - _GlowColor: {r: 1, g: 1, b: 1, a: 1} - - _LightColor: {r: 1, g: 1, b: 1, a: 1} - - _RimColor: {r: 1, g: 1, b: 1, a: 1} - - _Shape2Color: {r: 1, g: 1, b: 1, a: 1} - - _Shape3Color: {r: 1, g: 1, b: 1, a: 1} - - _ShapeColor: {r: 1, g: 1, b: 1, a: 1} - m_BuildTextureStacks: [] - m_AllowLocking: 1 --- !u!1001 &340467653 PrefabInstance: m_ObjectHideFlags: 0 @@ -17166,7 +16925,7 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 669821308} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &672349456 +--- !u!1 &670561795 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -17174,1730 +16933,10 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 672349457} - - component: {fileID: 672349460} - - component: {fileID: 672349459} - - component: {fileID: 672349458} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &672349457 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 672349456} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 40, y: 0, z: 55} - m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 727333638} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!64 &672349458 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 672349456} - 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: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &672349459 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 672349456} - m_Enabled: 1 - m_CastShadows: 1 - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &672349460 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 672349456} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1001 &675391285 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1921625339} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.x - value: -1 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.z - value: 1.73 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7069325 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.x - value: -0.7072802 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.y - value: 0.0010988206 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.z - value: 0.00020856084 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -89.929 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0.034 - objectReference: {fileID: 0} - - target: {fileID: -7511558181221131132, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} - - target: {fileID: 919132149155446097, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_Name - value: hex_grass (6) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} ---- !u!1001 &680825964 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1921625339} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.x - value: 9.13 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.y - value: -0.03999999 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.z - value: 5.2399993 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.x - value: -0.7071068 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -90 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -7511558181221131132, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} - - target: {fileID: 919132149155446097, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_Name - value: hex_grass (30) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} ---- !u!4 &680825965 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - m_PrefabInstance: {fileID: 680825964} - m_PrefabAsset: {fileID: 0} ---- !u!1 &686996706 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 686996707} - - component: {fileID: 686996710} - - component: {fileID: 686996709} - - component: {fileID: 686996708} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &686996707 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 686996706} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -30, y: 0, z: 30} - m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 727333638} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!64 &686996708 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 686996706} - 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: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &686996709 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 686996706} - m_Enabled: 1 - m_CastShadows: 1 - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &686996710 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 686996706} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1001 &690535386 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1921625339} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.x - value: 14.11 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.y - value: 0.46 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalPosition.z - value: -0.050000668 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.x - value: -0.7071068 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -90 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -7511558181221131132, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} - - target: {fileID: 919132149155446097, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - propertyPath: m_Name - value: hex_grass (33) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} ---- !u!4 &690535387 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} - m_PrefabInstance: {fileID: 690535386} - m_PrefabAsset: {fileID: 0} ---- !u!1 &692873316 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 692873317} - - component: {fileID: 692873320} - - component: {fileID: 692873319} - - component: {fileID: 692873318} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &692873317 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 692873316} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 10, y: 0, z: 25} - m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 727333638} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!64 &692873318 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 692873316} - 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: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &692873319 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 692873316} - m_Enabled: 1 - m_CastShadows: 1 - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &692873320 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 692873316} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &696789729 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 696789730} - - component: {fileID: 696789733} - - component: {fileID: 696789732} - - component: {fileID: 696789731} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &696789730 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 696789729} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 45, y: 0, z: 25} - m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 727333638} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!64 &696789731 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 696789729} - 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: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &696789732 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 696789729} - m_Enabled: 1 - m_CastShadows: 1 - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &696789733 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 696789729} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &701590825 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 701590826} - - component: {fileID: 701590829} - - component: {fileID: 701590828} - - component: {fileID: 701590827} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &701590826 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 701590825} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 55, y: 0, z: 45} - m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 727333638} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!64 &701590827 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 701590825} - 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: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &701590828 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 701590825} - m_Enabled: 1 - m_CastShadows: 1 - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &701590829 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 701590825} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1001 &703146488 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1921625339} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalPosition.x - value: -7.04 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalPosition.y - value: -0.03999999 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalPosition.z - value: 12.13 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalRotation.w - value: 0.61237246 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalRotation.x - value: -0.61237246 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalRotation.y - value: -0.3535534 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalRotation.z - value: -0.3535534 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -90 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: -60 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -7511558181221131132, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} - - target: {fileID: 919132149155446097, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - propertyPath: m_Name - value: hex_coast_E (2) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} ---- !u!4 &703146489 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} - m_PrefabInstance: {fileID: 703146488} - m_PrefabAsset: {fileID: 0} ---- !u!1 &712182950 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 712182951} - - component: {fileID: 712182954} - - component: {fileID: 712182953} - - component: {fileID: 712182952} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &712182951 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 712182950} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -60, y: 0, z: 50} - m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 727333638} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!64 &712182952 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 712182950} - 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: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &712182953 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 712182950} - m_Enabled: 1 - m_CastShadows: 1 - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &712182954 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 712182950} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1001 &712573723 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 1921625339} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalPosition.x - value: -4 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalPosition.z - value: 3.4 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalRotation.w - value: 0.3555904 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalRotation.x - value: -0.3515124 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalRotation.y - value: -0.6111919 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalRotation.z - value: -0.61354625 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -89.619 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: -30.001 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: -89.999 - objectReference: {fileID: 0} - - target: {fileID: -7511558181221131132, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} - - target: {fileID: 919132149155446097, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - propertyPath: m_Name - value: hex_coast_C_waterless (1) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} ---- !u!4 &712573724 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} - m_PrefabInstance: {fileID: 712573723} - m_PrefabAsset: {fileID: 0} ---- !u!1 &720424899 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 720424900} - m_Layer: 0 - m_Name: ---------------Managers--------------- - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &720424900 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 720424899} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &721365038 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 721365039} - - component: {fileID: 721365042} - - component: {fileID: 721365041} - - component: {fileID: 721365040} - m_Layer: 0 - m_Name: CinemachineCamera_Top - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &721365039 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 721365038} - serializedVersion: 2 - m_LocalRotation: {x: 0.70090926, y: 0.0000009683705, z: -0.00000095161505, w: 0.7132505} - m_LocalPosition: {x: 0, y: 10, z: -0.1} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 89219352} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &721365040 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 721365038} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f38bda98361e1de48a4ca2bd86ea3c17, type: 3} - m_Name: - m_EditorClassIdentifier: - Composition: - ScreenPosition: {x: 0, y: 0} - DeadZone: - Enabled: 0 - Size: {x: 0.2, y: 0.2} - HardLimits: - Enabled: 0 - Size: {x: 0.8, y: 0.8} - Offset: {x: 0, y: 0} - CenterOnActivate: 1 - TargetOffset: {x: 0, y: 0, z: 0} - Damping: {x: 0.5, y: 0.5} - Lookahead: - Enabled: 0 - Time: 0 - Smoothing: 0 - IgnoreY: 0 ---- !u!114 &721365041 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 721365038} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} - m_Name: - m_EditorClassIdentifier: - TrackerSettings: - BindingMode: 4 - PositionDamping: {x: 0, y: 0, z: 0} - AngularDampingMode: 0 - RotationDamping: {x: 1, y: 1, z: 1} - QuaternionDamping: 1 - FollowOffset: {x: 0, y: 10, z: -0.1} ---- !u!114 &721365042 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 721365038} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} - m_Name: - m_EditorClassIdentifier: - Priority: - Enabled: 0 - m_Value: 0 - OutputChannel: 1 - StandbyUpdate: 2 - m_StreamingVersion: 20241001 - m_LegacyPriority: 0 - Target: - TrackingTarget: {fileID: 89219352} - LookAtTarget: {fileID: 0} - CustomLookAtTarget: 0 - Lens: - FieldOfView: 60.000004 - OrthographicSize: 5 - NearClipPlane: 0.3 - FarClipPlane: 1000 - Dutch: 0 - ModeOverride: 0 - PhysicalProperties: - GateFit: 2 - SensorSize: {x: 21.946, y: 16.002} - LensShift: {x: 0, y: 0} - FocusDistance: 10 - Iso: 200 - ShutterSpeed: 0.005 - Aperture: 16 - BladeCount: 5 - Curvature: {x: 2, y: 11} - BarrelClipping: 0.25 - Anamorphism: 0 - BlendHint: 0 ---- !u!1 &726620383 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 726620385} - - component: {fileID: 726620384} - m_Layer: 0 - m_Name: Reflection Probe - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!215 &726620384 -ReflectionProbe: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 726620383} - m_Enabled: 1 - serializedVersion: 2 - m_Type: 0 - m_Mode: 1 - m_RefreshMode: 0 - m_TimeSlicingMode: 0 - m_Resolution: 128 - m_UpdateFrequency: 0 - m_BoxSize: {x: 1000, y: 1000, z: 1000} - m_BoxOffset: {x: 0, y: 0, z: 0} - m_NearClip: 0.3 - m_FarClip: 1000 - m_ShadowDistance: 100 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_IntensityMultiplier: 1 - m_BlendDistance: 1 - m_HDR: 1 - m_BoxProjection: 0 - m_RenderDynamicObjects: 0 - m_UseOcclusionCulling: 1 - m_Importance: 1 - m_CustomBakedTexture: {fileID: 0} ---- !u!4 &726620385 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 726620383} - serializedVersion: 2 - m_LocalRotation: {x: -0.20419724, y: -0.039053436, z: 0.00814323, w: -0.9781166} - m_LocalPosition: {x: 135.1233, y: 0.57663536, z: -35.99004} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &727333637 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 727333638} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &727333638 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 727333637} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 841528159} - - {fileID: 1737773901} - - {fileID: 1922280582} - - {fileID: 1028682306} - - {fileID: 1073917286} - - {fileID: 2081240041} - - {fileID: 1734679852} - - {fileID: 828999885} - - {fileID: 2063344127} - - {fileID: 1087557892} - - {fileID: 2045301518} - - {fileID: 905456350} - - {fileID: 179726014} - - {fileID: 2051461981} - - {fileID: 1717408764} - - {fileID: 179826817} - - {fileID: 1972417028} - - {fileID: 1260057512} - - {fileID: 1239727194} - - {fileID: 306035878} - - {fileID: 395650108} - - {fileID: 288792490} - - {fileID: 994885894} - - {fileID: 696789730} - - {fileID: 1178698711} - - {fileID: 2031778141} - - {fileID: 483508478} - - {fileID: 622417897} - - {fileID: 1902760377} - - {fileID: 1053523136} - - {fileID: 57103045} - - {fileID: 1099084994} - - {fileID: 1192304522} - - {fileID: 669821309} - - {fileID: 1496017641} - - {fileID: 1707595964} - - {fileID: 450101196} - - {fileID: 521813332} - - {fileID: 1187399389} - - {fileID: 1899249680} - - {fileID: 1465162988} - - {fileID: 692873317} - - {fileID: 1470893369} - - {fileID: 356937743} - - {fileID: 572235698} - - {fileID: 1595158873} - - {fileID: 1985384410} - - {fileID: 413526526} - - {fileID: 1019750221} - - {fileID: 926145297} - - {fileID: 325036121} - - {fileID: 1187795129} - - {fileID: 52496945} - - {fileID: 587262235} - - {fileID: 1740000784} - - {fileID: 633082511} - - {fileID: 548406829} - - {fileID: 414947627} - - {fileID: 802005159} - - {fileID: 646214062} - - {fileID: 1255038911} - - {fileID: 1588407705} - - {fileID: 2062443983} - - {fileID: 250370380} - - {fileID: 860157550} - - {fileID: 321316924} - - {fileID: 644502420} - - {fileID: 686996707} - - {fileID: 221626093} - - {fileID: 1938345524} - - {fileID: 489841812} - - {fileID: 1621666122} - - {fileID: 133117316} - - {fileID: 930817532} - - {fileID: 2123394794} - - {fileID: 1610675228} - - {fileID: 955325094} - - {fileID: 1998046903} - - {fileID: 1347016955} - - {fileID: 237682785} - - {fileID: 1727343499} - - {fileID: 638594345} - - {fileID: 165342444} - - {fileID: 1337254005} - - {fileID: 417009624} - - {fileID: 1427066206} - - {fileID: 1984306645} - - {fileID: 236659837} - - {fileID: 2031522283} - - {fileID: 442816150} - - {fileID: 1795755110} - - {fileID: 164511079} - - {fileID: 955904101} - - {fileID: 111314420} - - {fileID: 633925040} - - {fileID: 321147970} - - {fileID: 111614020} - - {fileID: 1055106369} - - {fileID: 79837837} - - {fileID: 2053290199} - - {fileID: 1378749155} - - {fileID: 146196675} - - {fileID: 1374597758} - - {fileID: 21312558} - - {fileID: 583046543} - - {fileID: 19241397} - - {fileID: 916118769} - - {fileID: 1652902729} - - {fileID: 546335445} - - {fileID: 651307869} - - {fileID: 80351289} - - {fileID: 981144303} - - {fileID: 182671154} - - {fileID: 982297989} - - {fileID: 45231473} - - {fileID: 1276085504} - - {fileID: 2018054855} - - {fileID: 624146101} - - {fileID: 128527182} - - {fileID: 1366074316} - - {fileID: 291086292} - - {fileID: 701590826} - - {fileID: 547275195} - - {fileID: 875465593} - - {fileID: 272364117} - - {fileID: 1744288286} - - {fileID: 1643088962} - - {fileID: 287810223} - - {fileID: 1514516441} - - {fileID: 1123585222} - - {fileID: 64912592} - - {fileID: 1116813058} - - {fileID: 592932429} - - {fileID: 72919015} - - {fileID: 1730467138} - - {fileID: 1303745118} - - {fileID: 807596369} - - {fileID: 1410785587} - - {fileID: 106270176} - - {fileID: 1746054935} - - {fileID: 1208322747} - - {fileID: 738143707} - - {fileID: 815912948} - - {fileID: 1751195274} - - {fileID: 2096975924} - - {fileID: 1320398892} - - {fileID: 343514171} - - {fileID: 759642621} - - {fileID: 613600732} - - {fileID: 2003152561} - - {fileID: 1392340810} - - {fileID: 1324934298} - - {fileID: 107653599} - - {fileID: 1586460241} - - {fileID: 364980997} - - {fileID: 1604513550} - - {fileID: 2062829863} - - {fileID: 1221622439} - - {fileID: 660455068} - - {fileID: 811774528} - - {fileID: 712182951} - - {fileID: 1735459445} - - {fileID: 2100942954} - - {fileID: 818403132} - - {fileID: 447865220} - - {fileID: 1008851287} - - {fileID: 1222687345} - - {fileID: 1977792068} - - {fileID: 1197564065} - - {fileID: 372127716} - - {fileID: 1475624400} - - {fileID: 1640656737} - - {fileID: 1342186446} - - {fileID: 1325519690} - - {fileID: 1153324737} - - {fileID: 672349457} - - {fileID: 149094276} - - {fileID: 1136202168} - - {fileID: 981129070} - - {fileID: 729905694} - - {fileID: 1642421942} - - {fileID: 1910578047} - - {fileID: 1475920467} - - {fileID: 975050259} - - {fileID: 2028801849} - - {fileID: 1377731632} - - {fileID: 84738268} - - {fileID: 1516936199} - - {fileID: 1334083345} - - {fileID: 1598889086} - - {fileID: 1591379778} - - {fileID: 817146360} - - {fileID: 806619558} - - {fileID: 224501490} - - {fileID: 1237645465} - - {fileID: 831928023} - - {fileID: 1916399143} - - {fileID: 2136438496} - - {fileID: 1870857150} - - {fileID: 341288852} - - {fileID: 1146705400} - - {fileID: 321547696} - - {fileID: 1755472302} - - {fileID: 397995228} - - {fileID: 1536263844} - - {fileID: 1566888677} - - {fileID: 1257681516} - - {fileID: 1740993551} - - {fileID: 173118536} - - {fileID: 396367022} - - {fileID: 1836588234} - - {fileID: 66965644} - - {fileID: 1072389534} - - {fileID: 9359169} - - {fileID: 1860299230} - - {fileID: 821019442} - - {fileID: 1822062613} - - {fileID: 2031280764} - - {fileID: 1517327374} - - {fileID: 2056570810} - - {fileID: 1746907222} - - {fileID: 254123141} - - {fileID: 461858943} - - {fileID: 1048941469} - - {fileID: 421513302} - - {fileID: 1895602508} - - {fileID: 1102873466} - - {fileID: 265620768} - - {fileID: 1856042325} - - {fileID: 1676301159} - - {fileID: 1583487141} - - {fileID: 488604015} - - {fileID: 953905465} - - {fileID: 1415365594} - - {fileID: 300400979} - - {fileID: 1093288573} - - {fileID: 328888840} - - {fileID: 1178058600} - - {fileID: 1490348006} - - {fileID: 404991463} - - {fileID: 992467866} - - {fileID: 2084034723} - - {fileID: 1627661930} - - {fileID: 240496222} - - {fileID: 1030837499} - - {fileID: 1657196768} - - {fileID: 1429525914} - - {fileID: 1562280620} - - {fileID: 2084671214} - - {fileID: 2014895259} - - {fileID: 59082830} - - {fileID: 1323956863} - - {fileID: 580770214} - - {fileID: 911803474} - - {fileID: 991463917} - - {fileID: 1481466921} - - {fileID: 1007219756} - - {fileID: 1316223703} - - {fileID: 1639694795} - - {fileID: 50768602} - - {fileID: 1875169289} - - {fileID: 265231756} - - {fileID: 1113409862} - - {fileID: 435381547} - - {fileID: 1855049566} - - {fileID: 1346610071} - - {fileID: 1398870684} - - {fileID: 1279553370} - - {fileID: 2076281496} - - {fileID: 1761268442} - - {fileID: 364036732} - m_Father: {fileID: 89219352} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &729905693 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 729905694} - - component: {fileID: 729905697} - - component: {fileID: 729905696} - - component: {fileID: 729905695} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &729905694 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 729905693} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -35, y: 0, z: 55} - m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 727333638} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!64 &729905695 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 729905693} - 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: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &729905696 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 729905693} - m_Enabled: 1 - m_CastShadows: 1 - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &729905697 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 729905693} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &738143706 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 738143707} - - component: {fileID: 738143710} - - component: {fileID: 738143709} - - component: {fileID: 738143708} - m_Layer: 0 - m_Name: Water - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &738143707 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 738143706} - serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 65, y: 0, z: 50} - m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 727333638} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!64 &738143708 -MeshCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 738143706} - 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: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &738143709 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 738143706} - m_Enabled: 1 - m_CastShadows: 1 - 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_RayTracingAccelStructBuildFlagsOverride: 0 - m_RayTracingAccelStructBuildFlags: 1 - m_SmallMeshCulling: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &738143710 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 738143706} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &740990764 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 740990765} - - component: {fileID: 740990768} - - component: {fileID: 740990767} - - component: {fileID: 740990766} + - component: {fileID: 670561796} + - component: {fileID: 670561799} + - component: {fileID: 670561798} + - component: {fileID: 670561797} m_Layer: 0 m_Name: Particle System m_TagString: Untagged @@ -18905,41 +16944,41 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &740990765 +--- !u!4 &670561796 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 740990764} + m_GameObject: {fileID: 670561795} serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -0.189, z: -0.761} + m_LocalRotation: {x: -0.0033059986, y: 0.9972942, z: 0.07336378, w: 0.0033588656} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 89219352} - m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} ---- !u!114 &740990766 + m_LocalEulerAnglesHint: {x: -8.416, y: 179.64, z: -0.353} +--- !u!114 &670561797 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 740990764} + m_GameObject: {fileID: 670561795} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 3c5dbbb1030d96d438905b0e01caa8d9, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!199 &740990767 +--- !u!199 &670561798 ParticleSystemRenderer: serializedVersion: 6 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 740990764} + m_GameObject: {fileID: 670561795} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -18956,7 +16995,7 @@ ParticleSystemRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 331812090} + - {fileID: 1999686667} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -19009,13 +17048,13 @@ ParticleSystemRenderer: m_MeshWeighting2: 1 m_MeshWeighting3: 1 m_MaskInteraction: 0 ---- !u!198 &740990768 +--- !u!198 &670561799 ParticleSystem: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 740990764} + m_GameObject: {fileID: 670561795} serializedVersion: 8 lengthInSec: 5 simulationSpeed: 1 @@ -19263,7 +17302,7 @@ ParticleSystem: startSize: serializedVersion: 2 minMaxState: 0 - scalar: 1 + scalar: 0.49 minScalar: 1 maxCurve: serializedVersion: 2 @@ -19640,11 +17679,11 @@ ParticleSystem: ShapeModule: serializedVersion: 6 enabled: 1 - type: 4 - angle: 90 - length: 5 + type: 8 + angle: 12.59 + length: 2.09 boxThickness: {x: 0, y: 0, z: 0} - radiusThickness: 1 + radiusThickness: 0 donutRadius: 0.2 m_Position: {x: 0, y: 0, z: 0} m_Rotation: {x: 0, y: 0, z: 0} @@ -19784,7 +17823,7 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 arc: - value: 360 + value: 355.6 mode: 0 spread: 0 speed: @@ -19952,7 +17991,7 @@ ParticleSystem: m_BurstCount: 0 m_Bursts: [] SizeModule: - enabled: 1 + enabled: 0 curve: serializedVersion: 2 minMaxState: 1 @@ -19964,21 +18003,21 @@ ParticleSystem: - serializedVersion: 3 time: 0 value: 0 - inSlope: 2 - outSlope: 2 + inSlope: 0 + outSlope: 1 tangentMode: 0 weightedMode: 0 - inWeight: 0 - outWeight: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 - serializedVersion: 3 time: 1 value: 1 - inSlope: 0 + inSlope: 1 outSlope: 0 tangentMode: 0 weightedMode: 0 - inWeight: 0 - outWeight: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 @@ -20315,7 +18354,7 @@ ParticleSystem: minGradient: serializedVersion: 2 key0: {r: 1, g: 1, b: 1, a: 1} - key1: {r: 0, g: 0, b: 0, a: 1} + key1: {r: 0, g: 0, b: 0, a: 0} key2: {r: 0, g: 0, b: 0, a: 0} key3: {r: 0, g: 0, b: 0, a: 0} key4: {r: 0, g: 0, b: 0, a: 0} @@ -20324,7 +18363,7 @@ ParticleSystem: key7: {r: 0, g: 0, b: 0, a: 0} ctime0: 0 ctime1: 65535 - ctime2: 0 + ctime2: 65535 ctime3: 0 ctime4: 0 ctime5: 0 @@ -23732,6 +21771,1726 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W +--- !u!1 &672349456 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 672349457} + - component: {fileID: 672349460} + - component: {fileID: 672349459} + - component: {fileID: 672349458} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &672349457 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 672349456} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 40, y: 0, z: 55} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 727333638} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &672349458 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 672349456} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &672349459 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 672349456} + m_Enabled: 1 + m_CastShadows: 1 + 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_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &672349460 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 672349456} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &675391285 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1921625339} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.x + value: -1 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.z + value: 1.73 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7069325 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.x + value: -0.7072802 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.y + value: 0.0010988206 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.z + value: 0.00020856084 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -89.929 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0.034 + objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} + - target: {fileID: 919132149155446097, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_Name + value: hex_grass (6) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} +--- !u!1001 &680825964 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1921625339} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.x + value: 9.13 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.y + value: -0.03999999 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.z + value: 5.2399993 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.x + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -90 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} + - target: {fileID: 919132149155446097, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_Name + value: hex_grass (30) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} +--- !u!4 &680825965 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + m_PrefabInstance: {fileID: 680825964} + m_PrefabAsset: {fileID: 0} +--- !u!1 &686996706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 686996707} + - component: {fileID: 686996710} + - component: {fileID: 686996709} + - component: {fileID: 686996708} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &686996707 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 686996706} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -30, y: 0, z: 30} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 727333638} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &686996708 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 686996706} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &686996709 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 686996706} + m_Enabled: 1 + m_CastShadows: 1 + 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_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &686996710 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 686996706} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &690535386 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1921625339} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.x + value: 14.11 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.y + value: 0.46 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalPosition.z + value: -0.050000668 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.x + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -90 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} + - target: {fileID: 919132149155446097, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + propertyPath: m_Name + value: hex_grass (33) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} +--- !u!4 &690535387 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 626ff85c3f4426948a7e4c996dafe50a, type: 3} + m_PrefabInstance: {fileID: 690535386} + m_PrefabAsset: {fileID: 0} +--- !u!1 &692873316 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 692873317} + - component: {fileID: 692873320} + - component: {fileID: 692873319} + - component: {fileID: 692873318} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &692873317 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 692873316} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 10, y: 0, z: 25} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 727333638} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &692873318 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 692873316} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &692873319 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 692873316} + m_Enabled: 1 + m_CastShadows: 1 + 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_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &692873320 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 692873316} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &696789729 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 696789730} + - component: {fileID: 696789733} + - component: {fileID: 696789732} + - component: {fileID: 696789731} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &696789730 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 696789729} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 45, y: 0, z: 25} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 727333638} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &696789731 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 696789729} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &696789732 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 696789729} + m_Enabled: 1 + m_CastShadows: 1 + 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_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &696789733 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 696789729} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &701590825 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 701590826} + - component: {fileID: 701590829} + - component: {fileID: 701590828} + - component: {fileID: 701590827} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &701590826 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 701590825} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 55, y: 0, z: 45} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 727333638} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &701590827 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 701590825} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &701590828 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 701590825} + m_Enabled: 1 + m_CastShadows: 1 + 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_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &701590829 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 701590825} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &703146488 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1921625339} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalPosition.x + value: -7.04 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalPosition.y + value: -0.03999999 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalPosition.z + value: 12.13 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalRotation.w + value: 0.61237246 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalRotation.x + value: -0.61237246 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalRotation.y + value: -0.3535534 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalRotation.z + value: -0.3535534 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -90 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -60 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} + - target: {fileID: 919132149155446097, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + propertyPath: m_Name + value: hex_coast_E (2) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} +--- !u!4 &703146489 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 8e7b0949ef33f3245aa5dc7e1a82b369, type: 3} + m_PrefabInstance: {fileID: 703146488} + m_PrefabAsset: {fileID: 0} +--- !u!1 &712182950 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 712182951} + - component: {fileID: 712182954} + - component: {fileID: 712182953} + - component: {fileID: 712182952} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &712182951 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712182950} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -60, y: 0, z: 50} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 727333638} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &712182952 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712182950} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &712182953 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712182950} + m_Enabled: 1 + m_CastShadows: 1 + 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_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &712182954 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 712182950} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &712573723 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1921625339} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalPosition.x + value: -4 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalPosition.z + value: 3.4 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalRotation.w + value: 0.3555904 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalRotation.x + value: -0.3515124 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalRotation.y + value: -0.6111919 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalRotation.z + value: -0.61354625 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -89.619 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -30.001 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: -89.999 + objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: bd4b519bb6b55df45846c135cc1b1fda, type: 2} + - target: {fileID: 919132149155446097, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + propertyPath: m_Name + value: hex_coast_C_waterless (1) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} +--- !u!4 &712573724 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: ed61a1a7f4b17394680534f6ba5014a2, type: 3} + m_PrefabInstance: {fileID: 712573723} + m_PrefabAsset: {fileID: 0} +--- !u!1 &720424899 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 720424900} + m_Layer: 0 + m_Name: ---------------Managers--------------- + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &720424900 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 720424899} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &721365038 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 721365039} + - component: {fileID: 721365042} + - component: {fileID: 721365041} + - component: {fileID: 721365040} + m_Layer: 0 + m_Name: CinemachineCamera_Top + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &721365039 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 721365038} + serializedVersion: 2 + m_LocalRotation: {x: 0.70090926, y: 0.0000009683705, z: -0.00000095161505, w: 0.7132505} + m_LocalPosition: {x: 0, y: 10, z: -0.1} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 89219352} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &721365040 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 721365038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f38bda98361e1de48a4ca2bd86ea3c17, type: 3} + m_Name: + m_EditorClassIdentifier: + Composition: + ScreenPosition: {x: 0, y: 0} + DeadZone: + Enabled: 0 + Size: {x: 0.2, y: 0.2} + HardLimits: + Enabled: 0 + Size: {x: 0.8, y: 0.8} + Offset: {x: 0, y: 0} + CenterOnActivate: 1 + TargetOffset: {x: 0, y: 0, z: 0} + Damping: {x: 0.5, y: 0.5} + Lookahead: + Enabled: 0 + Time: 0 + Smoothing: 0 + IgnoreY: 0 +--- !u!114 &721365041 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 721365038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3} + m_Name: + m_EditorClassIdentifier: + TrackerSettings: + BindingMode: 4 + PositionDamping: {x: 0, y: 0, z: 0} + AngularDampingMode: 0 + RotationDamping: {x: 1, y: 1, z: 1} + QuaternionDamping: 1 + FollowOffset: {x: 0, y: 10, z: -0.1} +--- !u!114 &721365042 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 721365038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3} + m_Name: + m_EditorClassIdentifier: + Priority: + Enabled: 0 + m_Value: 0 + OutputChannel: 1 + StandbyUpdate: 2 + m_StreamingVersion: 20241001 + m_LegacyPriority: 0 + Target: + TrackingTarget: {fileID: 89219352} + LookAtTarget: {fileID: 0} + CustomLookAtTarget: 0 + Lens: + FieldOfView: 60.000004 + OrthographicSize: 5 + NearClipPlane: 0.3 + FarClipPlane: 1000 + Dutch: 0 + ModeOverride: 0 + PhysicalProperties: + GateFit: 2 + SensorSize: {x: 21.946, y: 16.002} + LensShift: {x: 0, y: 0} + FocusDistance: 10 + Iso: 200 + ShutterSpeed: 0.005 + Aperture: 16 + BladeCount: 5 + Curvature: {x: 2, y: 11} + BarrelClipping: 0.25 + Anamorphism: 0 + BlendHint: 0 +--- !u!1 &726620383 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 726620385} + - component: {fileID: 726620384} + m_Layer: 0 + m_Name: Reflection Probe + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!215 &726620384 +ReflectionProbe: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 726620383} + m_Enabled: 1 + serializedVersion: 2 + m_Type: 0 + m_Mode: 1 + m_RefreshMode: 0 + m_TimeSlicingMode: 0 + m_Resolution: 128 + m_UpdateFrequency: 0 + m_BoxSize: {x: 1000, y: 1000, z: 1000} + m_BoxOffset: {x: 0, y: 0, z: 0} + m_NearClip: 0.3 + m_FarClip: 1000 + m_ShadowDistance: 100 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_IntensityMultiplier: 1 + m_BlendDistance: 1 + m_HDR: 1 + m_BoxProjection: 0 + m_RenderDynamicObjects: 0 + m_UseOcclusionCulling: 1 + m_Importance: 1 + m_CustomBakedTexture: {fileID: 0} +--- !u!4 &726620385 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 726620383} + serializedVersion: 2 + m_LocalRotation: {x: -0.20419724, y: -0.039053436, z: 0.00814323, w: -0.9781166} + m_LocalPosition: {x: 135.1233, y: 0.57663536, z: -35.99004} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &727333637 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 727333638} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &727333638 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 727333637} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 841528159} + - {fileID: 1737773901} + - {fileID: 1922280582} + - {fileID: 1028682306} + - {fileID: 1073917286} + - {fileID: 2081240041} + - {fileID: 1734679852} + - {fileID: 828999885} + - {fileID: 2063344127} + - {fileID: 1087557892} + - {fileID: 2045301518} + - {fileID: 905456350} + - {fileID: 179726014} + - {fileID: 2051461981} + - {fileID: 1717408764} + - {fileID: 179826817} + - {fileID: 1972417028} + - {fileID: 1260057512} + - {fileID: 1239727194} + - {fileID: 306035878} + - {fileID: 395650108} + - {fileID: 288792490} + - {fileID: 994885894} + - {fileID: 696789730} + - {fileID: 1178698711} + - {fileID: 2031778141} + - {fileID: 483508478} + - {fileID: 622417897} + - {fileID: 1902760377} + - {fileID: 1053523136} + - {fileID: 57103045} + - {fileID: 1099084994} + - {fileID: 1192304522} + - {fileID: 669821309} + - {fileID: 1496017641} + - {fileID: 1707595964} + - {fileID: 450101196} + - {fileID: 521813332} + - {fileID: 1187399389} + - {fileID: 1899249680} + - {fileID: 1465162988} + - {fileID: 692873317} + - {fileID: 1470893369} + - {fileID: 356937743} + - {fileID: 572235698} + - {fileID: 1595158873} + - {fileID: 1985384410} + - {fileID: 413526526} + - {fileID: 1019750221} + - {fileID: 926145297} + - {fileID: 325036121} + - {fileID: 1187795129} + - {fileID: 52496945} + - {fileID: 587262235} + - {fileID: 1740000784} + - {fileID: 633082511} + - {fileID: 548406829} + - {fileID: 414947627} + - {fileID: 802005159} + - {fileID: 646214062} + - {fileID: 1255038911} + - {fileID: 1588407705} + - {fileID: 2062443983} + - {fileID: 250370380} + - {fileID: 860157550} + - {fileID: 321316924} + - {fileID: 644502420} + - {fileID: 686996707} + - {fileID: 221626093} + - {fileID: 1938345524} + - {fileID: 489841812} + - {fileID: 1621666122} + - {fileID: 133117316} + - {fileID: 930817532} + - {fileID: 2123394794} + - {fileID: 1610675228} + - {fileID: 955325094} + - {fileID: 1998046903} + - {fileID: 1347016955} + - {fileID: 237682785} + - {fileID: 1727343499} + - {fileID: 638594345} + - {fileID: 165342444} + - {fileID: 1337254005} + - {fileID: 417009624} + - {fileID: 1427066206} + - {fileID: 1984306645} + - {fileID: 236659837} + - {fileID: 2031522283} + - {fileID: 442816150} + - {fileID: 1795755110} + - {fileID: 164511079} + - {fileID: 955904101} + - {fileID: 111314420} + - {fileID: 633925040} + - {fileID: 321147970} + - {fileID: 111614020} + - {fileID: 1055106369} + - {fileID: 79837837} + - {fileID: 2053290199} + - {fileID: 1378749155} + - {fileID: 146196675} + - {fileID: 1374597758} + - {fileID: 21312558} + - {fileID: 583046543} + - {fileID: 19241397} + - {fileID: 916118769} + - {fileID: 1652902729} + - {fileID: 546335445} + - {fileID: 651307869} + - {fileID: 80351289} + - {fileID: 981144303} + - {fileID: 182671154} + - {fileID: 982297989} + - {fileID: 45231473} + - {fileID: 1276085504} + - {fileID: 2018054855} + - {fileID: 624146101} + - {fileID: 128527182} + - {fileID: 1366074316} + - {fileID: 291086292} + - {fileID: 701590826} + - {fileID: 547275195} + - {fileID: 875465593} + - {fileID: 272364117} + - {fileID: 1744288286} + - {fileID: 1643088962} + - {fileID: 287810223} + - {fileID: 1514516441} + - {fileID: 1123585222} + - {fileID: 64912592} + - {fileID: 1116813058} + - {fileID: 592932429} + - {fileID: 72919015} + - {fileID: 1730467138} + - {fileID: 1303745118} + - {fileID: 807596369} + - {fileID: 1410785587} + - {fileID: 106270176} + - {fileID: 1746054935} + - {fileID: 1208322747} + - {fileID: 738143707} + - {fileID: 815912948} + - {fileID: 1751195274} + - {fileID: 2096975924} + - {fileID: 1320398892} + - {fileID: 343514171} + - {fileID: 759642621} + - {fileID: 613600732} + - {fileID: 2003152561} + - {fileID: 1392340810} + - {fileID: 1324934298} + - {fileID: 107653599} + - {fileID: 1586460241} + - {fileID: 364980997} + - {fileID: 1604513550} + - {fileID: 2062829863} + - {fileID: 1221622439} + - {fileID: 660455068} + - {fileID: 811774528} + - {fileID: 712182951} + - {fileID: 1735459445} + - {fileID: 2100942954} + - {fileID: 818403132} + - {fileID: 447865220} + - {fileID: 1008851287} + - {fileID: 1222687345} + - {fileID: 1977792068} + - {fileID: 1197564065} + - {fileID: 372127716} + - {fileID: 1475624400} + - {fileID: 1640656737} + - {fileID: 1342186446} + - {fileID: 1325519690} + - {fileID: 1153324737} + - {fileID: 672349457} + - {fileID: 149094276} + - {fileID: 1136202168} + - {fileID: 981129070} + - {fileID: 729905694} + - {fileID: 1642421942} + - {fileID: 1910578047} + - {fileID: 1475920467} + - {fileID: 975050259} + - {fileID: 2028801849} + - {fileID: 1377731632} + - {fileID: 84738268} + - {fileID: 1516936199} + - {fileID: 1334083345} + - {fileID: 1598889086} + - {fileID: 1591379778} + - {fileID: 817146360} + - {fileID: 806619558} + - {fileID: 224501490} + - {fileID: 1237645465} + - {fileID: 831928023} + - {fileID: 1916399143} + - {fileID: 2136438496} + - {fileID: 1870857150} + - {fileID: 341288852} + - {fileID: 1146705400} + - {fileID: 321547696} + - {fileID: 1755472302} + - {fileID: 397995228} + - {fileID: 1536263844} + - {fileID: 1566888677} + - {fileID: 1257681516} + - {fileID: 1740993551} + - {fileID: 173118536} + - {fileID: 396367022} + - {fileID: 1836588234} + - {fileID: 66965644} + - {fileID: 1072389534} + - {fileID: 9359169} + - {fileID: 1860299230} + - {fileID: 821019442} + - {fileID: 1822062613} + - {fileID: 2031280764} + - {fileID: 1517327374} + - {fileID: 2056570810} + - {fileID: 1746907222} + - {fileID: 254123141} + - {fileID: 461858943} + - {fileID: 1048941469} + - {fileID: 421513302} + - {fileID: 1895602508} + - {fileID: 1102873466} + - {fileID: 265620768} + - {fileID: 1856042325} + - {fileID: 1676301159} + - {fileID: 1583487141} + - {fileID: 488604015} + - {fileID: 953905465} + - {fileID: 1415365594} + - {fileID: 300400979} + - {fileID: 1093288573} + - {fileID: 328888840} + - {fileID: 1178058600} + - {fileID: 1490348006} + - {fileID: 404991463} + - {fileID: 992467866} + - {fileID: 2084034723} + - {fileID: 1627661930} + - {fileID: 240496222} + - {fileID: 1030837499} + - {fileID: 1657196768} + - {fileID: 1429525914} + - {fileID: 1562280620} + - {fileID: 2084671214} + - {fileID: 2014895259} + - {fileID: 59082830} + - {fileID: 1323956863} + - {fileID: 580770214} + - {fileID: 911803474} + - {fileID: 991463917} + - {fileID: 1481466921} + - {fileID: 1007219756} + - {fileID: 1316223703} + - {fileID: 1639694795} + - {fileID: 50768602} + - {fileID: 1875169289} + - {fileID: 265231756} + - {fileID: 1113409862} + - {fileID: 435381547} + - {fileID: 1855049566} + - {fileID: 1346610071} + - {fileID: 1398870684} + - {fileID: 1279553370} + - {fileID: 2076281496} + - {fileID: 1761268442} + - {fileID: 364036732} + m_Father: {fileID: 89219352} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &729905693 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 729905694} + - component: {fileID: 729905697} + - component: {fileID: 729905696} + - component: {fileID: 729905695} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &729905694 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 729905693} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -35, y: 0, z: 55} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 727333638} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &729905695 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 729905693} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &729905696 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 729905693} + m_Enabled: 1 + m_CastShadows: 1 + 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_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &729905697 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 729905693} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &738143706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 738143707} + - component: {fileID: 738143710} + - component: {fileID: 738143709} + - component: {fileID: 738143708} + m_Layer: 0 + m_Name: Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &738143707 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 738143706} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 65, y: 0, z: 50} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 727333638} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &738143708 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 738143706} + 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: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &738143709 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 738143706} + m_Enabled: 1 + m_CastShadows: 1 + 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_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6f4ffd4fdece5634884fa9923f186879, 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!33 &738143710 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 738143706} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &759642620 GameObject: m_ObjectHideFlags: 0 @@ -35333,99 +35092,6 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1415365593} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1001 &1424383172 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 602397660332719748, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: 1b3f34f5008ab3a449cd0ca7ae41a30e, type: 2} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_RootOrder - value: 4 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalScale.x - value: 0.3 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalScale.y - value: 0.3 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalScale.z - value: 0.3 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalPosition.x - value: -42.122124 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalPosition.z - value: -34.76117 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalRotation.w - value: 0.89609945 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalRotation.y - value: 0.44385338 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 52.7 - objectReference: {fileID: 0} - - target: {fileID: 2804070465777273743, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3230455740001809464, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: 1b3f34f5008ab3a449cd0ca7ae41a30e, type: 2} - - target: {fileID: 3288155046874829109, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: m_Name - value: Island(1) - objectReference: {fileID: 0} - - target: {fileID: 3936467027728691424, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: 1b3f34f5008ab3a449cd0ca7ae41a30e, type: 2} - - target: {fileID: 6529329570589244614, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: 1b3f34f5008ab3a449cd0ca7ae41a30e, type: 2} - - target: {fileID: 6567463936875692540, guid: b5b345652819a96468b021a97fe70a51, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: 1b3f34f5008ab3a449cd0ca7ae41a30e, type: 2} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: b5b345652819a96468b021a97fe70a51, type: 3} --- !u!1 &1427066205 GameObject: m_ObjectHideFlags: 0 @@ -54739,6 +54405,251 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1998046902} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!21 &1999686667 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: AllIn1Vfx/AllIn1Vfx + m_Shader: {fileID: 4800000, guid: b430983578466934c944e7171b4c372c, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - ADDITIVECONFIG_ON + - DISTORT_ON + - GLOW_ON + - MASK_ON + - POLARUV_ON + - SHAPE1DISTORT_ON + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _ColorRampTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ColorRampTexGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistNormalMap: + m_Texture: {fileID: 2800000, guid: 06907d08092c41f4aa8b5b3cbe5f9fa2, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DistortTex: + m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeBurnTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FadeTex: + m_Texture: {fileID: 2800000, guid: 854b25bc08516364da5a786b1cad247e, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _GlowTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: 5e9ddf7ec70ee3e48bb89664de649cd3, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MaskTex: + m_Texture: {fileID: 2800000, guid: 2f6642b43dc405d498acba7e288c068c, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Shape1MaskTex: + m_Texture: {fileID: 2800000, guid: db8fa36fcfe9738418db54ee0fe17fdf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Shape2DistortTex: + m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Shape2Tex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Shape3DistortTex: + m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Shape3Tex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ShapeDistortTex: + m_Texture: {fileID: 2800000, guid: fcb027caad6963b4a80539bbce0d10e9, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _TrailWidthGradient: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _VertOffsetTex: + m_Texture: {fileID: 2800000, guid: 48da24d771916524899d36e4bfe7f762, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _Alpha: 1 + - _AlphaCutoffValue: 0.25 + - _AlphaFadeAmount: -0.1 + - _AlphaFadePow: 1 + - _AlphaFadeSmooth: 0.075 + - _AlphaStepMax: 0.075 + - _AlphaStepMin: 0 + - _CamDistFadeStepMax: 100 + - _CamDistFadeStepMin: 0 + - _CamDistProximityFade: 0 + - _ColorGradingMidPoint: 0.5 + - _ColorMask: 15 + - _ColorRampBlend: 1 + - _ColorRampLuminosity: 0 + - _CullingOption: 0 + - _DebugShape: 1 + - _DepthGlow: 1 + - _DepthGlowDist: 0.5 + - _DepthGlowGlobal: 1 + - _DepthGlowPow: 1 + - _DistortAmount: 3.6 + - _DistortTexXSpeed: 0 + - _DistortTexYSpeed: 29 + - _DistortionBlend: 1 + - _DistortionPower: 10 + - _DistortionScrollXSpeed: 0 + - _DistortionScrollYSpeed: 0 + - _DstMode: 1 + - _EditorDrawers: 60 + - _FadeAmount: 0.2 + - _FadeBurnGlow: 5 + - _FadeBurnWidth: 0.01 + - _FadePower: 8.2 + - _FadeScrollXSpeed: 0 + - _FadeScrollYSpeed: 0 + - _FadeTransition: 0.075 + - _Glow: 0 + - _GlowGlobal: 1 + - _HandDrawnAmount: 10 + - _HandDrawnSpeed: 5 + - _HsvBright: 1 + - _HsvSaturation: 1 + - _HsvShift: 180 + - _LightAmount: 0 + - _MaskPow: 0.2 + - _OffsetSh1: 1 + - _OffsetSh2: 1 + - _OffsetSh3: 1 + - _PixelateSize: 32 + - _PosterizeNumColors: 5 + - _RandomSh1Mult: 1 + - _RandomSh2Mult: 1 + - _RandomSh3Mult: 1 + - _RenderingMode: 1 + - _RimAddAmount: 1 + - _RimBias: 0 + - _RimErodesAlpha: 0 + - _RimIntensity: 1 + - _RimPower: 5 + - _RimScale: 1 + - _RoundWaveSpeed: 2 + - _RoundWaveStrength: 0.7 + - _ScreenUvSh2DistScale: 1 + - _ScreenUvSh3DistScale: 1 + - _ScreenUvShDistScale: 0 + - _Sh1BlendOffset: 0 + - _Sh2BlendOffset: 0 + - _Sh3BlendOffset: 0 + - _ShadowAmount: 0.4 + - _ShadowStepMax: 1 + - _ShadowStepMin: 0 + - _ShakeUvSpeed: 20 + - _ShakeUvX: 5 + - _ShakeUvY: 4 + - _Shape1MaskPow: 1 + - _Shape2AlphaWeight: 2 + - _Shape2Brightness: 0 + - _Shape2ColorWeight: 2 + - _Shape2Contrast: 1 + - _Shape2DistortAmount: 0.5 + - _Shape2DistortXSpeed: 0.1 + - _Shape2DistortYSpeed: 0.1 + - _Shape2RotationOffset: 0 + - _Shape2RotationSpeed: 0 + - _Shape2XSpeed: 0 + - _Shape2YSpeed: 0 + - _Shape3AlphaWeight: 2 + - _Shape3Brightness: 0 + - _Shape3ColorWeight: 2 + - _Shape3Contrast: 1 + - _Shape3DistortAmount: 0.5 + - _Shape3DistortXSpeed: 0.1 + - _Shape3DistortYSpeed: 0.1 + - _Shape3RotationOffset: 0 + - _Shape3RotationSpeed: 0 + - _Shape3XSpeed: 0 + - _Shape3YSpeed: 0 + - _ShapeAlphaWeight: 1 + - _ShapeBrightness: 0 + - _ShapeColorWeight: 1 + - _ShapeContrast: 1 + - _ShapeDistortAmount: 0.3 + - _ShapeDistortXSpeed: 1.18 + - _ShapeDistortYSpeed: 0.1 + - _ShapeRotationOffset: 0 + - _ShapeRotationSpeed: 0 + - _ShapeXSpeed: 0 + - _ShapeYSpeed: 0 + - _SoftFactor: 0.5 + - _SrcMode: 1 + - _TextureScrollXSpeed: 1 + - _TextureScrollYSpeed: 0 + - _TimingSeed: 0 + - _TrailWidthPower: 1 + - _TwistUvAmount: 1 + - _TwistUvPosX: 0.5 + - _TwistUvPosY: 0.5 + - _TwistUvRadius: 0.75 + - _VertOffsetAmount: 0.5 + - _VertOffsetPower: 1 + - _VertOffsetTexXSpeed: 0.1 + - _VertOffsetTexYSpeed: 0.1 + - _WaveAmount: 7 + - _WaveSpeed: 10 + - _WaveStrength: 7.5 + - _WaveX: 0 + - _WaveY: 0.5 + - _ZTestMode: 4 + - _ZWrite: 0 + m_Colors: + - _BackFaceTint: {r: 0.5, g: 0.5, b: 0.5, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorGradingDark: {r: 1, g: 1, b: 1, a: 1} + - _ColorGradingLight: {r: 1, g: 1, b: 1, a: 1} + - _ColorGradingMiddle: {r: 1, g: 1, b: 1, a: 1} + - _DepthGlowColor: {r: 1, g: 1, b: 1, a: 1} + - _FadeBurnColor: {r: 1, g: 1, b: 0, a: 1} + - _FrontFaceTint: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 1, g: 1, b: 1, a: 1} + - _LightColor: {r: 1, g: 1, b: 1, a: 1} + - _RimColor: {r: 1, g: 1, b: 1, a: 1} + - _Shape2Color: {r: 1, g: 1, b: 1, a: 1} + - _Shape3Color: {r: 1, g: 1, b: 1, a: 1} + - _ShapeColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 --- !u!1 &2003152560 GameObject: m_ObjectHideFlags: 0 @@ -57414,7 +57325,6 @@ SceneRoots: - {fileID: 1631481599} - {fileID: 89219352} - {fileID: 1921625339} - - {fileID: 1424383172} - {fileID: 1973184708} - {fileID: 1016543686} - {fileID: 1215753635} diff --git a/Assets/01.Scenes/Non - Shader Bending (Scene 2).meta b/Assets/01.Scenes/Non - Shader Bending (Scene 2).meta new file mode 100644 index 000000000..fd34303c7 --- /dev/null +++ b/Assets/01.Scenes/Non - Shader Bending (Scene 2).meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc1f9904ed46ba5449006db821b761fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/01.Scenes/Non - Shader Bending (Scene 2)/LightingData.asset b/Assets/01.Scenes/Non - Shader Bending (Scene 2)/LightingData.asset new file mode 100644 index 000000000..06ae27d6d Binary files /dev/null and b/Assets/01.Scenes/Non - Shader Bending (Scene 2)/LightingData.asset differ diff --git a/Assets/01.Scenes/Non - Shader Bending (Scene 2)/LightingData.asset.meta b/Assets/01.Scenes/Non - Shader Bending (Scene 2)/LightingData.asset.meta new file mode 100644 index 000000000..e737db641 --- /dev/null +++ b/Assets/01.Scenes/Non - Shader Bending (Scene 2)/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8c27c390a18eb9949bab45f88c7619a1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/01.Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr b/Assets/01.Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr new file mode 100644 index 000000000..ef5901f1d Binary files /dev/null and b/Assets/01.Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr differ diff --git a/Assets/01.Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr.meta b/Assets/01.Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr.meta new file mode 100644 index 000000000..89bf28806 --- /dev/null +++ b/Assets/01.Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr.meta @@ -0,0 +1,143 @@ +fileFormatVersion: 2 +guid: 231455b4ca4c25c49a85954569b47b3a +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + 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: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/02.Scripts/BlueWater/Sail/Curved_Obejct.cs b/Assets/02.Scripts/BlueWater/Sail/Curved_Object.cs similarity index 97% rename from Assets/02.Scripts/BlueWater/Sail/Curved_Obejct.cs rename to Assets/02.Scripts/BlueWater/Sail/Curved_Object.cs index 96b6d963e..2aec5c4e4 100644 --- a/Assets/02.Scripts/BlueWater/Sail/Curved_Obejct.cs +++ b/Assets/02.Scripts/BlueWater/Sail/Curved_Object.cs @@ -3,7 +3,7 @@ using UnityEngine; using UnityEngine.Rendering; [ExecuteAlways] -public class BendingManager : MonoBehaviour +public class Curved_Object : MonoBehaviour { #region Constants @@ -15,8 +15,7 @@ public class BendingManager : MonoBehaviour Shader.PropertyToID("_BendingAmount"); #endregion - - + #region Inspector [SerializeField] diff --git a/Assets/02.Scripts/BlueWater/Sail/Curved_Obejct.cs.meta b/Assets/02.Scripts/BlueWater/Sail/Curved_Object.cs.meta similarity index 100% rename from Assets/02.Scripts/BlueWater/Sail/Curved_Obejct.cs.meta rename to Assets/02.Scripts/BlueWater/Sail/Curved_Object.cs.meta diff --git a/Assets/02.Scripts/BlueWater/Sail/Curved_Object_StaticPosition.cs b/Assets/02.Scripts/BlueWater/Sail/Curved_Object_StaticPosition.cs new file mode 100644 index 000000000..6deff758e --- /dev/null +++ b/Assets/02.Scripts/BlueWater/Sail/Curved_Object_StaticPosition.cs @@ -0,0 +1,34 @@ +using UnityEngine; + + +public class Curved_Object_StaticPosition : MonoBehaviour + { + public Curved_Object curvedWorldController; + + Vector3 originalPosition; + Quaternion originalRotation; + + Vector3 forward; + Vector3 right; + + private void Start() + { + originalPosition = transform.position; + originalRotation = transform.rotation; + + forward = transform.forward; + right = transform.right; + } + + void Update() + { + if (curvedWorldController != null) + { + //Transform position; + //transform.position = curvedWorldController.TransformPosition(originalPosition); + + //Transform normal(calcualte rotation); + //transform.rotation = curvedWorldController.TransformRotation(originalPosition, forward, right); + } + } + } diff --git a/Assets/02.Scripts/BlueWater/Sail/Curved_Object_StaticPosition.cs.meta b/Assets/02.Scripts/BlueWater/Sail/Curved_Object_StaticPosition.cs.meta new file mode 100644 index 000000000..8e9e2a390 --- /dev/null +++ b/Assets/02.Scripts/BlueWater/Sail/Curved_Object_StaticPosition.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d2f6ed8d8105d334fbaed54d6be6fe52 \ No newline at end of file diff --git a/Assets/03.Images/Sail.meta b/Assets/03.Images/Sail.meta new file mode 100644 index 000000000..54563fbe4 --- /dev/null +++ b/Assets/03.Images/Sail.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3396651ee437b084880700644c530ba6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/03.Images/Sail/Island01.mat b/Assets/03.Images/Sail/Island01.mat new file mode 100644 index 000000000..2739905d9 --- /dev/null +++ b/Assets/03.Images/Sail/Island01.mat @@ -0,0 +1,161 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4373979204799356009 +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: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Island01 + m_Shader: {fileID: -6465566751694194690, guid: 940d79357fd7a4f01a49e7247aeaa4da, 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: {} + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - Texture2D_72426835: + m_Texture: {fileID: 2800000, guid: dd92cbf097a58ac47aacb73549069f60, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _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 + - _Alpha: 1 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BlendOp: 0 + - _BumpScale: 1 + - _CameraFadingEnabled: 0 + - _CameraFarFadeDistance: 2 + - _CameraNearFadeDistance: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _ColorMode: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DistortionBlend: 0.5 + - _DistortionEnabled: 0 + - _DistortionStrength: 1 + - _DistortionStrengthScaled: 0.1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _FlipbookBlending: 0 + - _FlipbookMode: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueControl: 0 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SoftParticlesEnabled: 0 + - _SoftParticlesFarFadeDistance: 1 + - _SoftParticlesNearFadeDistance: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - Vector2_6A93A1CF: {r: 1, g: 1, b: 0, a: 0} + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0} + - _CameraFadeParams: {r: 0, g: 0, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _CurvedWorldBendSettings: {r: 0, g: 1, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/09.Shaders/Curved_Shader/Master 1.mat.meta b/Assets/03.Images/Sail/Island01.mat.meta similarity index 79% rename from Assets/09.Shaders/Curved_Shader/Master 1.mat.meta rename to Assets/03.Images/Sail/Island01.mat.meta index dd159ff61..b6da19e5b 100644 --- a/Assets/09.Shaders/Curved_Shader/Master 1.mat.meta +++ b/Assets/03.Images/Sail/Island01.mat.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1b3f34f5008ab3a449cd0ca7ae41a30e +guid: 43ab4a05fafad7f4a83fd3d2a836c3d3 NativeFormatImporter: externalObjects: {} mainObjectFileID: 2100000 diff --git a/Assets/03.Images/Sail/Island01.png b/Assets/03.Images/Sail/Island01.png new file mode 100644 index 000000000..2e3c126f7 Binary files /dev/null and b/Assets/03.Images/Sail/Island01.png differ diff --git a/Assets/03.Images/Sail/Island01.png.meta b/Assets/03.Images/Sail/Island01.png.meta new file mode 100644 index 000000000..43411a47f --- /dev/null +++ b/Assets/03.Images/Sail/Island01.png.meta @@ -0,0 +1,143 @@ +fileFormatVersion: 2 +guid: dd92cbf097a58ac47aacb73549069f60 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + 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: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/09.Shaders/Curved_Shader/BendingSprite.shadergraph b/Assets/09.Shaders/Curved_Shader/BendingSprite.shadergraph new file mode 100644 index 000000000..b3f4831d5 --- /dev/null +++ b/Assets/09.Shaders/Curved_Shader/BendingSprite.shadergraph @@ -0,0 +1,1047 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "a776a26a9f154fd49ba7d840d51405a5", + "m_Properties": [ + { + "m_Id": "7a75582612d6430797ef6d4b543f55ad" + } + ], + "m_Keywords": [], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "fff02ec22c3145418d39fd11b3d99229" + } + ], + "m_Nodes": [ + { + "m_Id": "6a87873f1dc647ed8295fbd809026cd6" + }, + { + "m_Id": "25b14e762eda463e851c240ffbc3a7e5" + }, + { + "m_Id": "2d2db3aafaa04431af643d29a0bdbf76" + }, + { + "m_Id": "577dd9e6582e44cd90ba1b4e1d251c87" + }, + { + "m_Id": "0b46133f1acf433095861743124cfa96" + }, + { + "m_Id": "5f9bf79f8a764a06976354412f9cc11e" + }, + { + "m_Id": "b55604369e794002828dca5fcf7620ed" + }, + { + "m_Id": "c4e60756c107450fa8d1c0ca35410138" + }, + { + "m_Id": "0f46e8408853482e8e562136fb167d91" + }, + { + "m_Id": "d7fcdedf16514196af69281fe49a8bb9" + }, + { + "m_Id": "d7ab27d284a042acad6ef04474140d87" + }, + { + "m_Id": "21648b78eaad4e5cbdcc96958d50a2e1" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "25b14e762eda463e851c240ffbc3a7e5" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "2d2db3aafaa04431af643d29a0bdbf76" + }, + "m_SlotId": 1 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2d2db3aafaa04431af643d29a0bdbf76" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "6a87873f1dc647ed8295fbd809026cd6" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "2d2db3aafaa04431af643d29a0bdbf76" + }, + "m_SlotId": 7 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "577dd9e6582e44cd90ba1b4e1d251c87" + }, + "m_SlotId": 0 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "5f9bf79f8a764a06976354412f9cc11e" + }, + { + "m_Id": "b55604369e794002828dca5fcf7620ed" + }, + { + "m_Id": "c4e60756c107450fa8d1c0ca35410138" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "6a87873f1dc647ed8295fbd809026cd6" + }, + { + "m_Id": "577dd9e6582e44cd90ba1b4e1d251c87" + }, + { + "m_Id": "0b46133f1acf433095861743124cfa96" + }, + { + "m_Id": "0f46e8408853482e8e562136fb167d91" + }, + { + "m_Id": "d7fcdedf16514196af69281fe49a8bb9" + }, + { + "m_Id": "d7ab27d284a042acad6ef04474140d87" + }, + { + "m_Id": "21648b78eaad4e5cbdcc96958d50a2e1" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 0, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_SubDatas": [], + "m_ActiveTargets": [ + { + "m_Id": "52c8cddd9d604015851b10ac74d91527" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "0b0e235733924c209f9555d6d28ef565", + "m_Id": 6, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "0b46133f1acf433095861743124cfa96", + "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": "63f7d330a8074d7f8e00957533d0aedf" + } + ], + "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.BlockNode", + "m_ObjectId": "0f46e8408853482e8e562136fb167d91", + "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": "fd769edad28f40e09274441f289f7ad9" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Smoothness" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "1ba7aa365a6c48bd94aa8aef5df53b02", + "m_Id": 0, + "m_DisplayName": "RGBA", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "RGBA", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "209c610375df441396c21036cbede44e", + "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.BlockNode", + "m_ObjectId": "21648b78eaad4e5cbdcc96958d50a2e1", + "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": "209c610375df441396c21036cbede44e" + } + ], + "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.PropertyNode", + "m_ObjectId": "25b14e762eda463e851c240ffbc3a7e5", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Property", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -541.0, + "y": 77.00001525878906, + "width": 152.0, + "height": 34.00000762939453 + } + }, + "m_Slots": [ + { + "m_Id": "51e55fae5aed41fb8f9d3d23eddd5638" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_Property": { + "m_Id": "7a75582612d6430797ef6d4b543f55ad" + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SampleTexture2DNode", + "m_ObjectId": "2d2db3aafaa04431af643d29a0bdbf76", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Sample Texture 2D", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -359.0, + "y": 58.99999237060547, + "width": 208.0, + "height": 435.0 + } + }, + "m_Slots": [ + { + "m_Id": "1ba7aa365a6c48bd94aa8aef5df53b02" + }, + { + "m_Id": "d9e416a04c6443199b9cefbdd732f11b" + }, + { + "m_Id": "52bfbbb85e7e4269b27bb834cf303148" + }, + { + "m_Id": "0b0e235733924c209f9555d6d28ef565" + }, + { + "m_Id": "a48a34d47c60491aa4fb717466f4025e" + }, + { + "m_Id": "ef9df2277a0a47d4a0e0ba0d1a8ac740" + }, + { + "m_Id": "f3070885cda54022a4cb7c5c2bbc6462" + }, + { + "m_Id": "a898282b84bb405f88a7170a79efe80a" + } + ], + "synonyms": [ + "tex2d" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_TextureType": 0, + "m_NormalMapSpace": 0, + "m_EnableGlobalMipBias": true, + "m_MipSamplingMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "3bab3b2210774b268175e5baf043ec1b", + "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.Texture2DMaterialSlot", + "m_ObjectId": "51e55fae5aed41fb8f9d3d23eddd5638", + "m_Id": 0, + "m_DisplayName": "Main Texture", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "52bfbbb85e7e4269b27bb834cf303148", + "m_Id": 5, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "52c8cddd9d604015851b10ac74d91527", + "m_Datas": [], + "m_ActiveSubTarget": { + "m_Id": "5e0deb431d3b4b3d932b09d3b68cb650" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_DisableTint": false, + "m_AdditionalMotionVectorMode": 0, + "m_AlembicMotionVectors": false, + "m_SupportsLODCrossFade": false, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "577dd9e6582e44cd90ba1b4e1d251c87", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Alpha", + "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": "cc562a335aa943ac989aa69952922f2e" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Alpha" +} + +{ + "m_SGVersion": 2, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalLitSubTarget", + "m_ObjectId": "5e0deb431d3b4b3d932b09d3b68cb650", + "m_WorkflowMode": 1, + "m_NormalDropOffSpace": 0, + "m_ClearCoat": false, + "m_BlendModePreserveSpecular": true +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "5f9bf79f8a764a06976354412f9cc11e", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "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": "c87335ba6f21476281084bea4c0ea94d" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "63f7d330a8074d7f8e00957533d0aedf", + "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.BlockNode", + "m_ObjectId": "6a87873f1dc647ed8295fbd809026cd6", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "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": "cfe7d19f9a5048bc8a68ccf7df1a6909" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty", + "m_ObjectId": "7a75582612d6430797ef6d4b543f55ad", + "m_Guid": { + "m_GuidSerialized": "98c5d93f-5b0b-4490-8f64-b2a942031241" + }, + "m_Name": "Main Texture", + "m_DefaultRefNameVersion": 1, + "m_RefNameGeneratedByDisplayName": "Main Texture", + "m_DefaultReferenceName": "_Main_Texture", + "m_OverrideReferenceName": "_MainTex", + "m_GeneratePropertyBlock": true, + "m_UseCustomSlotLabel": false, + "m_CustomSlotLabel": "", + "m_DismissedVersion": 0, + "m_Precision": 0, + "overrideHLSLDeclaration": false, + "hlslDeclarationOverride": 0, + "m_Hidden": false, + "m_Value": { + "m_SerializedTexture": "{\"texture\":{\"fileID\":2800000,\"guid\":\"dd92cbf097a58ac47aacb73549069f60\",\"type\":3}}", + "m_Guid": "" + }, + "isMainTexture": false, + "useTilingAndOffset": false, + "m_Modifiable": true, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "86e70b3233354a4aac182d7c22aa8f52", + "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.TangentMaterialSlot", + "m_ObjectId": "89777ca194ac4c838edb1b7737ecc5f3", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "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": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "90cd1091a5d14213b1b7d2a7524cb201", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "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": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "a48a34d47c60491aa4fb717466f4025e", + "m_Id": 7, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot", + "m_ObjectId": "a898282b84bb405f88a7170a79efe80a", + "m_Id": 3, + "m_DisplayName": "Sampler", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Sampler", + "m_StageCapability": 3, + "m_BareResource": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "b55604369e794002828dca5fcf7620ed", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "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": "90cd1091a5d14213b1b7d2a7524cb201" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "c4e60756c107450fa8d1c0ca35410138", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "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": "89777ca194ac4c838edb1b7737ecc5f3" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "c87335ba6f21476281084bea4c0ea94d", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "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": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "cc562a335aa943ac989aa69952922f2e", + "m_Id": 0, + "m_DisplayName": "Alpha", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Alpha", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "cfe7d19f9a5048bc8a68ccf7df1a6909", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "d7ab27d284a042acad6ef04474140d87", + "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": "86e70b3233354a4aac182d7c22aa8f52" + } + ], + "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.BlockNode", + "m_ObjectId": "d7fcdedf16514196af69281fe49a8bb9", + "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": "3bab3b2210774b268175e5baf043ec1b" + } + ], + "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.Vector1MaterialSlot", + "m_ObjectId": "d9e416a04c6443199b9cefbdd732f11b", + "m_Id": 4, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot", + "m_ObjectId": "ef9df2277a0a47d4a0e0ba0d1a8ac740", + "m_Id": 1, + "m_DisplayName": "Texture", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Texture", + "m_StageCapability": 3, + "m_BareResource": false, + "m_Texture": { + "m_SerializedTexture": "", + "m_Guid": "" + }, + "m_DefaultType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVMaterialSlot", + "m_ObjectId": "f3070885cda54022a4cb7c5c2bbc6462", + "m_Id": 2, + "m_DisplayName": "UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "UV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0 + }, + "m_Labels": [], + "m_Channel": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "fd769edad28f40e09274441f289f7ad9", + "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.CategoryData", + "m_ObjectId": "fff02ec22c3145418d39fd11b3d99229", + "m_Name": "", + "m_ChildObjectList": [ + { + "m_Id": "7a75582612d6430797ef6d4b543f55ad" + } + ] +} + diff --git a/Assets/09.Shaders/Curved_Shader/BendingSprite.shadergraph.meta b/Assets/09.Shaders/Curved_Shader/BendingSprite.shadergraph.meta new file mode 100644 index 000000000..c4b6fe0b1 --- /dev/null +++ b/Assets/09.Shaders/Curved_Shader/BendingSprite.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 3ee1cbcb268820347992c27afcdc1951 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/Assets/09.Shaders/Curved_Shader/BendingSpriteLit.mat b/Assets/09.Shaders/Curved_Shader/BendingSpriteLit.mat new file mode 100644 index 000000000..6b542cdcd --- /dev/null +++ b/Assets/09.Shaders/Curved_Shader/BendingSpriteLit.mat @@ -0,0 +1,75 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6535337352375107451 +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: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BendingSpriteLit + m_Shader: {fileID: -6465566751694194690, guid: 3ee1cbcb268820347992c27afcdc1951, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _MainTex: + m_Texture: {fileID: 2800000, guid: dd92cbf097a58ac47aacb73549069f60, type: 3} + 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: + - _ColorMask: 15 + - _DecalMeshBiasType: 0 + - _DecalMeshDepthBias: 0 + - _DecalMeshViewBias: 0 + - _DrawOrder: 0 + - _QueueControl: 0 + - _QueueOffset: 0 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UIMaskSoftnessX: 1 + - _UIMaskSoftnessY: 1 + m_Colors: + - _ClipRect: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/09.Shaders/Curved_Shader/BendingSpriteLit.mat.meta b/Assets/09.Shaders/Curved_Shader/BendingSpriteLit.mat.meta new file mode 100644 index 000000000..ab2c43e92 --- /dev/null +++ b/Assets/09.Shaders/Curved_Shader/BendingSpriteLit.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 010ab7922b2350d419f372e06dcfe22f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/09.Shaders/Curved_Shader/Master 1.mat b/Assets/09.Shaders/Curved_Shader/CurvedWorldLit.mat similarity index 84% rename from Assets/09.Shaders/Curved_Shader/Master 1.mat rename to Assets/09.Shaders/Curved_Shader/CurvedWorldLit.mat index 73feb3b50..784a83386 100644 --- a/Assets/09.Shaders/Curved_Shader/Master 1.mat +++ b/Assets/09.Shaders/Curved_Shader/CurvedWorldLit.mat @@ -7,27 +7,25 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Master 1 - m_Shader: {fileID: -6465566751694194690, guid: 940d79357fd7a4f01a49e7247aeaa4da, type: 3} + m_Name: CurvedWorldLit + m_Shader: {fileID: 4800000, guid: 37639dc9dfcb02e418de063aa605d992, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 - m_ValidKeywords: [] - m_InvalidKeywords: [] + m_ValidKeywords: + - CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE + m_InvalidKeywords: + - CURVEDWORLD_BEND_ID_1 m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: - - MOTIONVECTORS + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: - - Texture2D_72426835: - m_Texture: {fileID: 2800000, guid: 964c2e73185575e4ab8f889c31f021dc, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - _BaseMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} @@ -87,7 +85,6 @@ Material: m_Ints: [] m_Floats: - _AddPrecomputedVelocity: 0 - - _Alpha: 3.45 - _AlphaClip: 0 - _AlphaToMask: 0 - _Blend: 0 @@ -108,7 +105,6 @@ Material: - _Metallic: 0 - _OcclusionStrength: 1 - _Parallax: 0.005 - - _QueueControl: 0 - _QueueOffset: 0 - _ReceiveShadows: 1 - _Smoothness: 0.5 @@ -120,14 +116,14 @@ Material: - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - - Vector2_6A93A1CF: {r: 1, g: 1, b: 0, a: 0} - - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - - _Color: {r: 1, g: 1, b: 1, a: 1} + - _BaseColor: {r: 0.2806604, g: 0.3253052, b: 0.5, a: 1} + - _Color: {r: 0.28066033, g: 0.32530516, b: 0.5, a: 1} + - _CurvedWorldBendSettings: {r: 0, g: 1, b: 0, a: 0} - _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 ---- !u!114 &9048502931546906176 +--- !u!114 &488034238651743754 MonoBehaviour: m_ObjectHideFlags: 11 m_CorrespondingSourceObject: {fileID: 0} diff --git a/Assets/09.Shaders/Curved_Shader/CurvedWorldLit.mat.meta b/Assets/09.Shaders/Curved_Shader/CurvedWorldLit.mat.meta new file mode 100644 index 000000000..8a747f1d7 --- /dev/null +++ b/Assets/09.Shaders/Curved_Shader/CurvedWorldLit.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 17952d8922ff1fe4288af1505a784a9f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1).meta b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1).meta new file mode 100644 index 000000000..84744e5d1 --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1).meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b05c557c8a20d1d4e90b80768a98e20d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/LightingData.asset b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/LightingData.asset new file mode 100644 index 000000000..e068217b3 Binary files /dev/null and b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/LightingData.asset differ diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/LightingData.asset.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/LightingData.asset.meta new file mode 100644 index 000000000..060267832 --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6681b96718da109478138b4e562a90eb +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/ReflectionProbe-0.exr b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/ReflectionProbe-0.exr new file mode 100644 index 000000000..ef5901f1d Binary files /dev/null and b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/ReflectionProbe-0.exr differ diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/ReflectionProbe-0.exr.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/ReflectionProbe-0.exr.meta new file mode 100644 index 000000000..ec18256f7 --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 1)/ReflectionProbe-0.exr.meta @@ -0,0 +1,143 @@ +fileFormatVersion: 2 +guid: 05408aabfca693c4fbd44ccfd15c345b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + 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: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2).meta b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2).meta new file mode 100644 index 000000000..f180f1bdb --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2).meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a2926cd0a484b644ba8ee6c454f6f058 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/LightingData.asset b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/LightingData.asset new file mode 100644 index 000000000..3e8d37978 Binary files /dev/null and b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/LightingData.asset differ diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/LightingData.asset.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/LightingData.asset.meta new file mode 100644 index 000000000..8fcdf49d1 --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bd08f87a18207c048a762d4bbb24a0ec +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr new file mode 100644 index 000000000..ef5901f1d Binary files /dev/null and b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr differ diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr.meta new file mode 100644 index 000000000..bbf2156cb --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Non - Shader Bending (Scene 2)/ReflectionProbe-0.exr.meta @@ -0,0 +1,143 @@ +fileFormatVersion: 2 +guid: 35e952e8fa15cff45bd500bedbff09c4 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + 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: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished.meta new file mode 100644 index 000000000..4531bc701 --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 20f47dde1a6acc149a8d89c6b33ca58d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished/LightingData.asset b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished/LightingData.asset new file mode 100644 index 000000000..aff9cae58 Binary files /dev/null and b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished/LightingData.asset differ diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished/LightingData.asset.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished/LightingData.asset.meta new file mode 100644 index 000000000..6de65fb85 --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #3 - Little Planet (part 2) Finished/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42635e63b83514d48a40dbca34fde995 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends.meta new file mode 100644 index 000000000..69faec9b6 --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eaf2a28494d42934a9eb36029d8c2cd6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/LightingData.asset b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/LightingData.asset new file mode 100644 index 000000000..1c8442e28 Binary files /dev/null and b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/LightingData.asset differ diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/LightingData.asset.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/LightingData.asset.meta new file mode 100644 index 000000000..f602e071d --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e889868e9b69b643b38988d1b962c58 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/ReflectionProbe-0.exr b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/ReflectionProbe-0.exr new file mode 100644 index 000000000..23909038e Binary files /dev/null and b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/ReflectionProbe-0.exr differ diff --git a/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/ReflectionProbe-0.exr.meta b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/ReflectionProbe-0.exr.meta new file mode 100644 index 000000000..b8ece8532 --- /dev/null +++ b/Assets/Amazing Assets/Curved World/Example Scenes/Tutorial #4 - Multiple Bends/ReflectionProbe-0.exr.meta @@ -0,0 +1,143 @@ +fileFormatVersion: 2 +guid: 2778d32be99f95e47ab8e80bebfe1e62 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + 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 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + 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: 2 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 100 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: iOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/AllIn1VfxToolkit/Shaders/AllIn1VfxLit.shader b/Assets/Plugins/AllIn1VfxToolkit/Shaders/AllIn1VfxLit.shader index d5f114379..b94be9109 100644 --- a/Assets/Plugins/AllIn1VfxToolkit/Shaders/AllIn1VfxLit.shader +++ b/Assets/Plugins/AllIn1VfxToolkit/Shaders/AllIn1VfxLit.shader @@ -1,12 +1,10 @@ -// Upgrade NOTE: replaced 'defined FOG_COMBINED_WITH_WORLD_POS' with 'defined (FOG_COMBINED_WITH_WORLD_POS)' - //////////////////////////////////////// // Generated with Better Shaders // // Auto-generated shader code, don't hand edit! // // Unity Version: 2019.4.16f1 -// Render Pipeline: Standard +// Render Pipeline: URP2023 // Platform: WindowsEditor //////////////////////////////////////// @@ -218,19 +216,38 @@ Shader "AllIn1Vfx/AllIn1VfxLit" _DebugShape("Shape Debug Number", Int) = 1 //160 Needs to be last property + [HideInInspector]_QueueOffset("_QueueOffset", Float) = 0 + [HideInInspector]_QueueControl("_QueueControl", Float) = -1 + [HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {} + [HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {} + } SubShader { - Tags { "RenderType" = "Opaque" "Queue" = "Geometry" } + Tags { "RenderPipeline"="UniversalPipeline" "RenderType" = "Opaque" "UniversalMaterialType" = "Lit" "Queue" = "Geometry" } + - Pass - { - Name "FORWARD" - Tags { "LightMode" = "ForwardBase" } - - Tags + Pass + { + Name "Universal Forward" + Tags + { + "LightMode" = "UniversalForward" + } + Cull Back + Blend One Zero + ZTest LEqual + ZWrite On + + Blend One Zero, One Zero +Cull Back +ZTest LEqual +ZWrite On + + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" } @@ -241,32 +258,54 @@ Shader "AllIn1Vfx/AllIn1VfxLit" Lighting Off - CGPROGRAM - // compile directives - #pragma vertex Vert + HLSLPROGRAM + + #pragma vertex Vert #pragma fragment Frag - #pragma target 3.0 - #pragma multi_compile_instancing - #pragma multi_compile_fog - #pragma multi_compile_fwdbase - #include "HLSLSupport.cginc" - #define UNITY_INSTANCED_LOD_FADE - #define UNITY_INSTANCED_SH - #define UNITY_INSTANCED_LIGHTMAPSTS + #pragma target 3.0 - #include "UnityShaderVariables.cginc" - #include "UnityShaderUtilities.cginc" - // -------- variant for: + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma instancing_options renderinglayer + + // Keywords + #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #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 _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _LIGHT_LAYERS + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_VERTEX + #pragma multi_compile _ EVALUATE_SH_MIXED + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - #include "AutoLight.cginc" - #define SHADER_PASS SHADERPASS_FORWARD - #define _PASSFORWARD 1 + + // GraphKeywords: - + #define SHADER_PASS SHADERPASS_FORWARD + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define _PASSFORWARD 1 + #define _FOG_FRAGMENT 1 + + + #pragma shader_feature_local TIMEISCUSTOM_ON #pragma shader_feature_local ADDITIVECONFIG_ON #pragma shader_feature_local PREMULTIPLYALPHA_ON @@ -340,1268 +379,159 @@ Lighting Off #pragma shader_feature NORMALMAP_ON - #define _STANDARD 1 -// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same -// texturing library they use. However, since they are not included in the standard pipeline by default, there is no -// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without -// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead -// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not -// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + #define _URP 1 +#define REQUIRE_DEPTH_TEXTURE -#if defined(SHADER_API_GAMECORE) - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r - #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_XBOXONE) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_PSSL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName - #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - - -#elif defined(SHADER_API_D3D11) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_METAL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_VULKAN) -// This file assume SHADER_API_VULKAN is defined - // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. - - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_SWITCH) - // This file assume SHADER_API_SWITCH is defined - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_GLCORE) - - // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 46) - #define OPENGL4_1_SM5 1 - #else - #define OPENGL4_1_SM5 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - - #if OPENGL4_1_SM5 - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #endif - - - #elif defined(SHADER_API_GLES3) - - // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 40) - #define GLES3_1_AEP 1 - #else - #define GLES3_1_AEP 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #if GLES3_1_AEP - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - #else - #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - #endif - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #if GLES3_1_AEP - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - #endif - - -#elif defined(SHADER_API_GLES) - - - #define uint int - - #define rcp(x) 1.0 / (x) - #define ddx_fine ddx - #define ddy_fine ddy - #define asfloat - #define asuint(x) asint(x) - #define f32tof16 - #define f16tof32 - - #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 - - // Texture abstraction - - #define TEXTURE2D(textureName) sampler2D textureName - #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray - #define TEXTURECUBE(textureName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray - #define TEXTURE3D(textureName) sampler3D textureName - - #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray - #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray - #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName - - #define TEXTURE2D_HALF(textureName) sampler2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray - #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray - #define TEXTURE3D_HALF(textureName) sampler3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - - #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - - #define SAMPLER(samplerName) - #define SAMPLER_CMP(samplerName) - - #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) - - #if (SHADER_TARGET >= 30) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) - #else - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) - #endif - - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) - - - // Not supported. Can't define as error because shader library is calling these functions. - #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) - - // Gather not supported. Fallback to regular texture sampling. - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - -#else -#error unsupported shader api -#endif - - - - -// default flow control attributes -#ifndef UNITY_BRANCH -# define UNITY_BRANCH -#endif -#ifndef UNITY_FLATTEN -# define UNITY_FLATTEN -#endif -#ifndef UNITY_UNROLL -# define UNITY_UNROLL -#endif -#ifndef UNITY_UNROLLX -# define UNITY_UNROLLX(_x) -#endif -#ifndef UNITY_LOOP -# define UNITY_LOOP -#endif - - - - - - // data across stages, stripped like the above. - struct VertexToPixel - { - UNITY_POSITION(pos); - float3 worldPos : TEXCOORD0; - float3 worldNormal : TEXCOORD1; - float4 worldTangent : TEXCOORD2; - float4 texcoord0 : TEXCOORD3; - // float4 texcoord1 : TEXCOORD4; - // float4 texcoord2 : TEXCOORD5; - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD6; - // #endif - - // #if %SCREENPOSREQUIREKEY% - float4 screenPos : TEXCOORD7; - // #endif - - float4 lmap : TEXCOORD8; - #if UNITY_SHOULD_SAMPLE_SH - half3 sh : TEXCOORD9; // SH - #endif - #ifdef LIGHTMAP_ON - UNITY_LIGHTING_COORDS(10,11) - UNITY_FOG_COORDS(12) - #else - UNITY_FOG_COORDS(10) - UNITY_SHADOW_COORDS(11) + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR #endif - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - // #if %EXTRAV2F0REQUIREKEY% - float4 extraV2F0 : TEXCOORD13; - // #endif + // Includes + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + - // #if %EXTRAV2F1REQUIREKEY% - float4 extraV2F1 : TEXCOORD14; - // #endif + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) - // #if %EXTRAV2F2REQUIREKEY% - float4 extraV2F2 : TEXCOORD15; - // #endif + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); - // #if %EXTRAV2F3REQUIREKEY% - float4 extraV2F3 : TEXCOORD16; - // #endif + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) - // #if %EXTRAV2F4REQUIREKEY% - // float4 extraV2F4 : TEXCOORD17; - // #endif + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif - // #if %EXTRAV2F5REQUIREKEY% - // float4 extraV2F5 : TEXCOORD18; - // #endif + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D - // #if %EXTRAV2F6REQUIREKEY% - // float4 extraV2F6 : TEXCOORD19; - // #endif + - // #if %EXTRAV2F7REQUIREKEY% - // float4 extraV2F7 : TEXCOORD20; - // #endif + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + // float4 texcoord1 : TEXCOORD4; + // float4 texcoord2 : TEXCOORD5; + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - }; @@ -1849,9 +779,9 @@ Lighting Off #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) #endif - #undef UNITY_MATRIX_I_M + #undef GetWorldToObjectMatrix() - #define UNITY_MATRIX_I_M unity_WorldToObject + #define GetWorldToObjectMatrix() unity_WorldToObject #endif @@ -1897,7 +827,7 @@ Lighting Off float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) { float eye = GetLinearEyeDepth(uv); - float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); float dt = dot(worldSpaceViewDir, camView); float3 div = worldSpaceViewDir/dt; @@ -1923,7 +853,7 @@ Lighting Off { float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); float3 norms = DecodeViewNormalStereo(depthNorms); - norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; return norms; } #elif _HDRP && !_DECALSHADER @@ -2013,7 +943,9 @@ Lighting Off - + CBUFFER_START(UnityPerMaterial) + + half4 _Color; half _Alpha; half _AlphaCutoffValue; @@ -2231,6 +1163,8 @@ Lighting Off + CBUFFER_END + @@ -3356,20 +2290,52 @@ Lighting Off #endif + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + // vertex shader VertexToPixel Vert (VertexData v) { + VertexToPixel o = (VertexToPixel)0; + UNITY_SETUP_INSTANCE_ID(v); - VertexToPixel o; - UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); - UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_TRANSFER_INSTANCE_ID(v, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); -#if !_TESSELLATION_ON - ChainModifyVertex(v, o, _Time); -#endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif - o.pos = UnityObjectToClipPos(v.vertex); o.texcoord0 = v.texcoord0; // o.texcoord1 = v.texcoord1; // o.texcoord2 = v.texcoord2; @@ -3382,3670 +2348,373 @@ Lighting Off o.vertexColor = v.vertexColor; // #endif - // #if %SCREENPOSREQUIREKEY% - o.screenPos = ComputeScreenPos(o.pos); - // #endif - - o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; - o.worldNormal = UnityObjectToWorldNormal(v.normal); - o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); - - - #ifdef DYNAMICLIGHTMAP_ON - o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; - #endif - #ifdef LIGHTMAP_ON - o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; - #endif - - // SH/ambient and vertex lights - #ifndef LIGHTMAP_ON - #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL - o.sh = 0; - // Approximated illumination from non-important point lights - #ifdef VERTEXLIGHT_ON - o.sh += Shade4PointLights ( - unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0, - unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb, - unity_4LightAtten0, o.worldPos, o.worldNormal); - #endif - o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); - #endif - #endif // !LIGHTMAP_ON - - UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader - #ifdef FOG_COMBINED_WITH_TSPACE - UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader - #elif defined (FOG_COMBINED_WITH_WORLD_POS) - UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader - #else - UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader - #endif - - return o; - } - - - - // fragment shader - fixed4 Frag (VertexToPixel IN - #ifdef _DEPTHOFFSET_ON - , out float outputDepth : SV_Depth - #endif - #if NEED_FACING - , bool facing : SV_IsFrontFace - #endif - ) : SV_Target - { - UNITY_SETUP_INSTANCE_ID(IN); - // prepare and unpack data - #ifdef FOG_COMBINED_WITH_TSPACE - UNITY_EXTRACT_FOG_FROM_TSPACE(IN); - #elif defined (FOG_COMBINED_WITH_WORLD_POS) - UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); - #else - UNITY_EXTRACT_FOG(IN); - #endif - - ShaderData d = CreateShaderData(IN - #if NEED_FACING - , facing - #endif - ); - Surface l = (Surface)0; - - - #ifdef _DEPTHOFFSET_ON - l.outputDepth = outputDepth; - #endif - + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); - - l.Albedo = half3(0.5, 0.5, 0.5); - l.Normal = float3(0,0,1); - l.Occlusion = 1; - l.Alpha = 1; - - ChainSurfaceFunction(l, d); - - - - #ifdef _DEPTHOFFSET_ON - outputDepth = l.outputDepth; - #endif + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; - #ifndef USING_DIRECTIONAL_LIGHT - fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); - #else - fixed3 lightDir = _WorldSpaceLightPos0.xyz; - #endif - float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); - - // compute lighting & shadowing factor - UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) - - #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC - #ifdef UNITY_COMPILER_HLSL - SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); #else - SurfaceOutputStandardSpecular o; + float3 lightDirectionWS = _LightDirection; #endif - o.Specular = l.Specular; - o.Occlusion = l.Occlusion; - o.Smoothness = l.Smoothness; - #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT - #ifdef UNITY_COMPILER_HLSL - SurfaceOutput o = (SurfaceOutput)0; + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); #else - SurfaceOutput o; + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); #endif - - o.Specular = l.Specular; - o.Gloss = l.Smoothness; - _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. - #else - #ifdef UNITY_COMPILER_HLSL - SurfaceOutputStandard o = (SurfaceOutputStandard)0; - #else - SurfaceOutputStandard o; - #endif - o.Smoothness = l.Smoothness; - o.Metallic = l.Metallic; - o.Occlusion = l.Occlusion; - #endif - - o.Albedo = l.Albedo; - o.Emission = l.Emission; - o.Alpha = l.Alpha; - #if _WORLDSPACENORMAL - o.Normal = l.Normal; - #else - o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); - #endif - - fixed4 c = 0; - // Setup lighting environment - UnityGI gi; - UNITY_INITIALIZE_OUTPUT(UnityGI, gi); - gi.indirect.diffuse = 0; - gi.indirect.specular = 0; - gi.light.color = _LightColor0.rgb; - gi.light.dir = lightDir; - // Call GI (lightmaps/SH/reflections) lighting function - UnityGIInput giInput; - UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); - giInput.light = gi.light; - giInput.worldPos = d.worldSpacePosition; - giInput.worldViewDir = worldViewDir; - giInput.atten = atten; - #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) - giInput.lightmapUV = IN.lmap; - #else - giInput.lightmapUV = 0.0; - #endif - #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL - giInput.ambient = IN.sh; - #else - giInput.ambient.rgb = 0.0; - #endif - giInput.probeHDR[0] = unity_SpecCube0_HDR; - giInput.probeHDR[1] = unity_SpecCube1_HDR; - #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) - giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending - #endif - #ifdef UNITY_SPECCUBE_BOX_PROJECTION - giInput.boxMax[0] = unity_SpecCube0_BoxMax; - giInput.probePosition[0] = unity_SpecCube0_ProbePosition; - giInput.boxMax[1] = unity_SpecCube1_BoxMax; - giInput.boxMin[1] = unity_SpecCube1_BoxMin; - giInput.probePosition[1] = unity_SpecCube1_ProbePosition; - #endif - - - - #if defined(_OVERRIDE_SHADOWMASK) - float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); - gi.light.color *= mulColor; - giInput.light.color *= mulColor; - #endif - - #if _UNLIT - c.rgb = l.Albedo; - c.a = l.Alpha; - #elif _BDRF3 || _SIMPLELIT - LightingBlinnPhong_GI(o, giInput, gi); - #if defined(_OVERRIDE_BAKEDGI) - gi.indirect.diffuse = l.DiffuseGI; - gi.indirect.specular = l.SpecularGI; - #endif - c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); - #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC - LightingStandardSpecular_GI(o, giInput, gi); - #if defined(_OVERRIDE_BAKEDGI) - gi.indirect.diffuse = l.DiffuseGI; - gi.indirect.specular = l.SpecularGI; - #endif - c += LightingStandardSpecular (o, d.worldSpaceViewDir, gi); - #else - LightingStandard_GI(o, giInput, gi); - #if defined(_OVERRIDE_BAKEDGI) - gi.indirect.diffuse = l.DiffuseGI; - gi.indirect.specular = l.SpecularGI; - #endif - c += LightingStandard (o, d.worldSpaceViewDir, gi); - #endif - - c.rgb += o.Emission; - - ChainFinalColorForward(l, d, c); - - #if !DISABLEFOG - UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog - #endif - - - return c; - } - - ENDCG - - } - - - - // ---- deferred shading pass: - Pass - { - Name "DEFERRED" - Tags { "LightMode" = "Deferred" } - - Tags - { - "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" - } - Cull [_CullingOption] - ZWrite [_ZWrite] - ZTest [_ZTestMode] - ColorMask [_ColorMask] -Lighting Off - - - CGPROGRAM - - #pragma vertex Vert - #pragma fragment Frag - - // compile directives - #pragma target 3.0 - #pragma multi_compile_instancing - #pragma exclude_renderers nomrt - #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 - #pragma multi_compile_prepassfinal - #include "HLSLSupport.cginc" - #define UNITY_INSTANCED_LOD_FADE - #define UNITY_INSTANCED_SH - #define UNITY_INSTANCED_LIGHTMAPSTS - #include "UnityShaderVariables.cginc" - #include "UnityShaderUtilities.cginc" - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - - #define _PASSGBUFFER 1 - - - #pragma shader_feature_local TIMEISCUSTOM_ON - #pragma shader_feature_local ADDITIVECONFIG_ON - #pragma shader_feature_local PREMULTIPLYALPHA_ON - #pragma shader_feature_local PREMULTIPLYCOLOR_ON - #pragma shader_feature_local SPLITRGBA_ON - #pragma shader_feature_local SHAPEADD_ON - - #pragma shader_feature_local SHAPE1SCREENUV_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local SHAPE2SCREENUV_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local SHAPE3SCREENUV_ON /////////////////Pipeline specific implementation - - #pragma shader_feature_local SHAPEDEBUG_ON - - #pragma shader_feature_local SHAPE1CONTRAST_ON - #pragma shader_feature_local SHAPE1DISTORT_ON - #pragma shader_feature_local SHAPE1ROTATE_ON - #pragma shader_feature_local SHAPE1SHAPECOLOR_ON - - #pragma shader_feature_local SHAPE2_ON - #pragma shader_feature_local SHAPE2CONTRAST_ON - #pragma shader_feature_local SHAPE2DISTORT_ON - #pragma shader_feature_local SHAPE2ROTATE_ON - #pragma shader_feature_local SHAPE2SHAPECOLOR_ON - - #pragma shader_feature_local SHAPE3_ON - #pragma shader_feature_local SHAPE3CONTRAST_ON - #pragma shader_feature_local SHAPE3DISTORT_ON - #pragma shader_feature_local SHAPE3ROTATE_ON - #pragma shader_feature_local SHAPE3SHAPECOLOR_ON - - #pragma shader_feature_local GLOW_ON - #pragma shader_feature_local GLOWTEX_ON - #pragma shader_feature_local DEPTHGLOW_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local MASK_ON - #pragma shader_feature_local COLORRAMP_ON - #pragma shader_feature_local COLORRAMPGRAD_ON - #pragma shader_feature_local COLORGRADING_ON - #pragma shader_feature_local HSV_ON - #pragma shader_feature_local POSTERIZE_ON - #pragma shader_feature_local PIXELATE_ON - #pragma shader_feature_local DISTORT_ON - #pragma shader_feature_local SHAKEUV_ON - #pragma shader_feature_local WAVEUV_ON - #pragma shader_feature_local ROUNDWAVEUV_ON - #pragma shader_feature_local TWISTUV_ON - #pragma shader_feature_local DOODLE_ON - #pragma shader_feature_local OFFSETSTREAM_ON - #pragma shader_feature_local TEXTURESCROLL_ON - #pragma shader_feature_local VERTOFFSET_ON - #pragma shader_feature_local RIM_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local BACKFACETINT_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local POLARUV_ON - #pragma shader_feature_local POLARUVDISTORT_ON - #pragma shader_feature_local SHAPE1MASK_ON - #pragma shader_feature_local TRAILWIDTH_ON - #pragma shader_feature_local LIGHTANDSHADOW_ON - #pragma shader_feature_local SHAPETEXOFFSET_ON - #pragma shader_feature_local SHAPEWEIGHTS_ON - - #pragma shader_feature_local ALPHACUTOFF_ON - #pragma shader_feature_local ALPHASMOOTHSTEP_ON - #pragma shader_feature_local FADE_ON - #pragma shader_feature_local FADEBURN_ON - #pragma shader_feature_local ALPHAFADE_ON - #pragma shader_feature_local ALPHAFADEUSESHAPE1_ON - #pragma shader_feature_local ALPHAFADEUSEREDCHANNEL_ON - #pragma shader_feature_local ALPHAFADETRANSPARENCYTOO_ON - #pragma shader_feature_local ALPHAFADEINPUTSTREAM_ON - #pragma shader_feature_local CAMDISTFADE_ON - - #pragma shader_feature NORMALMAP_ON - - - #define _STANDARD 1 -// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same -// texturing library they use. However, since they are not included in the standard pipeline by default, there is no -// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without -// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead -// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not -// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. - -#if defined(SHADER_API_GAMECORE) - - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r - #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_XBOXONE) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_PSSL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName - #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - - -#elif defined(SHADER_API_D3D11) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_METAL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_VULKAN) -// This file assume SHADER_API_VULKAN is defined - // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. - - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_SWITCH) - // This file assume SHADER_API_SWITCH is defined - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_GLCORE) - - // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 46) - #define OPENGL4_1_SM5 1 - #else - #define OPENGL4_1_SM5 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - - #if OPENGL4_1_SM5 - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #endif - - - #elif defined(SHADER_API_GLES3) - - // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 40) - #define GLES3_1_AEP 1 - #else - #define GLES3_1_AEP 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #if GLES3_1_AEP - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - #else - #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - #endif - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #if GLES3_1_AEP - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - #endif - - -#elif defined(SHADER_API_GLES) - - - #define uint int - - #define rcp(x) 1.0 / (x) - #define ddx_fine ddx - #define ddy_fine ddy - #define asfloat - #define asuint(x) asint(x) - #define f32tof16 - #define f16tof32 - - #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 - - // Texture abstraction - - #define TEXTURE2D(textureName) sampler2D textureName - #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray - #define TEXTURECUBE(textureName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray - #define TEXTURE3D(textureName) sampler3D textureName - - #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray - #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray - #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName - - #define TEXTURE2D_HALF(textureName) sampler2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray - #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray - #define TEXTURE3D_HALF(textureName) sampler3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - - #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - - #define SAMPLER(samplerName) - #define SAMPLER_CMP(samplerName) - - #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) - - #if (SHADER_TARGET >= 30) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) - #else - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) - #endif - - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) - - - // Not supported. Can't define as error because shader library is calling these functions. - #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) - - // Gather not supported. Fallback to regular texture sampling. - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - -#else -#error unsupported shader api -#endif - - - - -// default flow control attributes -#ifndef UNITY_BRANCH -# define UNITY_BRANCH -#endif -#ifndef UNITY_FLATTEN -# define UNITY_FLATTEN -#endif -#ifndef UNITY_UNROLL -# define UNITY_UNROLL -#endif -#ifndef UNITY_UNROLLX -# define UNITY_UNROLLX(_x) -#endif -#ifndef UNITY_LOOP -# define UNITY_LOOP -#endif - - - - - - - - // data across stages, stripped like the above. - struct VertexToPixel - { - UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff - float3 worldPos : TEXCOORD0; - float3 worldNormal : TEXCOORD1; - float4 worldTangent : TEXCOORD2; - float4 texcoord0 : TEXCOORD3; - // float4 texcoord1 : TEXCOORD4; - // float4 texcoord2 : TEXCOORD5; - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD6; - // #endif - - // #if %SCREENPOSREQUIREKEY% - float4 screenPos : TEXCOORD7; - // #endif - - #ifndef DIRLIGHTMAP_OFF - float3 viewDir : TEXCOORD8; - #endif - float4 lmap : TEXCOORD9; - #ifndef LIGHTMAP_ON - #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL - half3 sh : TEXCOORD10; // SH - #endif - #else - #ifdef DIRLIGHTMAP_OFF - float4 lmapFadePos : TEXCOORD11; - #endif - #endif - - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - // #if %EXTRAV2F0REQUIREKEY% - float4 extraV2F0 : TEXCOORD12; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - float4 extraV2F1 : TEXCOORD13; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - float4 extraV2F2 : TEXCOORD14; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - float4 extraV2F3 : TEXCOORD15; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // float4 extraV2F4 : TEXCOORD16; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // float4 extraV2F5 : TEXCOORD17; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // float4 extraV2F6 : TEXCOORD18; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // float4 extraV2F7 : TEXCOORD19; - // #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - }; - - - - // data describing the user output of a pixel - struct Surface - { - half3 Albedo; - half Height; - half3 Normal; - half Smoothness; - half3 Emission; - half Metallic; - half3 Specular; - half Occlusion; - half SpecularPower; // for simple lighting - half Alpha; - float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value - // HDRP Only - half SpecularOcclusion; - half SubsurfaceMask; - half Thickness; - half CoatMask; - half CoatSmoothness; - half Anisotropy; - half IridescenceMask; - half IridescenceThickness; - int DiffusionProfileHash; - float SpecularAAThreshold; - float SpecularAAScreenSpaceVariance; - // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines - float3 DiffuseGI; - float3 BackDiffuseGI; - float3 SpecularGI; - float ior; - float3 transmittanceColor; - float atDistance; - float transmittanceMask; - // requires _OVERRIDE_SHADOWMASK to be defines - float4 ShadowMask; - - // for decals - float NormalAlpha; - float MAOSAlpha; - - - }; - - // Data the user declares in blackboard blocks - struct Blackboard - { - - float blackboardDummyData; - }; - - // data the user might need, this will grow to be big. But easy to strip - struct ShaderData - { - float4 clipPos; // SV_POSITION - float3 localSpacePosition; - float3 localSpaceNormal; - float3 localSpaceTangent; - - float3 worldSpacePosition; - float3 worldSpaceNormal; - float3 worldSpaceTangent; - float tangentSign; - - float3 worldSpaceViewDir; - float3 tangentSpaceViewDir; - - float4 texcoord0; - float4 texcoord1; - float4 texcoord2; - float4 texcoord3; - - float2 screenUV; - float4 screenPos; - - float4 vertexColor; - bool isFrontFace; - - float4 extraV2F0; - float4 extraV2F1; - float4 extraV2F2; - float4 extraV2F3; - float4 extraV2F4; - float4 extraV2F5; - float4 extraV2F6; - float4 extraV2F7; - - float3x3 TBNMatrix; - Blackboard blackboard; - }; - - struct VertexData - { - #if SHADER_TARGET > 30 - // uint vertexID : SV_VertexID; - #endif - float4 vertex : POSITION; - float3 normal : NORMAL; - float4 tangent : TANGENT; - float4 texcoord0 : TEXCOORD0; - - // optimize out mesh coords when not in use by user or lighting system - #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) - float4 texcoord1 : TEXCOORD1; - #endif - - #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) - float4 texcoord2 : TEXCOORD2; - #endif - - #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) - float4 texcoord1 : TEXCOORD1; - #endif - #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) - float4 texcoord2 : TEXCOORD2; - #endif - - - #if _HDRP - float4 texcoord1 : TEXCOORD1; - float4 texcoord2 : TEXCOORD2; - #endif - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) - float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) - #if defined (_ADD_PRECOMPUTED_VELOCITY) - float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). - #endif - #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - }; - - struct TessVertex - { - float4 vertex : INTERNALTESSPOS; - float3 normal : NORMAL; - float4 tangent : TANGENT; - float4 texcoord0 : TEXCOORD0; - float4 texcoord1 : TEXCOORD1; - float4 texcoord2 : TEXCOORD2; - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - // #if %EXTRAV2F0REQUIREKEY% - float4 extraV2F0 : TEXCOORD5; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - float4 extraV2F1 : TEXCOORD6; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - float4 extraV2F2 : TEXCOORD7; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - float4 extraV2F3 : TEXCOORD8; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // float4 extraV2F4 : TEXCOORD9; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // float4 extraV2F5 : TEXCOORD10; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // float4 extraV2F6 : TEXCOORD11; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // float4 extraV2F7 : TEXCOORD12; - // #endif - - #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) - float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) - #if defined (_ADD_PRECOMPUTED_VELOCITY) - float3 precomputedVelocity : TEXCOORD14; - #endif - #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - }; - - struct ExtraV2F - { - float4 extraV2F0; - float4 extraV2F1; - float4 extraV2F2; - float4 extraV2F3; - float4 extraV2F4; - float4 extraV2F5; - float4 extraV2F6; - float4 extraV2F7; - Blackboard blackboard; - float4 time; - }; - - - float3 WorldToTangentSpace(ShaderData d, float3 normal) - { - return mul(d.TBNMatrix, normal); - } - - float3 TangentToWorldSpace(ShaderData d, float3 normal) - { - return mul(normal, d.TBNMatrix); - } - - // in this case, make standard more like SRPs, because we can't fix - // unity_WorldToObject in HDRP, since it already does macro-fu there - - #if _STANDARD - float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; - float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; - float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; - float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; - float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } - float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } - #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) - #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) - #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) - #else - #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) - #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) - #endif - - #undef UNITY_MATRIX_I_M - - #define UNITY_MATRIX_I_M unity_WorldToObject - - - #endif - - float3 GetCameraWorldPosition() - { - #if _HDRP - return GetCameraRelativePositionWS(_WorldSpaceCameraPos); - #else - return _WorldSpaceCameraPos; - #endif - } - - #if _GRABPASSUSED - #if _STANDARD - TEXTURE2D(%GRABTEXTURE%); - SAMPLER(sampler_%GRABTEXTURE%); - #endif - - half3 GetSceneColor(float2 uv) - { - #if _STANDARD - return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; - #else - return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); - #endif - } - #endif - - - - #if _STANDARD - UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); - float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } - float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } - float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } - #else - float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } - float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } - float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } - #endif - - float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) - { - float eye = GetLinearEyeDepth(uv); - float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); - - float dt = dot(worldSpaceViewDir, camView); - float3 div = worldSpaceViewDir/dt; - float3 wpos = (eye * div) + GetCameraWorldPosition(); - return wpos; - } - - #if _HDRP - float3 ObjectToWorldSpacePosition(float3 pos) - { - return GetAbsolutePositionWS(TransformObjectToWorld(pos)); - } - #else - float3 ObjectToWorldSpacePosition(float3 pos) - { - return TransformObjectToWorld(pos); - } - #endif - - #if _STANDARD - UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); - float3 norms = DecodeViewNormalStereo(depthNorms); - norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; - return norms; - } - #elif _HDRP && !_DECALSHADER - - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - NormalData nd; - DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); - return nd.normalWS; - } - #elif _URP - #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) - #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" - #endif - - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) - return SampleSceneNormals(uv); - #else - float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); - return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; - #endif - - } - #endif - - #if _HDRP - - half3 UnpackNormalmapRGorAG(half4 packednormal) - { - // This do the trick - packednormal.x *= packednormal.w; - - half3 normal; - normal.xy = packednormal.xy * 2 - 1; - normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); - return normal; - } - half3 UnpackNormal(half4 packednormal) - { - #if defined(UNITY_NO_DXT5nm) - return packednormal.xyz * 2 - 1; - #else - return UnpackNormalmapRGorAG(packednormal); - #endif - } - #endif - #if _HDRP || _URP - - half3 UnpackScaleNormal(half4 packednormal, half scale) - { - #ifndef UNITY_NO_DXT5nm - // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) - // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 - packednormal.x *= packednormal.w; - #endif - half3 normal; - normal.xy = (packednormal.xy * 2 - 1) * scale; - normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); - return normal; - } - - #endif - - - void GetSun(out float3 lightDir, out float3 color) - { - lightDir = float3(0.5, 0.5, 0); - color = 1; - #if _HDRP - if (_DirectionalLightCount > 0) - { - DirectionalLightData light = _DirectionalLightDatas[0]; - lightDir = -light.forward.xyz; - color = light.color; - } - #elif _STANDARD - lightDir = normalize(_WorldSpaceLightPos0.xyz); - color = _LightColor0.rgb; - #elif _URP - Light light = GetMainLight(); - lightDir = light.direction; - color = light.color; - #endif - } - - - - - half4 _Color; - half _Alpha; - half _AlphaCutoffValue; - - half _TimingSeed; - - #if TIMEISCUSTOM_ON - float4 globalCustomTime; - #endif - - half4 _MainTex_ST, _ShapeColor; - half _ShapeXSpeed, _ShapeYSpeed, _ShapeColorWeight, _ShapeAlphaWeight; - - #if SHAPE1CONTRAST_ON - half _ShapeContrast, _ShapeBrightness; - #endif - - #if SHAPE1DISTORT_ON - half4 _ShapeDistortTex_ST; - half _ShapeDistortAmount, _ShapeDistortXSpeed, _ShapeDistortYSpeed; - #endif - - #if SHAPE1ROTATE_ON - half _ShapeRotationOffset, _ShapeRotationSpeed; - #endif - - #if OFFSETSTREAM_ON - half _OffsetSh1; - #endif - - #if SHAPEWEIGHTS_ON - half _Sh1BlendOffset; - #endif - - #if SHAPE2_ON - half4 _Shape2Tex_ST, _Shape2Color; - half _Shape2XSpeed, _Shape2YSpeed, _Shape2ColorWeight, _Shape2AlphaWeight; - #if SHAPE2CONTRAST_ON - half _Shape2Contrast, _Shape2Brightness; - #endif - #if SHAPE2DISTORT_ON - half4 _Shape2DistortTex_ST; - half _Shape2DistortAmount, _Shape2DistortXSpeed, _Shape2DistortYSpeed; - #endif - #if SHAPE2ROTATE_ON - half _Shape2RotationOffset, _Shape2RotationSpeed; - #endif - #if OFFSETSTREAM_ON - half _OffsetSh2; - #endif - #if SHAPEWEIGHTS_ON - half _Sh2BlendOffset; - #endif - #endif - - #if SHAPE3_ON - half4 _Shape3Tex_ST, _Shape3Color; - half _Shape3XSpeed, _Shape3YSpeed, _Shape3ColorWeight, _Shape3AlphaWeight; - #if SHAPE3CONTRAST_ON - half _Shape3Contrast, _Shape3Brightness; - #endif - #if SHAPE3DISTORT_ON - half4 _Shape3DistortTex_ST; - half _Shape3DistortAmount, _Shape3DistortXSpeed, _Shape3DistortYSpeed; - #endif - #if SHAPE3ROTATE_ON - half _Shape3RotationOffset, _Shape3RotationSpeed; - #endif - #if OFFSETSTREAM_ON - half _OffsetSh3; - #endif - #if SHAPEWEIGHTS_ON - half _Sh3BlendOffset; - #endif - #endif - - #if GLOW_ON - half4 _GlowColor; - half _Glow, _GlowGlobal; - #if GLOWTEX_ON - half4 _GlowTex_ST; - #endif - #endif - - #if MASK_ON - half4 _MaskTex_ST; - half _MaskPow; - #endif - - #if COLORRAMP_ON - half _ColorRampLuminosity, _ColorRampBlend; - #endif - - #if ALPHASMOOTHSTEP_ON - half _AlphaStepMin, _AlphaStepMax; - #endif - - #if ALPHAFADE_ON - half _AlphaFadeAmount, _AlphaFadeSmooth, _AlphaFadePow; - #endif - - #if HSV_ON - half _HsvShift, _HsvSaturation, _HsvBright; - #endif - - #if POSTERIZE_ON - half _PosterizeNumColors; - #endif - - #if PIXELATE_ON - half _PixelateSize; - #endif - - #if DISTORT_ON - half4 _DistortTex_ST; - half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; - #endif - - #if TEXTURESCROLL_ON - half _TextureScrollXSpeed, _TextureScrollYSpeed; - #endif - - #if SHAKEUV_ON - half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; - #endif - - #if WAVEUV_ON - half _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; - #endif - - #if ROUNDWAVEUV_ON - half _RoundWaveStrength, _RoundWaveSpeed; - #endif - - #if TWISTUV_ON - half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; - #endif - - #if DOODLE_ON - half _HandDrawnAmount, _HandDrawnSpeed; - #endif - - #if ROUNDWAVEUV_ON || PIXELATE_ON - half4 _MainTex_TexelSize; - #endif - - #if VERTOFFSET_ON - half4 _VertOffsetTex_ST; - half _VertOffsetAmount, _VertOffsetPower, _VertOffsetTexXSpeed, _VertOffsetTexYSpeed; - #endif - - #if FADE_ON - half4 _FadeTex_ST; - half _FadeAmount, _FadeTransition, _FadePower, _FadeScrollXSpeed, _FadeScrollYSpeed; - #if FADEBURN_ON - half4 _FadeBurnColor, _FadeBurnTex_ST; - half _FadeBurnWidth, _FadeBurnGlow; - #endif - #endif - - #if COLORGRADING_ON - half3 _ColorGradingLight, _ColorGradingMiddle, _ColorGradingDark; - half _ColorGradingMidPoint; - #endif - - #if CAMDISTFADE_ON - half _CamDistFadeStepMin, _CamDistFadeStepMax, _CamDistProximityFade; - #endif - - #if RIM_ON - half _RimBias, _RimScale, _RimPower, _RimIntensity, _RimAddAmount, _RimErodesAlpha; - half4 _RimColor; - #endif - - #if BACKFACETINT_ON - half4 _BackFaceTint, _FrontFaceTint; - #endif - - #if SHAPEDEBUG_ON - half _DebugShape; - #endif - - #if SHAPE1MASK_ON - half4 _Shape1MaskTex_ST; - half _Shape1MaskPow; - #endif - - #if TRAILWIDTH_ON - half _TrailWidthPower; - #endif - - #if LIGHTANDSHADOW_ON - half3 _All1VfxLightDir; - half _ShadowAmount, _ShadowStepMin, _ShadowStepMax, _LightAmount; - half4 _LightColor; - #endif - - #if SHAPETEXOFFSET_ON - half _RandomSh1Mult, _RandomSh2Mult, _RandomSh3Mult; - #endif - - #if DEPTHGLOW_ON - half _DepthGlowDist, _DepthGlowPow, _DepthGlow, _DepthGlowGlobal; - half4 _DepthGlowColor; - #endif - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half _ScreenUvShDistScale,_ScreenUvSh2DistScale, _ScreenUvSh3DistScale; - #endif - - #if NORMALMAP_ON - half _NormalStrength; - #endif - - - - - - - - - - - TEXTURE2D(_MainTex); - SAMPLER(sampler_MainTex); - - #if SHAPE1DISTORT_ON - TEXTURE2D(_ShapeDistortTex); - SAMPLER(sampler_ShapeDistortTex); - #endif - - #if SHAPE2_ON - TEXTURE2D(_Shape2Tex); - SAMPLER(sampler_Shape2Tex); - #if SHAPE2DISTORT_ON - TEXTURE2D(_Shape2DistortTex); - SAMPLER(sampler_Shape2DistortTex); - #endif - #endif - - #if SHAPE3_ON - TEXTURE2D(_Shape3Tex); - SAMPLER(sampler_Shape3Tex); - #if SHAPE3DISTORT_ON - TEXTURE2D(_Shape3DistortTex); - SAMPLER(sampler_Shape3DistortTex); - #endif - #endif - - #if GLOW_ON - #if GLOWTEX_ON - TEXTURE2D(_GlowTex); - SAMPLER(sampler_GlowTex); - #endif - #endif - - #if MASK_ON - TEXTURE2D(_MaskTex); - SAMPLER(sampler_MaskTex); - #endif - - #if COLORRAMP_ON - TEXTURE2D(_ColorRampTex); - SAMPLER(sampler_ColorRampTex); - #endif - - #if COLORRAMPGRAD_ON - TEXTURE2D(_ColorRampTexGradient); - SAMPLER(sampler_ColorRampTexGradient); - #endif - - #if DISTORT_ON - TEXTURE2D(_DistortTex); - SAMPLER(sampler_DistortTex); - #endif - - #if VERTOFFSET_ON - TEXTURE2D(_VertOffsetTex); - SAMPLER(sampler_VertOffsetTex); - #endif - - #if FADE_ON - TEXTURE2D(_FadeTex); - SAMPLER(sampler_FadeTex); - #if FADEBURN_ON - TEXTURE2D(_FadeBurnTex); - SAMPLER(sampler_FadeBurnTex); - #endif - #endif - - #if SHAPE1MASK_ON - TEXTURE2D(_Shape1MaskTex); - SAMPLER(sampler_Shape1MaskTex); - #endif - - #if TRAILWIDTH_ON - TEXTURE2D(_TrailWidthGradient); - SAMPLER(sampler_TrailWidthGradient); - #endif - - #if NORMALMAP_ON - TEXTURE2D(_NormalMap); - SAMPLER(sampler_NormalMap); - #endif - - half4 SampleTextureWithScroll(in Texture2D _tex, in SamplerState _sampler, in float2 uv, in half scrollXSpeed, in half scrollYSpeed, in float time) - { - half2 _uv = uv; - _uv.x += (time * scrollXSpeed) % 1; - _uv.y += (time * scrollYSpeed) % 1; - return SAMPLE_TEXTURE2D(_tex, _sampler, _uv); - } - - half EaseOutQuint(half x) - { - return 1 - pow(1 - x, 5); - } - - half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax) - { - return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); - } - - float2 RotateUvs(float2 uv, half rotation, half4 scaleAndTranslate) - { - half2 center = half2(0.5 * scaleAndTranslate.x + scaleAndTranslate.z, 0.5 * scaleAndTranslate.y + scaleAndTranslate.w); - half cosAngle = cos(rotation); - half sinAngle = sin(rotation); - uv -= center; - uv = mul(half2x2(cosAngle, -sinAngle, sinAngle, cosAngle), uv); - uv += center; - return uv; - } - - half4 GetDebugColor(float4 resColor, half4 shape1, half4 shape2, half4 shape3) - { - half4 res = resColor; - - //MAKE SURE THE FOLLOWING CODE BLOCK IS UNCOMMENTED------------------------------------------- - #if SHAPEDEBUG_ON - if(_DebugShape < 1.5) return shape1; - #if SHAPE2_ON - else if (_DebugShape < 2.5) return shape2; - #endif - #if SHAPE3_ON - else return shape3; - #endif - #endif - - return res; - } - - void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) - { - //uvDistTex --> extraV2F0 - //uvSh1DistTex --> extraV2F1 - //uvSh2DistTex --> extraV2F2 - //uvSh3DistTex --> extraV2F3 - - #if VERTOFFSET_ON - #if TIMEISCUSTOM_ON - const half time = v.texcoord0.z + globalCustomTime.y; - #else - const half time = v.texcoord0.z + _Time.y; - #endif - half4 offsetUv = half4(TRANSFORM_TEX(v.texcoord0.xy, _VertOffsetTex), 0, 0); - offsetUv.x += (time * _VertOffsetTexXSpeed) % 1; - offsetUv.y += (time * _VertOffsetTexYSpeed) % 1; - v.vertex.xyz += v.normal * _VertOffsetAmount * pow(SAMPLE_TEXTURE2D_LOD(_VertOffsetTex, sampler_VertOffsetTex, offsetUv, 0).r, _VertOffsetPower); - #endif - - #if DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F0.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); - #endif - - #if SHAPE1DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F1.xy = TRANSFORM_TEX(v.texcoord0.xy, _ShapeDistortTex); - #endif - - #if SHAPE2_ON - #if SHAPE2DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F2.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape2DistortTex);; - #endif - #endif - - #if SHAPE3_ON - #if SHAPE3DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F3.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape3DistortTex); - #endif - #endif - } - - void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) - { - //i.uvSeed -> d.texcoord0.xy - - float seed = d.texcoord0.z + _TimingSeed; - #if TIMEISCUSTOM_ON - const float4 shaderTime = globalCustomTime; - #else - const float4 shaderTime = _Time; - #endif - float time = shaderTime.y + seed; - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half2 originalUvs = d.texcoord0.xy; - #endif - - #if PIXELATE_ON - half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; - half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); - d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; - #endif - - #if NORMALMAP_ON - half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); - half3 normalTS = UnpackNormal(normalSample); - normalTS.xy *= _NormalStrength; - o.Normal = normalTS; - #endif - - #if TWISTUV_ON - half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); - _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; - half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; - half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; - half s = sin(theta); - half c = cos(theta); - half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); - tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); - tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); - d.texcoord0.xy = tempUv; - #endif - - #if DOODLE_ON - half2 uvCopy = d.texcoord0.xy; - _HandDrawnSpeed = (floor((shaderTime.x + seed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; - uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); - uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); - d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); - #endif - - #if SHAKEUV_ON - half xShake = sin((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvX; - half yShake = cos((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvY; - d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); - #endif - - #if WAVEUV_ON - half2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; - #if ATLAS_ON - uvWave = half2(_WaveX, _WaveY) - uvRect; - #endif - uvWave.x *= _ScreenParams.x / _ScreenParams.y; - half angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((time * _WaveSpeed) % 360.0); - d.texcoord0.xy = d.texcoord0.xy + normalize(uvWave) * sin(angWave) * (_WaveStrength / 1000.0); - #endif - - #if ROUNDWAVEUV_ON - half xWave = ((0.5 * _MainTex_ST.x) - d.texcoord0.x); - half yWave = ((0.5 * _MainTex_ST.y) - d.texcoord0.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); - half ripple = -sqrt(xWave*xWave + yWave* yWave); - d.texcoord0.xy += (sin((ripple + time * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; - #endif - - #if POLARUV_ON - half2 prePolarUvs = d.texcoord0.xy; - d.texcoord0.xy = d.texcoord0.xy - half2(0.5, 0.5); - d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (1.0 * 6.28318530718), length(d.texcoord0.xy) * 2.0); - d.texcoord0.xy *= _MainTex_ST.xy; - #endif - - #if DISTORT_ON - #if POLARUVDISTORT_ON - half2 distortUvs = TRANSFORM_TEX(d.texcoord0.xy, _DistortTex); - #else - half2 distortUvs = d.extraV2F0.xy; - #endif - distortUvs.x += ((shaderTime.x + seed) * _DistortTexXSpeed) % 1; - distortUvs.y += ((shaderTime.x + seed) * _DistortTexYSpeed) % 1; - #if ATLAS_ON - d.extraV2F0.xy = half2((d.extraV2F0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.extraV2F0.y - _MinYUV) / (_MaxYUV - _MinYUV)); - #endif - half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, distortUvs).r - 0.5) * 0.2 * _DistortAmount; - d.texcoord0.x += distortAmnt; - d.texcoord0.y += distortAmnt; - #endif - - #if TEXTURESCROLL_ON - d.texcoord0.x += (time * _TextureScrollXSpeed) % 1; - d.texcoord0.y += (time * _TextureScrollYSpeed) % 1; - #endif - - #if TRAILWIDTH_ON - half width = pow(SAMPLE_TEXTURE2D(_TrailWidthGradient, sampler_TrailWidthGradient, d.texcoord0).r, _TrailWidthPower); - d.texcoord0.y = (d.texcoord0.y * 2 - 1) / width * 0.5 + 0.5; - clip(d.texcoord0.y); - clip(1 - d.texcoord0.y); - #endif - - float2 shape1Uv = d.texcoord0.xy; - #if SHAPE2_ON - float2 shape2Uv = shape1Uv; - #endif - #if SHAPE3_ON - float2 shape3Uv = shape1Uv; - #endif - - #if CAMDISTFADE_ON || SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half camDistance = distance(d.worldSpacePosition, _WorldSpaceCameraPos); - #endif - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half2 uvOffsetPostFx = d.texcoord0.xy - originalUvs; - d.texcoord0.xy = d.screenPos.xy / d.screenPos.w; - d.texcoord0.x = d.texcoord0.x * (_ScreenParams.x / _ScreenParams.y); - d.texcoord0.x -= 0.5; - d.texcoord0.xy -= uvOffsetPostFx; - originalUvs += uvOffsetPostFx; - half distanceZoom = camDistance * 0.1; - half2 scaleWithDistUvs = d.texcoord0.xy * distanceZoom + ((-distanceZoom * 0.5) + 0.5); - #if SHAPE1SCREENUV_ON - shape1Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvShDistScale); - #else - shape1Uv = originalUvs; - #endif - #if SHAPE2SCREENUV_ON && SHAPE2_ON - shape2Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh2DistScale); - #else - #if SHAPE2_ON - shape2Uv = originalUvs; - #endif - #endif - #if SHAPE3SCREENUV_ON && SHAPE3_ON - shape3Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh3DistScale); - #else - #if SHAPE3_ON - shape3Uv = originalUvs; - #endif - #endif - #endif - - shape1Uv = TRANSFORM_TEX(shape1Uv, _MainTex); - #if OFFSETSTREAM_ON - shape1Uv.x += i.offsetCustomData.x * _OffsetSh1; - shape1Uv.y += i.offsetCustomData.y * _OffsetSh1; - #endif - #if SHAPETEXOFFSET_ON - shape1Uv += seed * _RandomSh1Mult; - #endif - - #if SHAPE1DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh1DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _ShapeDistortTex); - #else - half2 sh1DistortUvs = d.extraV2F1.xy; - #endif - - sh1DistortUvs.x += ((time + seed) * _ShapeDistortXSpeed) % 1; - sh1DistortUvs.y += ((time + seed) * _ShapeDistortYSpeed) % 1; - half distortAmount = (SAMPLE_TEXTURE2D(_ShapeDistortTex, sampler_ShapeDistortTex, sh1DistortUvs).r - 0.5) * 0.2 * _ShapeDistortAmount; - shape1Uv.x += distortAmount; - shape1Uv.y += distortAmount; - #endif - #if SHAPE1ROTATE_ON - shape1Uv = RotateUvs(shape1Uv, _ShapeRotationOffset + ((_ShapeRotationSpeed * time) % 6.28318530718), _MainTex_ST); - #endif - - half4 shape1 = SampleTextureWithScroll(_MainTex, sampler_MainTex, shape1Uv, _ShapeXSpeed, _ShapeYSpeed, time); - #if SHAPE1SHAPECOLOR_ON - shape1.a = shape1.r; - shape1.rgb = _ShapeColor.rgb; - #else - shape1 *= _ShapeColor; - #endif - #if SHAPE1CONTRAST_ON - #if SHAPE1SHAPECOLOR_ON - shape1.a = saturate((shape1.a - 0.5) * _ShapeContrast + 0.5 + _ShapeBrightness); - #else - shape1.rgb = max(0, (shape1.rgb - half3(0.5, 0.5, 0.5)) * _ShapeContrast + half3(0.5, 0.5, 0.5) + _ShapeBrightness); - #endif - #endif - - half4 shape2 = 1.0; - #if SHAPE2_ON - shape2Uv = TRANSFORM_TEX(shape2Uv, _Shape2Tex); - #if OFFSETSTREAM_ON - shape2Uv.x += i.offsetCustomData.x * _OffsetSh2; - shape2Uv.y += i.offsetCustomData.y * _OffsetSh2; - #endif - #if SHAPETEXOFFSET_ON - shape2Uv += seed * _RandomSh2Mult; - #endif - #if SHAPE2DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh2DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape2DistortTex); - #else - half2 sh2DistortUvs = d.extraV2F2.xy; - #endif - sh2DistortUvs.x += ((time + seed) * _Shape2DistortXSpeed) % 1; - sh2DistortUvs.y += ((time + seed) * _Shape2DistortYSpeed) % 1; - half distortAmnt2 = (SAMPLE_TEXTURE2D(_Shape2DistortTex, sampler_Shape2DistortTex, sh2DistortUvs).r - 0.5) * 0.2 * _Shape2DistortAmount; - shape2Uv.x += distortAmnt2; - shape2Uv.y += distortAmnt2; - #endif - #if SHAPE2ROTATE_ON - shape2Uv = RotateUvs(shape2Uv, _Shape2RotationOffset + ((_Shape2RotationSpeed * time) % 6.28318530718), _Shape2Tex_ST); - #endif - - shape2 = SampleTextureWithScroll(_Shape2Tex, sampler_Shape2Tex, shape2Uv, _Shape2XSpeed, _Shape2YSpeed, time); - #if SHAPE2SHAPECOLOR_ON - shape2.a = shape2.r; - shape2.rgb = _Shape2Color.rgb; - #else - shape2 *= _Shape2Color; - #endif - #if SHAPE2CONTRAST_ON - #if SHAPE2SHAPECOLOR_ON - shape2.a = max(0, (shape2.a - 0.5) * _Shape2Contrast + 0.5 + _Shape2Brightness); - #else - shape2.rgb = max(0, (shape2.rgb - half3(0.5, 0.5, 0.5)) * _Shape2Contrast + half3(0.5, 0.5, 0.5) + _Shape2Brightness); - #endif - #endif - #endif - - half4 shape3 = 1.0; - #if SHAPE3_ON - shape3Uv = TRANSFORM_TEX(shape3Uv, _Shape3Tex); - - #if OFFSETSTREAM_ON - shape3Uv.x += i.offsetCustomData.x * _OffsetSh3; - shape3Uv.y += i.offsetCustomData.y * _OffsetSh3; - #endif - #if SHAPETEXOFFSET_ON - shape3Uv += seed * _RandomSh3Mult; - #endif - #if SHAPE3DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh3DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape3DistortTex); - #else - half2 sh3DistortUvs = d.extraV2F3.xy; - #endif - sh3DistortUvs.x += ((time + seed) * _Shape3DistortXSpeed) % 1; - sh3DistortUvs.y += ((time + seed) * _Shape3DistortYSpeed) % 1; - half distortAmnt3 = (SAMPLE_TEXTURE2D(_Shape3DistortTex, sampler_Shape3DistortTex, sh3DistortUvs).r - 0.5) * 0.3 * _Shape3DistortAmount; - shape3Uv.x += distortAmnt3; - shape3Uv.y += distortAmnt3; - #endif - #if SHAPE3ROTATE_ON - shape3Uv = RotateUvs(shape3Uv, _Shape3RotationOffset + ((_Shape3RotationSpeed * time) % 6.28318530718), _Shape3Tex_ST); - #endif - shape3 = SampleTextureWithScroll(_Shape3Tex, sampler_Shape3Tex, shape3Uv, _Shape3XSpeed, _Shape3YSpeed, time); - #if SHAPE3SHAPECOLOR_ON - shape3.a = shape3.r; - shape3.rgb = _Shape3Color.rgb; - #else - shape3 *= _Shape3Color; - #endif - #if SHAPE3CONTRAST_ON - #if SHAPE3SHAPECOLOR_ON - shape3.a = max(0, (shape3.a - 0.5) * _Shape3Contrast + 0.5 + _Shape3Brightness); - #else - shape3.rgb = max(0, (shape3.rgb - half3(0.5, 0.5, 0.5)) * _Shape3Contrast + half3(0.5, 0.5, 0.5) + _Shape3Brightness); - #endif - #endif - #endif - - half4 col = shape1; - //Mix all shapes pre: change weights if custom vertex effect active - #if SHAPEWEIGHTS_ON - half shapeWeightOffset; - #if SHAPE2_ON - shapeWeightOffset = i.offsetCustomData.z * _Sh1BlendOffset; - _ShapeColorWeight = max(0, _ShapeColorWeight + shapeWeightOffset); - _ShapeAlphaWeight = max(0, _ShapeAlphaWeight + shapeWeightOffset); - shapeWeightOffset = i.offsetCustomData.z * _Sh2BlendOffset; - _Shape2ColorWeight = max(0, _Shape2ColorWeight + shapeWeightOffset); - _Shape2AlphaWeight = max(0, _Shape2AlphaWeight + shapeWeightOffset); - #endif - #if SHAPE3_ON - shapeWeightOffset = i.offsetCustomData.z * _Sh3BlendOffset; - _Shape3ColorWeight = max(0, _Shape3ColorWeight + shapeWeightOffset); - _Shape3AlphaWeight = max(0, _Shape3AlphaWeight + shapeWeightOffset); - #endif - #endif - - //Mix all shapes - #if SHAPE2_ON - #if !SPLITRGBA_ON - _ShapeAlphaWeight = _ShapeColorWeight; - _Shape2AlphaWeight = _Shape2ColorWeight; - #endif - #if SHAPE3_ON //Shape3 On - #if !SPLITRGBA_ON - _Shape3AlphaWeight = _Shape3ColorWeight; - #endif - #if SHAPEADD_ON - col.rgb = ((shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight)) + (shape3.rgb * _Shape3ColorWeight); - col.a = saturate(max(shape3.a * _Shape3AlphaWeight, max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight))); - #else - col.rgb = ((shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight)) * (shape3.rgb * _Shape3ColorWeight); - col.a = saturate(((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)) * (shape3.a * _Shape3AlphaWeight)); - #endif - #else //Shape3 Off - #if SHAPEADD_ON - col.rgb = (shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight); - col.a = saturate(max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight)); - #else - col.rgb = (shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight); - col.a = saturate((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)); - #endif - #endif - #endif - - #if SHAPE1MASK_ON - col = lerp(col, shape1, pow(SAMPLE_TEXTURE2D(_Shape1MaskTex, sampler_Shape1MaskTex, TRANSFORM_TEX(i.uvSeed.xy, _Shape1MaskTex)).r, _Shape1MaskPow)); - #endif - - #if PREMULTIPLYCOLOR_ON - half luminance = 0; - luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; - luminance *= col.a; - col.a = min(luminance, col.a); - #endif - - col.rgb *= _Color.rgb * d.vertexColor.rgb; - #if PREMULTIPLYALPHA_ON - col.rgb *= col.a; - #endif - - #if !PREMULTIPLYCOLOR_ON && (COLORRAMP_ON || ALPHAFADE_ON || COLORGRADING_ON || FADE_ON || (ADDITIVECONFIG_ON && (GLOW_ON || DEPTHGLOW_ON))) - half luminance = 0; - luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; - luminance *= col.a; - #endif - - #if (FADE_ON || ALPHAFADE_ON) && ALPHAFADEINPUTSTREAM_ON - col.a *= d.vertexColor.a; - d.vertexColor.a = d.texcoord0.w; - #endif - - #if FADE_ON - half preFadeAlpha = col.a; - _FadeAmount = saturate(_FadeAmount + (1 - d.vertexColor.a)); - _FadeTransition = max(0.01, _FadeTransition * EaseOutQuint(saturate(_FadeAmount))); - half2 fadeUv; - fadeUv = d.texcoord0.xy + seed; - fadeUv.x += (time * _FadeScrollXSpeed) % 1; - fadeUv.y += (time * _FadeScrollYSpeed) % 1; - half2 tiledUvFade1 = TRANSFORM_TEX(fadeUv, _FadeTex); - #if ADDITIVECONFIG_ON && !PREMULTIPLYCOLOR_ON - preFadeAlpha *= luminance; - #endif - _FadeAmount = saturate(pow(_FadeAmount, _FadePower)); - #if FADEBURN_ON - half2 tiledUvFade2 = TRANSFORM_TEX(fadeUv, _FadeBurnTex); - half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; - half fadeNaturalEdge = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - col.a *= fadeNaturalEdge; - half fadeBurn = saturate(smoothstep(0.0 , _FadeTransition + _FadeBurnWidth, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - fadeBurn = fadeNaturalEdge - fadeBurn; - _FadeBurnColor.rgb *= _FadeBurnGlow; - col.rgb += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2).rgb * _FadeBurnColor.rgb * preFadeAlpha; - #else - half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; - float fade = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - col.a *= fade; - #endif - #if ALPHAFADETRANSPARENCYTOO_ON - col.a *= 1 - _FadeAmount; - #endif - #endif - - #if ALPHAFADE_ON - half alphaFadeLuminance; - _AlphaFadeAmount = saturate(_AlphaFadeAmount + (1 - d.vertexColor.a)); - _AlphaFadeAmount = saturate(pow(_AlphaFadeAmount, _AlphaFadePow)); - _AlphaFadeSmooth = max(0.01, _AlphaFadeSmooth * EaseOutQuint(saturate(_AlphaFadeAmount))); - #if ALPHAFADEUSESHAPE1_ON - alphaFadeLuminance = shape1.r; - #else - alphaFadeLuminance = luminance; - #endif - alphaFadeLuminance = saturate(alphaFadeLuminance - 0.001); - #if ALPHAFADEUSEREDCHANNEL_ON - col.a *= col.r; - #endif - col.a = saturate(col.a); - float alphaFade = saturate(smoothstep(0.0 , _AlphaFadeSmooth, RemapFloat(1.0 - _AlphaFadeAmount, 0.0, 1.0, -1.0, 1.0) + alphaFadeLuminance)); - col.a *= alphaFade; - #if ALPHAFADETRANSPARENCYTOO_ON - col.a *= 1 - _AlphaFadeAmount; - #endif - #endif - - #if BACKFACETINT_ON - col.rgb = lerp(col.rgb * _BackFaceTint, col.rgb * _FrontFaceTint, step(0, dot(d.worldSpaceNormal, d.worldSpaceViewDir))); - #endif - - //#if LIGHTANDSHADOW_ON - //half NdL = saturate(dot(d.worldSpaceNormal, -_All1VfxLightDir)); - //col.rgb += _LightColor * _LightAmount * NdL; - //NdL = max(_ShadowAmount, NdL); - //NdL = smoothstep(_ShadowStepMin, _ShadowStepMax, NdL); - //col.rgb *= NdL; - //#endif - - #if COLORGRADING_ON - col.rgb *= lerp(lerp(_ColorGradingDark, _ColorGradingMiddle, luminance/_ColorGradingMidPoint), - lerp(_ColorGradingMiddle, _ColorGradingLight, (luminance - _ColorGradingMidPoint)/(1.0 - _ColorGradingMidPoint)), step(_ColorGradingMidPoint, luminance)); - #endif - - #if COLORRAMP_ON - half colorRampLuminance = saturate(luminance + _ColorRampLuminosity); - #if COLORRAMPGRAD_ON - half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(colorRampLuminance, 0)); - #else - half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(colorRampLuminance, 0)); - #endif - col.rgb = lerp(col.rgb, colorRampRes.rgb, _ColorRampBlend); - col.a = lerp(col.a, saturate(col.a * colorRampRes.a), _ColorRampBlend); - #endif - - #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON - col.rgb = floor(col.rgb / (1.0 / _PosterizeNumColors)) * (1.0 / _PosterizeNumColors); - #endif - - #if DEPTHGLOW_ON - half sceneDepthDiff = GetLinearEyeDepth(d.screenUV) - d.screenPos.w; - #endif - - #if RIM_ON - half NdV = 1 - abs(dot(d.worldSpaceNormal, d.worldSpaceViewDir)); - half rimFactor = saturate(_RimBias + _RimScale * pow(NdV, _RimPower)); - half4 rimCol = _RimColor * rimFactor; - rimCol.rgb *= _RimIntensity; - col.rgb = lerp(col.rgb * (rimCol.rgb + half3(1,1,1)), col.rgb + rimCol.rgb, _RimAddAmount); - col.a = saturate(col.a * (1 - rimFactor * _RimErodesAlpha)); - #endif - - #if DEPTHGLOW_ON - half depthGlowMask = saturate(_DepthGlowDist * pow((1 - sceneDepthDiff), _DepthGlowPow)); - col.rgb = lerp(col.rgb, _DepthGlowGlobal * col.rgb, depthGlowMask); - half depthGlowMult = 1; - #if ADDITIVECONFIG_ON - depthGlowMult = luminance; - #endif - col.rgb += _DepthGlowColor.rgb * _DepthGlow * depthGlowMask * col.a * depthGlowMult; - #endif - - #if GLOW_ON - half glowMask = 1; - #if GLOWTEX_ON - glowMask = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, TRANSFORM_TEX(d.texcoord0.xy, _GlowTex)); - #endif - col.rgb *= _GlowGlobal * glowMask; - half glowMult = 1; - #if ADDITIVECONFIG_ON - glowMult = luminance; - #endif - - col.rgb += _GlowColor.rgb * _Glow * glowMask * col.a * glowMult; - #endif - - #if HSV_ON - half3 resultHsv = half3(col.rgb); - half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); - half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); - resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x - + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y - + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; - resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x - + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y - + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; - resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x - + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y - + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; - col.rgb = resultHsv; - #endif - - #if CAMDISTFADE_ON - col.a *= 1 - saturate(smoothstep(_CamDistFadeStepMin, _CamDistFadeStepMax, camDistance)); - col.a *= smoothstep(0.0, _CamDistProximityFade, camDistance); - #endif - - #if MASK_ON - half2 maskUv = d.texcoord0.xy; - #if POLARUV_ON - maskUv = prePolarUvs; - #endif - half4 maskSample = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, TRANSFORM_TEX(maskUv, _MaskTex)); - half mask = pow(min(maskSample.r, maskSample.a), _MaskPow); - col.a *= mask; - #endif - - #if ALPHASMOOTHSTEP_ON - col.a = smoothstep(_AlphaStepMin, _AlphaStepMax, col.a); - #endif - - half4 debugColor = col; - #if SHAPEDEBUG_ON - debugColor = GetDebugColor(col, shape1, shape2, shape3); - #endif - - clip(debugColor.a - _AlphaCutoffValue - 0.01); - - //#if FOG_ON - //UNITY_APPLY_FOG(i.fogCoord, col); - //#endif - - //Don't use a starting i.color.a lower than 1 unless using vertex stream dissolve when using a FADE effect - #if !FADE_ON && !ALPHAFADE_ON - col.a *= _Alpha * d.vertexColor.a; - #endif - #if FADE_ON || ALPHAFADE_ON - col.a *= _Alpha; - #endif - #if ADDITIVECONFIG_ON - col.rgb *= col.a; - #endif - - - #if SHAPEDEBUG_ON - o.Albedo = debugColor.rgb; - o.Alpha = debugColor.a; - #else - o.Albedo = col.rgb; - o.Alpha = col.a; - #endif - } - - - - - - void ChainSurfaceFunction(inout Surface l, inout ShaderData d) - { - Ext_SurfaceFunction0(l, d); - // Ext_SurfaceFunction1(l, d); - // Ext_SurfaceFunction2(l, d); - // Ext_SurfaceFunction3(l, d); - // Ext_SurfaceFunction4(l, d); - // Ext_SurfaceFunction5(l, d); - // Ext_SurfaceFunction6(l, d); - // Ext_SurfaceFunction7(l, d); - // Ext_SurfaceFunction8(l, d); - // Ext_SurfaceFunction9(l, d); - // Ext_SurfaceFunction10(l, d); - // Ext_SurfaceFunction11(l, d); - // Ext_SurfaceFunction12(l, d); - // Ext_SurfaceFunction13(l, d); - // Ext_SurfaceFunction14(l, d); - // Ext_SurfaceFunction15(l, d); - // Ext_SurfaceFunction16(l, d); - // Ext_SurfaceFunction17(l, d); - // Ext_SurfaceFunction18(l, d); - // Ext_SurfaceFunction19(l, d); - // Ext_SurfaceFunction20(l, d); - // Ext_SurfaceFunction21(l, d); - // Ext_SurfaceFunction22(l, d); - // Ext_SurfaceFunction23(l, d); - // Ext_SurfaceFunction24(l, d); - // Ext_SurfaceFunction25(l, d); - // Ext_SurfaceFunction26(l, d); - // Ext_SurfaceFunction27(l, d); - // Ext_SurfaceFunction28(l, d); - // Ext_SurfaceFunction29(l, d); - } - -#if !_DECALSHADER - - void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) - { - ExtraV2F d; - - ZERO_INITIALIZE(ExtraV2F, d); - ZERO_INITIALIZE(Blackboard, d.blackboard); - // due to motion vectors in HDRP, we need to use the last - // time in certain spots. So if you are going to use _Time to adjust vertices, - // you need to use this time or motion vectors will break. - d.time = time; - - Ext_ModifyVertex0(v, d); - // Ext_ModifyVertex1(v, d); - // Ext_ModifyVertex2(v, d); - // Ext_ModifyVertex3(v, d); - // Ext_ModifyVertex4(v, d); - // Ext_ModifyVertex5(v, d); - // Ext_ModifyVertex6(v, d); - // Ext_ModifyVertex7(v, d); - // Ext_ModifyVertex8(v, d); - // Ext_ModifyVertex9(v, d); - // Ext_ModifyVertex10(v, d); - // Ext_ModifyVertex11(v, d); - // Ext_ModifyVertex12(v, d); - // Ext_ModifyVertex13(v, d); - // Ext_ModifyVertex14(v, d); - // Ext_ModifyVertex15(v, d); - // Ext_ModifyVertex16(v, d); - // Ext_ModifyVertex17(v, d); - // Ext_ModifyVertex18(v, d); - // Ext_ModifyVertex19(v, d); - // Ext_ModifyVertex20(v, d); - // Ext_ModifyVertex21(v, d); - // Ext_ModifyVertex22(v, d); - // Ext_ModifyVertex23(v, d); - // Ext_ModifyVertex24(v, d); - // Ext_ModifyVertex25(v, d); - // Ext_ModifyVertex26(v, d); - // Ext_ModifyVertex27(v, d); - // Ext_ModifyVertex28(v, d); - // Ext_ModifyVertex29(v, d); - - - // #if %EXTRAV2F0REQUIREKEY% - v2p.extraV2F0 = d.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - v2p.extraV2F1 = d.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - v2p.extraV2F2 = d.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - v2p.extraV2F3 = d.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // v2p.extraV2F4 = d.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // v2p.extraV2F5 = d.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // v2p.extraV2F6 = d.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // v2p.extraV2F7 = d.extraV2F7; - // #endif - } - - void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) - { - ExtraV2F d; - ZERO_INITIALIZE(ExtraV2F, d); - ZERO_INITIALIZE(Blackboard, d.blackboard); - - // #if %EXTRAV2F0REQUIREKEY% - d.extraV2F0 = v2p.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - d.extraV2F1 = v2p.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - d.extraV2F2 = v2p.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - d.extraV2F3 = v2p.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // d.extraV2F4 = v2p.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // d.extraV2F5 = v2p.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // d.extraV2F6 = v2p.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // d.extraV2F7 = v2p.extraV2F7; - // #endif - - - // Ext_ModifyTessellatedVertex0(v, d); - // Ext_ModifyTessellatedVertex1(v, d); - // Ext_ModifyTessellatedVertex2(v, d); - // Ext_ModifyTessellatedVertex3(v, d); - // Ext_ModifyTessellatedVertex4(v, d); - // Ext_ModifyTessellatedVertex5(v, d); - // Ext_ModifyTessellatedVertex6(v, d); - // Ext_ModifyTessellatedVertex7(v, d); - // Ext_ModifyTessellatedVertex8(v, d); - // Ext_ModifyTessellatedVertex9(v, d); - // Ext_ModifyTessellatedVertex10(v, d); - // Ext_ModifyTessellatedVertex11(v, d); - // Ext_ModifyTessellatedVertex12(v, d); - // Ext_ModifyTessellatedVertex13(v, d); - // Ext_ModifyTessellatedVertex14(v, d); - // Ext_ModifyTessellatedVertex15(v, d); - // Ext_ModifyTessellatedVertex16(v, d); - // Ext_ModifyTessellatedVertex17(v, d); - // Ext_ModifyTessellatedVertex18(v, d); - // Ext_ModifyTessellatedVertex19(v, d); - // Ext_ModifyTessellatedVertex20(v, d); - // Ext_ModifyTessellatedVertex21(v, d); - // Ext_ModifyTessellatedVertex22(v, d); - // Ext_ModifyTessellatedVertex23(v, d); - // Ext_ModifyTessellatedVertex24(v, d); - // Ext_ModifyTessellatedVertex25(v, d); - // Ext_ModifyTessellatedVertex26(v, d); - // Ext_ModifyTessellatedVertex27(v, d); - // Ext_ModifyTessellatedVertex28(v, d); - // Ext_ModifyTessellatedVertex29(v, d); - - // #if %EXTRAV2F0REQUIREKEY% - v2p.extraV2F0 = d.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - v2p.extraV2F1 = d.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - v2p.extraV2F2 = d.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - v2p.extraV2F3 = d.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // v2p.extraV2F4 = d.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // v2p.extraV2F5 = d.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // v2p.extraV2F6 = d.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // v2p.extraV2F7 = d.extraV2F7; - // #endif - } - - void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) - { - // Ext_FinalColorForward0(l, d, color); - // Ext_FinalColorForward1(l, d, color); - // Ext_FinalColorForward2(l, d, color); - // Ext_FinalColorForward3(l, d, color); - // Ext_FinalColorForward4(l, d, color); - // Ext_FinalColorForward5(l, d, color); - // Ext_FinalColorForward6(l, d, color); - // Ext_FinalColorForward7(l, d, color); - // Ext_FinalColorForward8(l, d, color); - // Ext_FinalColorForward9(l, d, color); - // Ext_FinalColorForward10(l, d, color); - // Ext_FinalColorForward11(l, d, color); - // Ext_FinalColorForward12(l, d, color); - // Ext_FinalColorForward13(l, d, color); - // Ext_FinalColorForward14(l, d, color); - // Ext_FinalColorForward15(l, d, color); - // Ext_FinalColorForward16(l, d, color); - // Ext_FinalColorForward17(l, d, color); - // Ext_FinalColorForward18(l, d, color); - // Ext_FinalColorForward19(l, d, color); - // Ext_FinalColorForward20(l, d, color); - // Ext_FinalColorForward21(l, d, color); - // Ext_FinalColorForward22(l, d, color); - // Ext_FinalColorForward23(l, d, color); - // Ext_FinalColorForward24(l, d, color); - // Ext_FinalColorForward25(l, d, color); - // Ext_FinalColorForward26(l, d, color); - // Ext_FinalColorForward27(l, d, color); - // Ext_FinalColorForward28(l, d, color); - // Ext_FinalColorForward29(l, d, color); - } - - void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) - { - // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - } -#endif - - - - - -#if _DECALSHADER - - ShaderData CreateShaderData(SurfaceDescriptionInputs IN) - { - ShaderData d = (ShaderData)0; - d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); - d.worldSpaceNormal = IN.WorldSpaceNormal; - d.worldSpaceTangent = IN.WorldSpaceTangent; - - d.worldSpacePosition = IN.WorldSpacePosition; - d.texcoord0 = IN.uv0.xyxy; - d.screenPos = IN.ScreenPosition; - - d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); - - d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); - - // these rarely get used, so we back transform them. Usually will be stripped. - #if _HDRP - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; - #else - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; - #endif - // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); - // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); - - // #if %SCREENPOSREQUIREKEY% - d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); - // #endif - - return d; - } -#else - - ShaderData CreateShaderData(VertexToPixel i - #if NEED_FACING - , bool facing - #endif - ) - { - ShaderData d = (ShaderData)0; - d.clipPos = i.pos; - d.worldSpacePosition = i.worldPos; - - d.worldSpaceNormal = normalize(i.worldNormal); - d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); - - d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; - float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; - - d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); - d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); - - d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); - d.texcoord0 = i.texcoord0; - // d.texcoord1 = i.texcoord1; - // d.texcoord2 = i.texcoord2; - - // #if %TEXCOORD3REQUIREKEY% - // d.texcoord3 = i.texcoord3; - // #endif - - // d.isFrontFace = facing; - // #if %VERTEXCOLORREQUIREKEY% - d.vertexColor = i.vertexColor; - // #endif - - // these rarely get used, so we back transform them. Usually will be stripped. - #if _HDRP - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; - #else - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; - #endif - // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); - // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); - - // #if %SCREENPOSREQUIREKEY% - d.screenPos = i.screenPos; - d.screenUV = (i.screenPos.xy / i.screenPos.w); - // #endif - - - // #if %EXTRAV2F0REQUIREKEY% - d.extraV2F0 = i.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - d.extraV2F1 = i.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - d.extraV2F2 = i.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - d.extraV2F3 = i.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // d.extraV2F4 = i.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // d.extraV2F5 = i.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // d.extraV2F6 = i.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // d.extraV2F7 = i.extraV2F7; - // #endif - - return d; - } - -#endif - - - // vertex shader - VertexToPixel Vert (VertexData v) - { - UNITY_SETUP_INSTANCE_ID(v); - VertexToPixel o; - UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); - UNITY_TRANSFER_INSTANCE_ID(v,o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - -#if !_TESSELLATION_ON - ChainModifyVertex(v, o, _Time); -#endif - - o.pos = UnityObjectToClipPos(v.vertex); - o.texcoord0 = v.texcoord0; - // o.texcoord1 = v.texcoord1; - // o.texcoord2 = v.texcoord2; - - // #if %TEXCOORD3REQUIREKEY% - // o.texcoord3 = v.texcoord3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - o.vertexColor = v.vertexColor; - // #endif - - // #if %SCREENPOSREQUIREKEY% - o.screenPos = ComputeScreenPos(o.pos); - // #endif - - o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; - o.worldNormal = UnityObjectToWorldNormal(v.normal); - o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); - - - float3 viewDirForLight = UnityWorldSpaceViewDir(o.worldPos); - #ifndef DIRLIGHTMAP_OFF - float3 worldBinormal = cross(o.worldNormal, o.worldTangent.xyz); - o.viewDir.x = dot(viewDirForLight, o.worldTangent.xyz); - o.viewDir.y = dot(viewDirForLight, worldBinormal); - o.viewDir.z = dot(viewDirForLight, o.worldNormal); - #endif - #ifdef DYNAMICLIGHTMAP_ON - o.lmap.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; - #else - o.lmap.zw = 0; - #endif - #ifdef LIGHTMAP_ON - o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; - #ifdef DIRLIGHTMAP_OFF - o.lmapFadePos.xyz = (mul(GetObjectToWorldMatrix(), v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; - o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); - #endif - #else - o.lmap.xy = 0; - #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL - o.sh = 0; - o.sh = ShadeSHPerVertex (o.worldNormal, o.sh); - #endif - #endif - - return o; - } - - - - #ifdef LIGHTMAP_ON - float4 unity_LightmapFade; - #endif - fixed4 unity_Ambient; - - - - // fragment shader - void Frag (VertexToPixel IN, - out half4 outGBuffer0 : SV_Target0, - out half4 outGBuffer1 : SV_Target1, - out half4 outGBuffer2 : SV_Target2, - out half4 outEmission : SV_Target3 - #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) - , out half4 outShadowMask : SV_Target4 - #endif - #ifdef _DEPTHOFFSET_ON - , out float outputDepth : SV_Depth - #endif - #if NEED_FACING - , bool facing : SV_IsFrontFace - #endif - ) - { - UNITY_SETUP_INSTANCE_ID(IN); - // prepare and unpack data - - #ifdef FOG_COMBINED_WITH_TSPACE - UNITY_EXTRACT_FOG_FROM_TSPACE(IN); - #elif defined (FOG_COMBINED_WITH_WORLD_POS) - UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); - #else - UNITY_EXTRACT_FOG(IN); - #endif - - ShaderData d = CreateShaderData(IN - #if NEED_FACING - , facing - #endif - ); - Surface l = (Surface)0; - - #ifdef _DEPTHOFFSET_ON - l.outputDepth = outputDepth; - #endif - - l.Albedo = half3(0.5, 0.5, 0.5); - l.Normal = float3(0,0,1); - l.Occlusion = 1; - l.Alpha = 1; - - ChainSurfaceFunction(l, d); - - #ifdef _DEPTHOFFSET_ON - outputDepth = l.outputDepth; - #endif - - - - - - #ifndef USING_DIRECTIONAL_LIGHT - fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); - #else - fixed3 lightDir = _WorldSpaceLightPos0.xyz; - #endif - float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); - - #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC - #ifdef UNITY_COMPILER_HLSL - SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; - #else - SurfaceOutputStandardSpecular o; - #endif - o.Specular = l.Specular; - o.Occlusion = l.Occlusion; - o.Smoothness = l.Smoothness; - #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT - #ifdef UNITY_COMPILER_HLSL - SurfaceOutput o = (SurfaceOutput)0; - #else - SurfaceOutput o; - #endif - - o.Specular = l.SpecularPower; - o.Gloss = l.Smoothness; - _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. - #else - #ifdef UNITY_COMPILER_HLSL - SurfaceOutputStandard o = (SurfaceOutputStandard)0; - #else - SurfaceOutputStandard o; - #endif - o.Smoothness = l.Smoothness; - o.Metallic = l.Metallic; - o.Occlusion = l.Occlusion; - #endif - - - - o.Albedo = l.Albedo; - o.Emission = l.Emission; - o.Alpha = l.Alpha; - - #if _WORLDSPACENORMAL - o.Normal = l.Normal; - #else - o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); - #endif - - - half atten = 1; - - // Setup lighting environment - UnityGI gi; - UNITY_INITIALIZE_OUTPUT(UnityGI, gi); - gi.indirect.diffuse = 0; - gi.indirect.specular = 0; - gi.light.color = 0; - gi.light.dir = half3(0,1,0); - // Call GI (lightmaps/SH/reflections) lighting function - UnityGIInput giInput; - UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput); - giInput.light = gi.light; - giInput.worldPos = d.worldSpacePosition; - giInput.worldViewDir = worldViewDir; - giInput.atten = atten; - #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) - giInput.lightmapUV = IN.lmap; - #else - giInput.lightmapUV = 0.0; - #endif - #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL - giInput.ambient = IN.sh; - #else - giInput.ambient.rgb = 0.0; - #endif - giInput.probeHDR[0] = unity_SpecCube0_HDR; - giInput.probeHDR[1] = unity_SpecCube1_HDR; - #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION) - giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending - #endif - #ifdef UNITY_SPECCUBE_BOX_PROJECTION - giInput.boxMax[0] = unity_SpecCube0_BoxMax; - giInput.probePosition[0] = unity_SpecCube0_ProbePosition; - giInput.boxMax[1] = unity_SpecCube1_BoxMax; - giInput.boxMin[1] = unity_SpecCube1_BoxMin; - giInput.probePosition[1] = unity_SpecCube1_ProbePosition; - #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif - - #if _BDRF3 || _SIMPLELIT + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + // o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif - LightingBlinnPhong_GI(o, giInput, gi); - #if defined(_OVERRIDE_BAKEDGI) - gi.indirect.diffuse = l.DiffuseGI; - gi.indirect.specular = l.SpecularGI; + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); #endif + #endif - outEmission = LightingBlinnPhong_Deferred(o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); - #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) - outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); #endif - #ifndef UNITY_HDR_ON - outEmission.rgb = exp2(-outEmission.rgb); + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); #endif - #elif _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC - LightingStandardSpecular_GI(o, giInput, gi); - #if defined(_OVERRIDE_BAKEDGI) - gi.indirect.diffuse = l.DiffuseGI; - gi.indirect.specular = l.SpecularGI; - #endif - // call lighting function to output g-buffer - outEmission = LightingStandardSpecular_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); - #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) - outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); - #endif - #ifndef UNITY_HDR_ON - outEmission.rgb = exp2(-outEmission.rgb); - #endif - #else - LightingStandard_GI(o, giInput, gi); - #if defined(_OVERRIDE_BAKEDGI) - gi.indirect.diffuse = l.DiffuseGI; - gi.indirect.specular = l.SpecularGI; - #endif - // call lighting function to output g-buffer - outEmission = LightingStandard_Deferred (o, worldViewDir, gi, outGBuffer0, outGBuffer1, outGBuffer2); - #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) - outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, d.worldSpacePosition); - #endif - #ifndef UNITY_HDR_ON - outEmission.rgb = exp2(-outEmission.rgb); - #endif - #endif + #endif - #if defined(_OVERRIDE_SHADOWMASK) && defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) - float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); - outShadowMask = mulColor; + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); #endif - - #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4) - ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); - #else - half4 outShadowMask = 0; - ChainFinalGBufferStandard(l, d, outGBuffer0, outGBuffer1, outGBuffer2, outEmission, outShadowMask); - #endif - + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; } + + +#if _UNLIT + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl" +#endif + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outColor : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif - ENDCG + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 1; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + + + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + inputData.shadowCoord = IN.shadowCoord; + #elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + +#if _BAKEDLIT + inputData.fogCoord = IN.fogFactorAndVertexLight.x; + inputData.vertexLighting = 0; +#else + inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; +#endif + + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #elif _BAKEDLIT + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + #if !_BAKEDLIT + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(_OVERRIDE_SHADOWMASK) + float4 mulColor = saturate(dot(l.ShadowMask, _MainLightOcclusionProbes)); //unity_OcclusionMaskSelector)); + inputData.shadowMask = mulColor; + #endif + #else + inputData.shadowMask = float4(1,1,1,1); + #endif + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #if _WORLDSPACENORMAL + float3 normalTS = WorldToTangentSpace(d, l.Normal); + #else + float3 normalTS = l.Normal; + #endif + + SurfaceData surface = (SurfaceData)0; + surface.albedo = l.Albedo; + surface.metallic = saturate(metallic); + surface.specular = specular; + surface.smoothness = saturate(l.Smoothness), + surface.occlusion = l.Occlusion, + surface.emission = l.Emission, + surface.alpha = saturate(l.Alpha); + surface.clearCoatMask = 0; + surface.clearCoatSmoothness = 1; + + #ifdef _CLEARCOAT + surface.clearCoatMask = saturate(l.CoatMask); + surface.clearCoatSmoothness = saturate(l.CoatSmoothness); + #endif + + #if !_UNLIT + half4 color = half4(l.Albedo, l.Alpha); + #ifdef _DBUFFER + #if _BAKEDLIT + half3 bakeColor = color.rgb; + float3 bakeNormal = inputData.normalWS.xyz; + ApplyDecalToBaseColorAndNormal(IN.pos, bakeColor, bakeNormal); + color.rgb = bakeColor; + inputData.normalWS.xyz = bakeNormal; + #else + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + #endif + #if _SIMPLELIT + color = UniversalFragmentBlinnPhong( + inputData, + surface); + #elif _BAKEDLIT + color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, normalTS); + #else + color = UniversalFragmentPBR(inputData, surface); + #endif + + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + + #else // unlit + #ifdef _DBUFFER + ApplyDecalToSurfaceData(IN.pos, surface, inputData); + #endif + half4 color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha); + #if !DISABLEFOG + color.rgb = MixFog(color.rgb, inputData.fogCoord); + #endif + #endif + ChainFinalColorForward(l, d, color); + + outColor = color; + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + } + + ENDHLSL } + Pass + { + Name "GBuffer" + Tags + { + "LightMode" = "UniversalGBuffer" + } + + Blend One Zero + ZTest LEqual + ZWrite On - // ---- forward rendering additive lights pass: - Pass - { - Name "FORWARD" - Tags { "LightMode" = "ForwardAdd" } - ZWrite Off Blend One One - - Tags + Tags { "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" } @@ -7056,36 +2725,46 @@ Lighting Off Lighting Off - CGPROGRAM + HLSLPROGRAM - #pragma vertex Vert + #pragma vertex Vert #pragma fragment Frag - // compile directives - #pragma target 3.0 - #pragma multi_compile_instancing - #pragma multi_compile_fog - #pragma skip_variants INSTANCING_ON - #pragma multi_compile_fwdadd_fullshadows - #include "HLSLSupport.cginc" - #define UNITY_INSTANCED_LOD_FADE - #define UNITY_INSTANCED_SH - #define UNITY_INSTANCED_LIGHTMAPSTS - #include "UnityShaderVariables.cginc" - #include "UnityShaderUtilities.cginc" + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + #pragma multi_compile_fog + #pragma instancing_options renderinglayer + + #pragma multi_compile _ LIGHTMAP_ON + #pragma multi_compile _ DYNAMICLIGHTMAP_ON + #pragma multi_compile _ DIRLIGHTMAP_COMBINED + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING + #pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION + #pragma multi_compile_fragment _ _SHADOWS_SOFT + #pragma multi_compile_fragment _ _SHADOWS_SOFT_LOW + #pragma multi_compile_fragment _ _SHADOWS_SOFT_MEDIUM + #pragma multi_compile_fragment _ _SHADOWS_SOFT_HIGH + #pragma multi_compile _ LIGHTMAP_SHADOW_MIXING + #pragma multi_compile _ SHADOWS_SHADOWMASK + #pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE + #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT + #pragma multi_compile_fragment _ _RENDER_PASS_ENABLED + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - #include "AutoLight.cginc" + #define _FOG_FRAGMENT 1 - + #define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + #define SHADERPASS SHADERPASS_GBUFFER + #define _PASSGBUFFER 1 - #define _PASSFORWARD 1 - #define _PASSFORWARDADD 1 - - + #pragma shader_feature_local TIMEISCUSTOM_ON #pragma shader_feature_local ADDITIVECONFIG_ON #pragma shader_feature_local PREMULTIPLYALPHA_ON @@ -7159,1263 +2838,158 @@ Lighting Off #pragma shader_feature NORMALMAP_ON - #define _STANDARD 1 -// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same -// texturing library they use. However, since they are not included in the standard pipeline by default, there is no -// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without -// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead -// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not -// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. + #define _URP 1 +#define REQUIRE_DEPTH_TEXTURE -#if defined(SHADER_API_GAMECORE) - - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r - #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_XBOXONE) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_PSSL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName - #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - - -#elif defined(SHADER_API_D3D11) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_METAL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_VULKAN) -// This file assume SHADER_API_VULKAN is defined - // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. - - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_SWITCH) - // This file assume SHADER_API_SWITCH is defined - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_GLCORE) - - // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 46) - #define OPENGL4_1_SM5 1 - #else - #define OPENGL4_1_SM5 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - - #if OPENGL4_1_SM5 - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #endif - - - #elif defined(SHADER_API_GLES3) - - // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 40) - #define GLES3_1_AEP 1 - #else - #define GLES3_1_AEP 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #if GLES3_1_AEP - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - #else - #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - #endif - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #if GLES3_1_AEP - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - #endif - - -#elif defined(SHADER_API_GLES) - - - #define uint int - - #define rcp(x) 1.0 / (x) - #define ddx_fine ddx - #define ddy_fine ddy - #define asfloat - #define asuint(x) asint(x) - #define f32tof16 - #define f16tof32 - - #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 - - // Texture abstraction - - #define TEXTURE2D(textureName) sampler2D textureName - #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray - #define TEXTURECUBE(textureName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray - #define TEXTURE3D(textureName) sampler3D textureName - - #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray - #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray - #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName - - #define TEXTURE2D_HALF(textureName) sampler2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray - #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray - #define TEXTURE3D_HALF(textureName) sampler3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - - #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - - #define SAMPLER(samplerName) - #define SAMPLER_CMP(samplerName) - - #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) - - #if (SHADER_TARGET >= 30) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) - #else - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) - #endif - - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) - - - // Not supported. Can't define as error because shader library is calling these functions. - #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) - - // Gather not supported. Fallback to regular texture sampling. - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - -#else -#error unsupported shader api -#endif - - - - -// default flow control attributes -#ifndef UNITY_BRANCH -# define UNITY_BRANCH -#endif -#ifndef UNITY_FLATTEN -# define UNITY_FLATTEN -#endif -#ifndef UNITY_UNROLL -# define UNITY_UNROLL -#endif -#ifndef UNITY_UNROLLX -# define UNITY_UNROLLX(_x) -#endif -#ifndef UNITY_LOOP -# define UNITY_LOOP -#endif - - - - - - // data across stages, stripped like the above. - struct VertexToPixel - { - UNITY_POSITION(pos); // must be named pos because Unity does stupid macro stuff - float3 worldPos : TEXCOORD0; - float3 worldNormal : TEXCOORD1; - float4 worldTangent : TEXCOORD2; - float4 texcoord0 : TEXCOORD3; - // float4 texcoord1 : TEXCOORD4; - // float4 texcoord2 : TEXCOORD5; - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD6; - // #endif - - // #if %SCREENPOSREQUIREKEY% - float4 screenPos : TEXCOORD7; - // #endif - - UNITY_LIGHTING_COORDS(8,9) - UNITY_FOG_COORDS(10) - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - // #if %EXTRAV2F0REQUIREKEY% - float4 extraV2F0 : TEXCOORD11; - // #endif + // Includes + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" - // #if %EXTRAV2F1REQUIREKEY% - float4 extraV2F1 : TEXCOORD12; - // #endif + - // #if %EXTRAV2F2REQUIREKEY% - float4 extraV2F2 : TEXCOORD13; - // #endif + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) - // #if %EXTRAV2F3REQUIREKEY% - float4 extraV2F3 : TEXCOORD14; - // #endif + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); - // #if %EXTRAV2F4REQUIREKEY% - // float4 extraV2F4 : TEXCOORD15; - // #endif + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) - // #if %EXTRAV2F5REQUIREKEY% - // float4 extraV2F5 : TEXCOORD16; - // #endif + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif - // #if %EXTRAV2F6REQUIREKEY% - // float4 extraV2F6 : TEXCOORD17; - // #endif + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D - // #if %EXTRAV2F7REQUIREKEY% - // float4 extraV2F7 : TEXCOORD18; - // #endif + - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + // float4 texcoord1 : TEXCOORD4; + // float4 texcoord2 : TEXCOORD5; - }; + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD6; + // #endif - + // #if %SCREENPOSREQUIREKEY% + float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + // data describing the user output of a pixel struct Surface @@ -8661,9 +3235,9 @@ Lighting Off #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) #endif - #undef UNITY_MATRIX_I_M + #undef GetWorldToObjectMatrix() - #define UNITY_MATRIX_I_M unity_WorldToObject + #define GetWorldToObjectMatrix() unity_WorldToObject #endif @@ -8709,7 +3283,7 @@ Lighting Off float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) { float eye = GetLinearEyeDepth(uv); - float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); float dt = dot(worldSpaceViewDir, camView); float3 div = worldSpaceViewDir/dt; @@ -8735,7 +3309,7 @@ Lighting Off { float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); float3 norms = DecodeViewNormalStereo(depthNorms); - norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; return norms; } #elif _HDRP && !_DECALSHADER @@ -8825,7 +3399,9 @@ Lighting Off - + CBUFFER_START(UnityPerMaterial) + + half4 _Color; half _Alpha; half _AlphaCutoffValue; @@ -9043,11 +3619,13 @@ Lighting Off - + CBUFFER_END - + - + + + TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex); @@ -10045,8 +4623,8 @@ Lighting Off } #endif - - + + #if _DECALSHADER @@ -10168,20 +4746,52 @@ Lighting Off #endif + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + // vertex shader VertexToPixel Vert (VertexData v) { + VertexToPixel o = (VertexToPixel)0; + UNITY_SETUP_INSTANCE_ID(v); - VertexToPixel o; - UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); - UNITY_TRANSFER_INSTANCE_ID(v,o); + UNITY_TRANSFER_INSTANCE_ID(v, o); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); -#if !_TESSELLATION_ON - ChainModifyVertex(v, o, _Time); -#endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif - o.pos = UnityObjectToClipPos(v.vertex); o.texcoord0 = v.texcoord0; // o.texcoord1 = v.texcoord1; // o.texcoord2 = v.texcoord2; @@ -10194,6626 +4804,11667 @@ Lighting Off o.vertexColor = v.vertexColor; // #endif - // #if %SCREENPOSREQUIREKEY% - o.screenPos = ComputeScreenPos(o.pos); + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + // o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl" + + // fragment shader + FragmentOutput Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if _USESPECULAR || _SIMPLELIT + float3 specular = l.Specular; + float metallic = 0; + #else + float3 specular = 0; + float metallic = l.Metallic; + #endif + + InputData inputData = (InputData)0; + + inputData.positionWS = IN.worldPos; + #if _WORLDSPACENORMAL + inputData.normalWS = l.Normal; + #else + inputData.normalWS = normalize(TangentToWorldSpace(d, l.Normal)); + #endif + + inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir); + + + #if defined(MAIN_LIGHT_CALCULATE_SHADOWS) + inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS); + #else + inputData.shadowCoord = float4(0, 0, 0, 0); + #endif + + //inputData.fogCoord = IN.fogFactorAndVertexLight.x; + InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x); + inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw; + + + #if defined(_OVERRIDE_BAKEDGI) + inputData.bakedGI = l.DiffuseGI; + l.Emission += l.SpecularGI; + #else + #if defined(DYNAMICLIGHTMAP_ON) + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS); + #elif defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2) + #if UNITY_VERSION >= 60000009 + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos, IN.probeOcclusion, inputData.shadowMask); + #else + inputData.bakedGI = SAMPLE_GI(IN.sh, IN.worldPos, inputData.normalWS, inputData.viewDirectionWS, IN.pos); + #endif + #else + inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS); + #endif + #endif + + inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos); + inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV); + + #if defined(DEBUG_DISPLAY) + #if defined(DYNAMICLIGHTMAP_ON) + inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy; + #endif + #if defined(LIGHTMAP_ON) + inputData.staticLightmapUV = IN.lightmapUV; + #else + inputData.vertexSH = IN.sh; + #endif + #endif + + #ifdef _DBUFFER + ApplyDecal(IN.pos, + l.Albedo, + specular, + inputData.normalWS, + metallic, + l.Occlusion, + l.Smoothness); + #endif + + BRDFData brdfData; + InitializeBRDFData(l.Albedo, metallic, specular, l.Smoothness, l.Alpha, brdfData); + Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); + MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, l.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS); + + return BRDFDataToGbuffer(brdfData, inputData, l.Smoothness, l.Emission + color, l.Occlusion); + } + + ENDHLSL + + } + + + + Pass + { + Name "ShadowCaster" + Tags + { + "LightMode" = "ShadowCaster" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + // ColorMask: + + Tags + { + "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" + } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + ColorMask [_ColorMask] +Lighting Off + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + #pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + + #define _NORMAL_DROPOFF_TS 1 + #define ATTRIBUTES_NEED_NORMAL + #define ATTRIBUTES_NEED_TANGENT + #define _PASSSHADOW 1 + + + #pragma shader_feature_local TIMEISCUSTOM_ON + #pragma shader_feature_local ADDITIVECONFIG_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + #pragma shader_feature_local PREMULTIPLYCOLOR_ON + #pragma shader_feature_local SPLITRGBA_ON + #pragma shader_feature_local SHAPEADD_ON + + #pragma shader_feature_local SHAPE1SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE2SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE3SCREENUV_ON /////////////////Pipeline specific implementation + + #pragma shader_feature_local SHAPEDEBUG_ON + + #pragma shader_feature_local SHAPE1CONTRAST_ON + #pragma shader_feature_local SHAPE1DISTORT_ON + #pragma shader_feature_local SHAPE1ROTATE_ON + #pragma shader_feature_local SHAPE1SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE2_ON + #pragma shader_feature_local SHAPE2CONTRAST_ON + #pragma shader_feature_local SHAPE2DISTORT_ON + #pragma shader_feature_local SHAPE2ROTATE_ON + #pragma shader_feature_local SHAPE2SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE3_ON + #pragma shader_feature_local SHAPE3CONTRAST_ON + #pragma shader_feature_local SHAPE3DISTORT_ON + #pragma shader_feature_local SHAPE3ROTATE_ON + #pragma shader_feature_local SHAPE3SHAPECOLOR_ON + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local DEPTHGLOW_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local MASK_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local COLORRAMPGRAD_ON + #pragma shader_feature_local COLORGRADING_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local SHAKEUV_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local OFFSETSTREAM_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local VERTOFFSET_ON + #pragma shader_feature_local RIM_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local BACKFACETINT_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local POLARUVDISTORT_ON + #pragma shader_feature_local SHAPE1MASK_ON + #pragma shader_feature_local TRAILWIDTH_ON + #pragma shader_feature_local LIGHTANDSHADOW_ON + #pragma shader_feature_local SHAPETEXOFFSET_ON + #pragma shader_feature_local SHAPEWEIGHTS_ON + + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHASMOOTHSTEP_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local FADEBURN_ON + #pragma shader_feature_local ALPHAFADE_ON + #pragma shader_feature_local ALPHAFADEUSESHAPE1_ON + #pragma shader_feature_local ALPHAFADEUSEREDCHANNEL_ON + #pragma shader_feature_local ALPHAFADETRANSPARENCYTOO_ON + #pragma shader_feature_local ALPHAFADEINPUTSTREAM_ON + #pragma shader_feature_local CAMDISTFADE_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define REQUIRE_DEPTH_TEXTURE + + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + // float4 texcoord1 : TEXCOORD4; + // float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half _Alpha; + half _AlphaCutoffValue; + + half _TimingSeed; + + #if TIMEISCUSTOM_ON + float4 globalCustomTime; + #endif + + half4 _MainTex_ST, _ShapeColor; + half _ShapeXSpeed, _ShapeYSpeed, _ShapeColorWeight, _ShapeAlphaWeight; + + #if SHAPE1CONTRAST_ON + half _ShapeContrast, _ShapeBrightness; + #endif + + #if SHAPE1DISTORT_ON + half4 _ShapeDistortTex_ST; + half _ShapeDistortAmount, _ShapeDistortXSpeed, _ShapeDistortYSpeed; + #endif + + #if SHAPE1ROTATE_ON + half _ShapeRotationOffset, _ShapeRotationSpeed; + #endif + + #if OFFSETSTREAM_ON + half _OffsetSh1; + #endif + + #if SHAPEWEIGHTS_ON + half _Sh1BlendOffset; + #endif + + #if SHAPE2_ON + half4 _Shape2Tex_ST, _Shape2Color; + half _Shape2XSpeed, _Shape2YSpeed, _Shape2ColorWeight, _Shape2AlphaWeight; + #if SHAPE2CONTRAST_ON + half _Shape2Contrast, _Shape2Brightness; + #endif + #if SHAPE2DISTORT_ON + half4 _Shape2DistortTex_ST; + half _Shape2DistortAmount, _Shape2DistortXSpeed, _Shape2DistortYSpeed; + #endif + #if SHAPE2ROTATE_ON + half _Shape2RotationOffset, _Shape2RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh2; + #endif + #if SHAPEWEIGHTS_ON + half _Sh2BlendOffset; + #endif + #endif + + #if SHAPE3_ON + half4 _Shape3Tex_ST, _Shape3Color; + half _Shape3XSpeed, _Shape3YSpeed, _Shape3ColorWeight, _Shape3AlphaWeight; + #if SHAPE3CONTRAST_ON + half _Shape3Contrast, _Shape3Brightness; + #endif + #if SHAPE3DISTORT_ON + half4 _Shape3DistortTex_ST; + half _Shape3DistortAmount, _Shape3DistortXSpeed, _Shape3DistortYSpeed; + #endif + #if SHAPE3ROTATE_ON + half _Shape3RotationOffset, _Shape3RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh3; + #endif + #if SHAPEWEIGHTS_ON + half _Sh3BlendOffset; + #endif + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #if GLOWTEX_ON + half4 _GlowTex_ST; + #endif + #endif + + #if MASK_ON + half4 _MaskTex_ST; + half _MaskPow; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if ALPHASMOOTHSTEP_ON + half _AlphaStepMin, _AlphaStepMax; + #endif + + #if ALPHAFADE_ON + half _AlphaFadeAmount, _AlphaFadeSmooth, _AlphaFadePow; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + half _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if ROUNDWAVEUV_ON || PIXELATE_ON + half4 _MainTex_TexelSize; + #endif + + #if VERTOFFSET_ON + half4 _VertOffsetTex_ST; + half _VertOffsetAmount, _VertOffsetPower, _VertOffsetTexXSpeed, _VertOffsetTexYSpeed; + #endif + + #if FADE_ON + half4 _FadeTex_ST; + half _FadeAmount, _FadeTransition, _FadePower, _FadeScrollXSpeed, _FadeScrollYSpeed; + #if FADEBURN_ON + half4 _FadeBurnColor, _FadeBurnTex_ST; + half _FadeBurnWidth, _FadeBurnGlow; + #endif + #endif + + #if COLORGRADING_ON + half3 _ColorGradingLight, _ColorGradingMiddle, _ColorGradingDark; + half _ColorGradingMidPoint; + #endif + + #if CAMDISTFADE_ON + half _CamDistFadeStepMin, _CamDistFadeStepMax, _CamDistProximityFade; + #endif + + #if RIM_ON + half _RimBias, _RimScale, _RimPower, _RimIntensity, _RimAddAmount, _RimErodesAlpha; + half4 _RimColor; + #endif + + #if BACKFACETINT_ON + half4 _BackFaceTint, _FrontFaceTint; + #endif + + #if SHAPEDEBUG_ON + half _DebugShape; + #endif + + #if SHAPE1MASK_ON + half4 _Shape1MaskTex_ST; + half _Shape1MaskPow; + #endif + + #if TRAILWIDTH_ON + half _TrailWidthPower; + #endif + + #if LIGHTANDSHADOW_ON + half3 _All1VfxLightDir; + half _ShadowAmount, _ShadowStepMin, _ShadowStepMax, _LightAmount; + half4 _LightColor; + #endif + + #if SHAPETEXOFFSET_ON + half _RandomSh1Mult, _RandomSh2Mult, _RandomSh3Mult; + #endif + + #if DEPTHGLOW_ON + half _DepthGlowDist, _DepthGlowPow, _DepthGlow, _DepthGlowGlobal; + half4 _DepthGlowColor; + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half _ScreenUvShDistScale,_ScreenUvSh2DistScale, _ScreenUvSh3DistScale; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if SHAPE1DISTORT_ON + TEXTURE2D(_ShapeDistortTex); + SAMPLER(sampler_ShapeDistortTex); + #endif + + #if SHAPE2_ON + TEXTURE2D(_Shape2Tex); + SAMPLER(sampler_Shape2Tex); + #if SHAPE2DISTORT_ON + TEXTURE2D(_Shape2DistortTex); + SAMPLER(sampler_Shape2DistortTex); + #endif + #endif + + #if SHAPE3_ON + TEXTURE2D(_Shape3Tex); + SAMPLER(sampler_Shape3Tex); + #if SHAPE3DISTORT_ON + TEXTURE2D(_Shape3DistortTex); + SAMPLER(sampler_Shape3DistortTex); + #endif + #endif + + #if GLOW_ON + #if GLOWTEX_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + #endif + + #if MASK_ON + TEXTURE2D(_MaskTex); + SAMPLER(sampler_MaskTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + SAMPLER(sampler_ColorRampTex); + #endif + + #if COLORRAMPGRAD_ON + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if VERTOFFSET_ON + TEXTURE2D(_VertOffsetTex); + SAMPLER(sampler_VertOffsetTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + #if FADEBURN_ON + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + #endif + + #if SHAPE1MASK_ON + TEXTURE2D(_Shape1MaskTex); + SAMPLER(sampler_Shape1MaskTex); + #endif + + #if TRAILWIDTH_ON + TEXTURE2D(_TrailWidthGradient); + SAMPLER(sampler_TrailWidthGradient); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + half4 SampleTextureWithScroll(in Texture2D _tex, in SamplerState _sampler, in float2 uv, in half scrollXSpeed, in half scrollYSpeed, in float time) + { + half2 _uv = uv; + _uv.x += (time * scrollXSpeed) % 1; + _uv.y += (time * scrollYSpeed) % 1; + return SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + } + + half EaseOutQuint(half x) + { + return 1 - pow(1 - x, 5); + } + + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax) + { + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + + float2 RotateUvs(float2 uv, half rotation, half4 scaleAndTranslate) + { + half2 center = half2(0.5 * scaleAndTranslate.x + scaleAndTranslate.z, 0.5 * scaleAndTranslate.y + scaleAndTranslate.w); + half cosAngle = cos(rotation); + half sinAngle = sin(rotation); + uv -= center; + uv = mul(half2x2(cosAngle, -sinAngle, sinAngle, cosAngle), uv); + uv += center; + return uv; + } + + half4 GetDebugColor(float4 resColor, half4 shape1, half4 shape2, half4 shape3) + { + half4 res = resColor; + + //MAKE SURE THE FOLLOWING CODE BLOCK IS UNCOMMENTED------------------------------------------- + #if SHAPEDEBUG_ON + if(_DebugShape < 1.5) return shape1; + #if SHAPE2_ON + else if (_DebugShape < 2.5) return shape2; + #endif + #if SHAPE3_ON + else return shape3; + #endif + #endif + + return res; + } + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //uvDistTex --> extraV2F0 + //uvSh1DistTex --> extraV2F1 + //uvSh2DistTex --> extraV2F2 + //uvSh3DistTex --> extraV2F3 + + #if VERTOFFSET_ON + #if TIMEISCUSTOM_ON + const half time = v.texcoord0.z + globalCustomTime.y; + #else + const half time = v.texcoord0.z + _Time.y; + #endif + half4 offsetUv = half4(TRANSFORM_TEX(v.texcoord0.xy, _VertOffsetTex), 0, 0); + offsetUv.x += (time * _VertOffsetTexXSpeed) % 1; + offsetUv.y += (time * _VertOffsetTexYSpeed) % 1; + v.vertex.xyz += v.normal * _VertOffsetAmount * pow(SAMPLE_TEXTURE2D_LOD(_VertOffsetTex, sampler_VertOffsetTex, offsetUv, 0).r, _VertOffsetPower); + #endif + + #if DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F0.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + + #if SHAPE1DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F1.xy = TRANSFORM_TEX(v.texcoord0.xy, _ShapeDistortTex); + #endif + + #if SHAPE2_ON + #if SHAPE2DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F2.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape2DistortTex);; + #endif + #endif + + #if SHAPE3_ON + #if SHAPE3DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F3.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape3DistortTex); + #endif + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + //i.uvSeed -> d.texcoord0.xy + + float seed = d.texcoord0.z + _TimingSeed; + #if TIMEISCUSTOM_ON + const float4 shaderTime = globalCustomTime; + #else + const float4 shaderTime = _Time; + #endif + float time = shaderTime.y + seed; + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 originalUvs = d.texcoord0.xy; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + #if TWISTUV_ON + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + #if DOODLE_ON + half2 uvCopy = d.texcoord0.xy; + _HandDrawnSpeed = (floor((shaderTime.x + seed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if WAVEUV_ON + half2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + half angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((time * _WaveSpeed) % 360.0); + d.texcoord0.xy = d.texcoord0.xy + normalize(uvWave) * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - d.texcoord0.x); + half yWave = ((0.5 * _MainTex_ST.y) - d.texcoord0.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + time * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if POLARUV_ON + half2 prePolarUvs = d.texcoord0.xy; + d.texcoord0.xy = d.texcoord0.xy - half2(0.5, 0.5); + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (1.0 * 6.28318530718), length(d.texcoord0.xy) * 2.0); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + #if DISTORT_ON + #if POLARUVDISTORT_ON + half2 distortUvs = TRANSFORM_TEX(d.texcoord0.xy, _DistortTex); + #else + half2 distortUvs = d.extraV2F0.xy; + #endif + distortUvs.x += ((shaderTime.x + seed) * _DistortTexXSpeed) % 1; + distortUvs.y += ((shaderTime.x + seed) * _DistortTexYSpeed) % 1; + #if ATLAS_ON + d.extraV2F0.xy = half2((d.extraV2F0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.extraV2F0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, distortUvs).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + + #if TEXTURESCROLL_ON + d.texcoord0.x += (time * _TextureScrollXSpeed) % 1; + d.texcoord0.y += (time * _TextureScrollYSpeed) % 1; + #endif + + #if TRAILWIDTH_ON + half width = pow(SAMPLE_TEXTURE2D(_TrailWidthGradient, sampler_TrailWidthGradient, d.texcoord0).r, _TrailWidthPower); + d.texcoord0.y = (d.texcoord0.y * 2 - 1) / width * 0.5 + 0.5; + clip(d.texcoord0.y); + clip(1 - d.texcoord0.y); + #endif + + float2 shape1Uv = d.texcoord0.xy; + #if SHAPE2_ON + float2 shape2Uv = shape1Uv; + #endif + #if SHAPE3_ON + float2 shape3Uv = shape1Uv; + #endif + + #if CAMDISTFADE_ON || SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half camDistance = distance(d.worldSpacePosition, _WorldSpaceCameraPos); + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 uvOffsetPostFx = d.texcoord0.xy - originalUvs; + d.texcoord0.xy = d.screenPos.xy / d.screenPos.w; + d.texcoord0.x = d.texcoord0.x * (_ScreenParams.x / _ScreenParams.y); + d.texcoord0.x -= 0.5; + d.texcoord0.xy -= uvOffsetPostFx; + originalUvs += uvOffsetPostFx; + half distanceZoom = camDistance * 0.1; + half2 scaleWithDistUvs = d.texcoord0.xy * distanceZoom + ((-distanceZoom * 0.5) + 0.5); + #if SHAPE1SCREENUV_ON + shape1Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvShDistScale); + #else + shape1Uv = originalUvs; + #endif + #if SHAPE2SCREENUV_ON && SHAPE2_ON + shape2Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh2DistScale); + #else + #if SHAPE2_ON + shape2Uv = originalUvs; + #endif + #endif + #if SHAPE3SCREENUV_ON && SHAPE3_ON + shape3Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh3DistScale); + #else + #if SHAPE3_ON + shape3Uv = originalUvs; + #endif + #endif + #endif + + shape1Uv = TRANSFORM_TEX(shape1Uv, _MainTex); + #if OFFSETSTREAM_ON + shape1Uv.x += i.offsetCustomData.x * _OffsetSh1; + shape1Uv.y += i.offsetCustomData.y * _OffsetSh1; + #endif + #if SHAPETEXOFFSET_ON + shape1Uv += seed * _RandomSh1Mult; + #endif + + #if SHAPE1DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh1DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _ShapeDistortTex); + #else + half2 sh1DistortUvs = d.extraV2F1.xy; + #endif + + sh1DistortUvs.x += ((time + seed) * _ShapeDistortXSpeed) % 1; + sh1DistortUvs.y += ((time + seed) * _ShapeDistortYSpeed) % 1; + half distortAmount = (SAMPLE_TEXTURE2D(_ShapeDistortTex, sampler_ShapeDistortTex, sh1DistortUvs).r - 0.5) * 0.2 * _ShapeDistortAmount; + shape1Uv.x += distortAmount; + shape1Uv.y += distortAmount; + #endif + #if SHAPE1ROTATE_ON + shape1Uv = RotateUvs(shape1Uv, _ShapeRotationOffset + ((_ShapeRotationSpeed * time) % 6.28318530718), _MainTex_ST); + #endif + + half4 shape1 = SampleTextureWithScroll(_MainTex, sampler_MainTex, shape1Uv, _ShapeXSpeed, _ShapeYSpeed, time); + #if SHAPE1SHAPECOLOR_ON + shape1.a = shape1.r; + shape1.rgb = _ShapeColor.rgb; + #else + shape1 *= _ShapeColor; + #endif + #if SHAPE1CONTRAST_ON + #if SHAPE1SHAPECOLOR_ON + shape1.a = saturate((shape1.a - 0.5) * _ShapeContrast + 0.5 + _ShapeBrightness); + #else + shape1.rgb = max(0, (shape1.rgb - half3(0.5, 0.5, 0.5)) * _ShapeContrast + half3(0.5, 0.5, 0.5) + _ShapeBrightness); + #endif + #endif + + half4 shape2 = 1.0; + #if SHAPE2_ON + shape2Uv = TRANSFORM_TEX(shape2Uv, _Shape2Tex); + #if OFFSETSTREAM_ON + shape2Uv.x += i.offsetCustomData.x * _OffsetSh2; + shape2Uv.y += i.offsetCustomData.y * _OffsetSh2; + #endif + #if SHAPETEXOFFSET_ON + shape2Uv += seed * _RandomSh2Mult; + #endif + #if SHAPE2DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh2DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape2DistortTex); + #else + half2 sh2DistortUvs = d.extraV2F2.xy; + #endif + sh2DistortUvs.x += ((time + seed) * _Shape2DistortXSpeed) % 1; + sh2DistortUvs.y += ((time + seed) * _Shape2DistortYSpeed) % 1; + half distortAmnt2 = (SAMPLE_TEXTURE2D(_Shape2DistortTex, sampler_Shape2DistortTex, sh2DistortUvs).r - 0.5) * 0.2 * _Shape2DistortAmount; + shape2Uv.x += distortAmnt2; + shape2Uv.y += distortAmnt2; + #endif + #if SHAPE2ROTATE_ON + shape2Uv = RotateUvs(shape2Uv, _Shape2RotationOffset + ((_Shape2RotationSpeed * time) % 6.28318530718), _Shape2Tex_ST); + #endif + + shape2 = SampleTextureWithScroll(_Shape2Tex, sampler_Shape2Tex, shape2Uv, _Shape2XSpeed, _Shape2YSpeed, time); + #if SHAPE2SHAPECOLOR_ON + shape2.a = shape2.r; + shape2.rgb = _Shape2Color.rgb; + #else + shape2 *= _Shape2Color; + #endif + #if SHAPE2CONTRAST_ON + #if SHAPE2SHAPECOLOR_ON + shape2.a = max(0, (shape2.a - 0.5) * _Shape2Contrast + 0.5 + _Shape2Brightness); + #else + shape2.rgb = max(0, (shape2.rgb - half3(0.5, 0.5, 0.5)) * _Shape2Contrast + half3(0.5, 0.5, 0.5) + _Shape2Brightness); + #endif + #endif + #endif + + half4 shape3 = 1.0; + #if SHAPE3_ON + shape3Uv = TRANSFORM_TEX(shape3Uv, _Shape3Tex); + + #if OFFSETSTREAM_ON + shape3Uv.x += i.offsetCustomData.x * _OffsetSh3; + shape3Uv.y += i.offsetCustomData.y * _OffsetSh3; + #endif + #if SHAPETEXOFFSET_ON + shape3Uv += seed * _RandomSh3Mult; + #endif + #if SHAPE3DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh3DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape3DistortTex); + #else + half2 sh3DistortUvs = d.extraV2F3.xy; + #endif + sh3DistortUvs.x += ((time + seed) * _Shape3DistortXSpeed) % 1; + sh3DistortUvs.y += ((time + seed) * _Shape3DistortYSpeed) % 1; + half distortAmnt3 = (SAMPLE_TEXTURE2D(_Shape3DistortTex, sampler_Shape3DistortTex, sh3DistortUvs).r - 0.5) * 0.3 * _Shape3DistortAmount; + shape3Uv.x += distortAmnt3; + shape3Uv.y += distortAmnt3; + #endif + #if SHAPE3ROTATE_ON + shape3Uv = RotateUvs(shape3Uv, _Shape3RotationOffset + ((_Shape3RotationSpeed * time) % 6.28318530718), _Shape3Tex_ST); + #endif + shape3 = SampleTextureWithScroll(_Shape3Tex, sampler_Shape3Tex, shape3Uv, _Shape3XSpeed, _Shape3YSpeed, time); + #if SHAPE3SHAPECOLOR_ON + shape3.a = shape3.r; + shape3.rgb = _Shape3Color.rgb; + #else + shape3 *= _Shape3Color; + #endif + #if SHAPE3CONTRAST_ON + #if SHAPE3SHAPECOLOR_ON + shape3.a = max(0, (shape3.a - 0.5) * _Shape3Contrast + 0.5 + _Shape3Brightness); + #else + shape3.rgb = max(0, (shape3.rgb - half3(0.5, 0.5, 0.5)) * _Shape3Contrast + half3(0.5, 0.5, 0.5) + _Shape3Brightness); + #endif + #endif + #endif + + half4 col = shape1; + //Mix all shapes pre: change weights if custom vertex effect active + #if SHAPEWEIGHTS_ON + half shapeWeightOffset; + #if SHAPE2_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh1BlendOffset; + _ShapeColorWeight = max(0, _ShapeColorWeight + shapeWeightOffset); + _ShapeAlphaWeight = max(0, _ShapeAlphaWeight + shapeWeightOffset); + shapeWeightOffset = i.offsetCustomData.z * _Sh2BlendOffset; + _Shape2ColorWeight = max(0, _Shape2ColorWeight + shapeWeightOffset); + _Shape2AlphaWeight = max(0, _Shape2AlphaWeight + shapeWeightOffset); + #endif + #if SHAPE3_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh3BlendOffset; + _Shape3ColorWeight = max(0, _Shape3ColorWeight + shapeWeightOffset); + _Shape3AlphaWeight = max(0, _Shape3AlphaWeight + shapeWeightOffset); + #endif + #endif + + //Mix all shapes + #if SHAPE2_ON + #if !SPLITRGBA_ON + _ShapeAlphaWeight = _ShapeColorWeight; + _Shape2AlphaWeight = _Shape2ColorWeight; + #endif + #if SHAPE3_ON //Shape3 On + #if !SPLITRGBA_ON + _Shape3AlphaWeight = _Shape3ColorWeight; + #endif + #if SHAPEADD_ON + col.rgb = ((shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight)) + (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(max(shape3.a * _Shape3AlphaWeight, max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight))); + #else + col.rgb = ((shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight)) * (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)) * (shape3.a * _Shape3AlphaWeight)); + #endif + #else //Shape3 Off + #if SHAPEADD_ON + col.rgb = (shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight); + col.a = saturate(max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight)); + #else + col.rgb = (shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight); + col.a = saturate((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)); + #endif + #endif + #endif + + #if SHAPE1MASK_ON + col = lerp(col, shape1, pow(SAMPLE_TEXTURE2D(_Shape1MaskTex, sampler_Shape1MaskTex, TRANSFORM_TEX(i.uvSeed.xy, _Shape1MaskTex)).r, _Shape1MaskPow)); + #endif + + #if PREMULTIPLYCOLOR_ON + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + col.a = min(luminance, col.a); + #endif + + col.rgb *= _Color.rgb * d.vertexColor.rgb; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if !PREMULTIPLYCOLOR_ON && (COLORRAMP_ON || ALPHAFADE_ON || COLORGRADING_ON || FADE_ON || (ADDITIVECONFIG_ON && (GLOW_ON || DEPTHGLOW_ON))) + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + #endif + + #if (FADE_ON || ALPHAFADE_ON) && ALPHAFADEINPUTSTREAM_ON + col.a *= d.vertexColor.a; + d.vertexColor.a = d.texcoord0.w; + #endif + + #if FADE_ON + half preFadeAlpha = col.a; + _FadeAmount = saturate(_FadeAmount + (1 - d.vertexColor.a)); + _FadeTransition = max(0.01, _FadeTransition * EaseOutQuint(saturate(_FadeAmount))); + half2 fadeUv; + fadeUv = d.texcoord0.xy + seed; + fadeUv.x += (time * _FadeScrollXSpeed) % 1; + fadeUv.y += (time * _FadeScrollYSpeed) % 1; + half2 tiledUvFade1 = TRANSFORM_TEX(fadeUv, _FadeTex); + #if ADDITIVECONFIG_ON && !PREMULTIPLYCOLOR_ON + preFadeAlpha *= luminance; + #endif + _FadeAmount = saturate(pow(_FadeAmount, _FadePower)); + #if FADEBURN_ON + half2 tiledUvFade2 = TRANSFORM_TEX(fadeUv, _FadeBurnTex); + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fadeNaturalEdge = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fadeNaturalEdge; + half fadeBurn = saturate(smoothstep(0.0 , _FadeTransition + _FadeBurnWidth, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + fadeBurn = fadeNaturalEdge - fadeBurn; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col.rgb += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2).rgb * _FadeBurnColor.rgb * preFadeAlpha; + #else + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + float fade = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fade; + #endif + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _FadeAmount; + #endif + #endif + + #if ALPHAFADE_ON + half alphaFadeLuminance; + _AlphaFadeAmount = saturate(_AlphaFadeAmount + (1 - d.vertexColor.a)); + _AlphaFadeAmount = saturate(pow(_AlphaFadeAmount, _AlphaFadePow)); + _AlphaFadeSmooth = max(0.01, _AlphaFadeSmooth * EaseOutQuint(saturate(_AlphaFadeAmount))); + #if ALPHAFADEUSESHAPE1_ON + alphaFadeLuminance = shape1.r; + #else + alphaFadeLuminance = luminance; + #endif + alphaFadeLuminance = saturate(alphaFadeLuminance - 0.001); + #if ALPHAFADEUSEREDCHANNEL_ON + col.a *= col.r; + #endif + col.a = saturate(col.a); + float alphaFade = saturate(smoothstep(0.0 , _AlphaFadeSmooth, RemapFloat(1.0 - _AlphaFadeAmount, 0.0, 1.0, -1.0, 1.0) + alphaFadeLuminance)); + col.a *= alphaFade; + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _AlphaFadeAmount; + #endif + #endif + + #if BACKFACETINT_ON + col.rgb = lerp(col.rgb * _BackFaceTint, col.rgb * _FrontFaceTint, step(0, dot(d.worldSpaceNormal, d.worldSpaceViewDir))); + #endif + + //#if LIGHTANDSHADOW_ON + //half NdL = saturate(dot(d.worldSpaceNormal, -_All1VfxLightDir)); + //col.rgb += _LightColor * _LightAmount * NdL; + //NdL = max(_ShadowAmount, NdL); + //NdL = smoothstep(_ShadowStepMin, _ShadowStepMax, NdL); + //col.rgb *= NdL; + //#endif + + #if COLORGRADING_ON + col.rgb *= lerp(lerp(_ColorGradingDark, _ColorGradingMiddle, luminance/_ColorGradingMidPoint), + lerp(_ColorGradingMiddle, _ColorGradingLight, (luminance - _ColorGradingMidPoint)/(1.0 - _ColorGradingMidPoint)), step(_ColorGradingMidPoint, luminance)); + #endif + + #if COLORRAMP_ON + half colorRampLuminance = saturate(luminance + _ColorRampLuminosity); + #if COLORRAMPGRAD_ON + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(colorRampLuminance, 0)); + #else + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(colorRampLuminance, 0)); + #endif + col.rgb = lerp(col.rgb, colorRampRes.rgb, _ColorRampBlend); + col.a = lerp(col.a, saturate(col.a * colorRampRes.a), _ColorRampBlend); + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = floor(col.rgb / (1.0 / _PosterizeNumColors)) * (1.0 / _PosterizeNumColors); + #endif + + #if DEPTHGLOW_ON + half sceneDepthDiff = GetLinearEyeDepth(d.screenUV) - d.screenPos.w; + #endif + + #if RIM_ON + half NdV = 1 - abs(dot(d.worldSpaceNormal, d.worldSpaceViewDir)); + half rimFactor = saturate(_RimBias + _RimScale * pow(NdV, _RimPower)); + half4 rimCol = _RimColor * rimFactor; + rimCol.rgb *= _RimIntensity; + col.rgb = lerp(col.rgb * (rimCol.rgb + half3(1,1,1)), col.rgb + rimCol.rgb, _RimAddAmount); + col.a = saturate(col.a * (1 - rimFactor * _RimErodesAlpha)); + #endif + + #if DEPTHGLOW_ON + half depthGlowMask = saturate(_DepthGlowDist * pow((1 - sceneDepthDiff), _DepthGlowPow)); + col.rgb = lerp(col.rgb, _DepthGlowGlobal * col.rgb, depthGlowMask); + half depthGlowMult = 1; + #if ADDITIVECONFIG_ON + depthGlowMult = luminance; + #endif + col.rgb += _DepthGlowColor.rgb * _DepthGlow * depthGlowMask * col.a * depthGlowMult; + #endif + + #if GLOW_ON + half glowMask = 1; + #if GLOWTEX_ON + glowMask = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, TRANSFORM_TEX(d.texcoord0.xy, _GlowTex)); + #endif + col.rgb *= _GlowGlobal * glowMask; + half glowMult = 1; + #if ADDITIVECONFIG_ON + glowMult = luminance; + #endif + + col.rgb += _GlowColor.rgb * _Glow * glowMask * col.a * glowMult; + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if CAMDISTFADE_ON + col.a *= 1 - saturate(smoothstep(_CamDistFadeStepMin, _CamDistFadeStepMax, camDistance)); + col.a *= smoothstep(0.0, _CamDistProximityFade, camDistance); + #endif + + #if MASK_ON + half2 maskUv = d.texcoord0.xy; + #if POLARUV_ON + maskUv = prePolarUvs; + #endif + half4 maskSample = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, TRANSFORM_TEX(maskUv, _MaskTex)); + half mask = pow(min(maskSample.r, maskSample.a), _MaskPow); + col.a *= mask; + #endif + + #if ALPHASMOOTHSTEP_ON + col.a = smoothstep(_AlphaStepMin, _AlphaStepMax, col.a); + #endif + + half4 debugColor = col; + #if SHAPEDEBUG_ON + debugColor = GetDebugColor(col, shape1, shape2, shape3); + #endif + + clip(debugColor.a - _AlphaCutoffValue - 0.01); + + //#if FOG_ON + //UNITY_APPLY_FOG(i.fogCoord, col); + //#endif + + //Don't use a starting i.color.a lower than 1 unless using vertex stream dissolve when using a FADE effect + #if !FADE_ON && !ALPHAFADE_ON + col.a *= _Alpha * d.vertexColor.a; + #endif + #if FADE_ON || ALPHAFADE_ON + col.a *= _Alpha; + #endif + #if ADDITIVECONFIG_ON + col.rgb *= col.a; + #endif + + + #if SHAPEDEBUG_ON + o.Albedo = debugColor.rgb; + o.Alpha = debugColor.a; + #else + o.Albedo = col.rgb; + o.Alpha = col.a; + #endif + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + // d.texcoord1 = i.texcoord1; + // d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenPos = i.screenPos; + d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + // o.texcoord1 = v.texcoord1; + // o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // o.texcoord3 = v.texcoord3; // #endif - o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; - o.worldNormal = UnityObjectToWorldNormal(v.normal); - o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif - - UNITY_TRANSFER_LIGHTING(o, v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader - UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader - - return o; - } - - - - // fragment shader - fixed4 Frag (VertexToPixel IN - #ifdef _DEPTHOFFSET_ON - , out float outputDepth : SV_Depth - #endif - #if NEED_FACING - , bool facing : SV_IsFrontFace - #endif - ) : SV_Target - { - UNITY_SETUP_INSTANCE_ID(IN); - // prepare and unpack data - - #ifdef FOG_COMBINED_WITH_TSPACE - UNITY_EXTRACT_FOG_FROM_TSPACE(IN); - #elif defined (FOG_COMBINED_WITH_WORLD_POS) - UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); - #else - UNITY_EXTRACT_FOG(IN); - #endif - - - - ShaderData d = CreateShaderData(IN - #if NEED_FACING - , facing - #endif - ); - Surface l = (Surface)0; - - - #ifdef _DEPTHOFFSET_ON - l.outputDepth = outputDepth; - #endif - - l.Albedo = half3(0.5, 0.5, 0.5); - l.Normal = float3(0,0,1); - l.Occlusion = 1; - l.Alpha = 1; - - ChainSurfaceFunction(l, d); - - #ifdef _DEPTHOFFSET_ON - outputDepth = l.outputDepth; - #endif - - - #ifndef USING_DIRECTIONAL_LIGHT - fixed3 lightDir = normalize(UnityWorldSpaceLightDir(d.worldSpacePosition)); - #else - fixed3 lightDir = _WorldSpaceLightPos0.xyz; - #endif - float3 worldViewDir = normalize(UnityWorldSpaceViewDir(d.worldSpacePosition)); - - #if _USESPECULAR || _USESPECULARWORKFLOW || _SPECULARFROMMETALLIC - #ifdef UNITY_COMPILER_HLSL - SurfaceOutputStandardSpecular o = (SurfaceOutputStandardSpecular)0; - #else - SurfaceOutputStandardSpecular o; - #endif - o.Specular = l.Specular; - o.Occlusion = l.Occlusion; - o.Smoothness = l.Smoothness; - #elif _BDRFLAMBERT || _BDRF3 || _SIMPLELIT - #ifdef UNITY_COMPILER_HLSL - SurfaceOutput o = (SurfaceOutput)0; - #else - SurfaceOutput o; - #endif - - o.Specular = l.SpecularPower; - o.Gloss = l.Smoothness; - _SpecColor.rgb = l.Specular; // fucking hell Unity, wtf.. - #else - #ifdef UNITY_COMPILER_HLSL - SurfaceOutputStandard o = (SurfaceOutputStandard)0; - #else - SurfaceOutputStandard o; - #endif - o.Smoothness = l.Smoothness; - o.Metallic = l.Metallic; - o.Occlusion = l.Occlusion; - #endif - - - o.Albedo = l.Albedo; - o.Emission = l.Emission; - o.Alpha = l.Alpha; - - #if _WORLDSPACENORMAL - o.Normal = l.Normal; - #else - o.Normal = normalize(TangentToWorldSpace(d, l.Normal)); - #endif - - - - UNITY_LIGHT_ATTENUATION(atten, IN, d.worldSpacePosition) - half4 c = 0; - - // Setup lighting environment - UnityGI gi; - UNITY_INITIALIZE_OUTPUT(UnityGI, gi); - gi.indirect.diffuse = 0; - gi.indirect.specular = 0; - gi.light.color = _LightColor0.rgb; - gi.light.dir = lightDir; - gi.light.color *= atten; - - #if defined(_OVERRIDE_SHADOWMASK) - float4 mulColor = saturate(dot(l.ShadowMask, unity_OcclusionMaskSelector)); - gi.light.color *= mulColor; - #endif - - #if _USESPECULAR - c += LightingStandardSpecular (o, worldViewDir, gi); - #elif _BDRF3 || _SIMPLELIT - c += LightingBlinnPhong (o, d.worldSpaceViewDir, gi); - #else - c += LightingStandard (o, worldViewDir, gi); - #endif + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; - ChainFinalColorForward(l, d, c); - #if !DISABLEFOG - UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog - #endif - #if !_ALPHABLEND_ON - UNITY_OPAQUE_ALPHA(c.a); - #endif - - return c; - } - - ENDCG - - } - - - Pass { - Name "ShadowCaster" - Tags { "LightMode" = "ShadowCaster" } - ZWrite On ZTest LEqual - - Tags - { - "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" - } - Cull [_CullingOption] - ZWrite [_ZWrite] - ZTest [_ZTestMode] - ColorMask [_ColorMask] -Lighting Off - - - CGPROGRAM - - #pragma vertex Vert - #pragma fragment Frag - // compile directives - #pragma target 3.0 - #pragma multi_compile_instancing - #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 - #pragma multi_compile_shadowcaster - #include "HLSLSupport.cginc" - #define UNITY_INSTANCED_LOD_FADE - #define UNITY_INSTANCED_SH - #define UNITY_INSTANCED_LIGHTMAPSTS - #include "UnityShaderVariables.cginc" - #include "UnityShaderUtilities.cginc" - - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - - #define _PASSSHADOW 1 - - - #pragma shader_feature_local TIMEISCUSTOM_ON - #pragma shader_feature_local ADDITIVECONFIG_ON - #pragma shader_feature_local PREMULTIPLYALPHA_ON - #pragma shader_feature_local PREMULTIPLYCOLOR_ON - #pragma shader_feature_local SPLITRGBA_ON - #pragma shader_feature_local SHAPEADD_ON - - #pragma shader_feature_local SHAPE1SCREENUV_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local SHAPE2SCREENUV_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local SHAPE3SCREENUV_ON /////////////////Pipeline specific implementation - - #pragma shader_feature_local SHAPEDEBUG_ON - - #pragma shader_feature_local SHAPE1CONTRAST_ON - #pragma shader_feature_local SHAPE1DISTORT_ON - #pragma shader_feature_local SHAPE1ROTATE_ON - #pragma shader_feature_local SHAPE1SHAPECOLOR_ON - - #pragma shader_feature_local SHAPE2_ON - #pragma shader_feature_local SHAPE2CONTRAST_ON - #pragma shader_feature_local SHAPE2DISTORT_ON - #pragma shader_feature_local SHAPE2ROTATE_ON - #pragma shader_feature_local SHAPE2SHAPECOLOR_ON - - #pragma shader_feature_local SHAPE3_ON - #pragma shader_feature_local SHAPE3CONTRAST_ON - #pragma shader_feature_local SHAPE3DISTORT_ON - #pragma shader_feature_local SHAPE3ROTATE_ON - #pragma shader_feature_local SHAPE3SHAPECOLOR_ON - - #pragma shader_feature_local GLOW_ON - #pragma shader_feature_local GLOWTEX_ON - #pragma shader_feature_local DEPTHGLOW_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local MASK_ON - #pragma shader_feature_local COLORRAMP_ON - #pragma shader_feature_local COLORRAMPGRAD_ON - #pragma shader_feature_local COLORGRADING_ON - #pragma shader_feature_local HSV_ON - #pragma shader_feature_local POSTERIZE_ON - #pragma shader_feature_local PIXELATE_ON - #pragma shader_feature_local DISTORT_ON - #pragma shader_feature_local SHAKEUV_ON - #pragma shader_feature_local WAVEUV_ON - #pragma shader_feature_local ROUNDWAVEUV_ON - #pragma shader_feature_local TWISTUV_ON - #pragma shader_feature_local DOODLE_ON - #pragma shader_feature_local OFFSETSTREAM_ON - #pragma shader_feature_local TEXTURESCROLL_ON - #pragma shader_feature_local VERTOFFSET_ON - #pragma shader_feature_local RIM_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local BACKFACETINT_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local POLARUV_ON - #pragma shader_feature_local POLARUVDISTORT_ON - #pragma shader_feature_local SHAPE1MASK_ON - #pragma shader_feature_local TRAILWIDTH_ON - #pragma shader_feature_local LIGHTANDSHADOW_ON - #pragma shader_feature_local SHAPETEXOFFSET_ON - #pragma shader_feature_local SHAPEWEIGHTS_ON - - #pragma shader_feature_local ALPHACUTOFF_ON - #pragma shader_feature_local ALPHASMOOTHSTEP_ON - #pragma shader_feature_local FADE_ON - #pragma shader_feature_local FADEBURN_ON - #pragma shader_feature_local ALPHAFADE_ON - #pragma shader_feature_local ALPHAFADEUSESHAPE1_ON - #pragma shader_feature_local ALPHAFADEUSEREDCHANNEL_ON - #pragma shader_feature_local ALPHAFADETRANSPARENCYTOO_ON - #pragma shader_feature_local ALPHAFADEINPUTSTREAM_ON - #pragma shader_feature_local CAMDISTFADE_ON - - #pragma shader_feature NORMALMAP_ON - - - #define _STANDARD 1 -// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same -// texturing library they use. However, since they are not included in the standard pipeline by default, there is no -// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without -// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead -// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not -// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. - -#if defined(SHADER_API_GAMECORE) - - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r - #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_XBOXONE) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_PSSL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName - #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - - -#elif defined(SHADER_API_D3D11) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_METAL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_VULKAN) -// This file assume SHADER_API_VULKAN is defined - // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. - - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_SWITCH) - // This file assume SHADER_API_SWITCH is defined - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_GLCORE) - - // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 46) - #define OPENGL4_1_SM5 1 - #else - #define OPENGL4_1_SM5 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - - #if OPENGL4_1_SM5 - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #endif - - - #elif defined(SHADER_API_GLES3) - - // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 40) - #define GLES3_1_AEP 1 - #else - #define GLES3_1_AEP 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #if GLES3_1_AEP - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - #else - #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - #endif - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #if GLES3_1_AEP - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - #endif - - -#elif defined(SHADER_API_GLES) - - - #define uint int - - #define rcp(x) 1.0 / (x) - #define ddx_fine ddx - #define ddy_fine ddy - #define asfloat - #define asuint(x) asint(x) - #define f32tof16 - #define f16tof32 - - #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 - - // Texture abstraction - - #define TEXTURE2D(textureName) sampler2D textureName - #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray - #define TEXTURECUBE(textureName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray - #define TEXTURE3D(textureName) sampler3D textureName - - #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray - #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray - #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName - - #define TEXTURE2D_HALF(textureName) sampler2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray - #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray - #define TEXTURE3D_HALF(textureName) sampler3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - - #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - - #define SAMPLER(samplerName) - #define SAMPLER_CMP(samplerName) - - #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) - - #if (SHADER_TARGET >= 30) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) - #else - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) - #endif - - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) - - - // Not supported. Can't define as error because shader library is calling these functions. - #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) - - // Gather not supported. Fallback to regular texture sampling. - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - -#else -#error unsupported shader api -#endif - - - - -// default flow control attributes -#ifndef UNITY_BRANCH -# define UNITY_BRANCH -#endif -#ifndef UNITY_FLATTEN -# define UNITY_FLATTEN -#endif -#ifndef UNITY_UNROLL -# define UNITY_UNROLL -#endif -#ifndef UNITY_UNROLLX -# define UNITY_UNROLLX(_x) -#endif -#ifndef UNITY_LOOP -# define UNITY_LOOP -#endif - - - - - - - - - // data across stages, stripped like the above. - struct VertexToPixel - { - V2F_SHADOW_CASTER; // may declare TEXCOORD0 for the wonderfully named .vec - float3 worldPos : TEXCOORD1; - float3 worldNormal : TEXCOORD2; - float4 worldTangent : TEXCOORD3; - float4 texcoord0 : TEXCOORD4; - // float4 texcoord1 : TEXCOORD5; - // float4 texcoord2 : TEXCOORD6; - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD7; - // #endif - - // #if %SCREENPOSREQUIREKEY% - float4 screenPos : TEXCOORD8; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - // #if %EXTRAV2F0REQUIREKEY% - float4 extraV2F0 : TEXCOORD9; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - float4 extraV2F1 : TEXCOORD10; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - float4 extraV2F2 : TEXCOORD11; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - float4 extraV2F3 : TEXCOORD12; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // float4 extraV2F4 : TEXCOORD13; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // float4 extraV2F5 : TEXCOORD14; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // float4 extraV2F6 : TEXCOORD15; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // float4 extraV2F7 : TEXCOORD16; - // #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - }; - - - - // data describing the user output of a pixel - struct Surface - { - half3 Albedo; - half Height; - half3 Normal; - half Smoothness; - half3 Emission; - half Metallic; - half3 Specular; - half Occlusion; - half SpecularPower; // for simple lighting - half Alpha; - float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value - // HDRP Only - half SpecularOcclusion; - half SubsurfaceMask; - half Thickness; - half CoatMask; - half CoatSmoothness; - half Anisotropy; - half IridescenceMask; - half IridescenceThickness; - int DiffusionProfileHash; - float SpecularAAThreshold; - float SpecularAAScreenSpaceVariance; - // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines - float3 DiffuseGI; - float3 BackDiffuseGI; - float3 SpecularGI; - float ior; - float3 transmittanceColor; - float atDistance; - float transmittanceMask; - // requires _OVERRIDE_SHADOWMASK to be defines - float4 ShadowMask; - - // for decals - float NormalAlpha; - float MAOSAlpha; - - - }; - - // Data the user declares in blackboard blocks - struct Blackboard - { - - float blackboardDummyData; - }; - - // data the user might need, this will grow to be big. But easy to strip - struct ShaderData - { - float4 clipPos; // SV_POSITION - float3 localSpacePosition; - float3 localSpaceNormal; - float3 localSpaceTangent; - - float3 worldSpacePosition; - float3 worldSpaceNormal; - float3 worldSpaceTangent; - float tangentSign; - - float3 worldSpaceViewDir; - float3 tangentSpaceViewDir; - - float4 texcoord0; - float4 texcoord1; - float4 texcoord2; - float4 texcoord3; - - float2 screenUV; - float4 screenPos; - - float4 vertexColor; - bool isFrontFace; - - float4 extraV2F0; - float4 extraV2F1; - float4 extraV2F2; - float4 extraV2F3; - float4 extraV2F4; - float4 extraV2F5; - float4 extraV2F6; - float4 extraV2F7; - - float3x3 TBNMatrix; - Blackboard blackboard; - }; - - struct VertexData - { - #if SHADER_TARGET > 30 - // uint vertexID : SV_VertexID; - #endif - float4 vertex : POSITION; - float3 normal : NORMAL; - float4 tangent : TANGENT; - float4 texcoord0 : TEXCOORD0; - - // optimize out mesh coords when not in use by user or lighting system - #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) - float4 texcoord1 : TEXCOORD1; - #endif - - #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) - float4 texcoord2 : TEXCOORD2; - #endif - - #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) - float4 texcoord1 : TEXCOORD1; - #endif - #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) - float4 texcoord2 : TEXCOORD2; - #endif - - - #if _HDRP - float4 texcoord1 : TEXCOORD1; - float4 texcoord2 : TEXCOORD2; - #endif - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) - float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) - #if defined (_ADD_PRECOMPUTED_VELOCITY) - float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). - #endif - #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - }; - - struct TessVertex - { - float4 vertex : INTERNALTESSPOS; - float3 normal : NORMAL; - float4 tangent : TANGENT; - float4 texcoord0 : TEXCOORD0; - float4 texcoord1 : TEXCOORD1; - float4 texcoord2 : TEXCOORD2; - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - // #if %EXTRAV2F0REQUIREKEY% - float4 extraV2F0 : TEXCOORD5; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - float4 extraV2F1 : TEXCOORD6; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - float4 extraV2F2 : TEXCOORD7; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - float4 extraV2F3 : TEXCOORD8; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // float4 extraV2F4 : TEXCOORD9; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // float4 extraV2F5 : TEXCOORD10; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // float4 extraV2F6 : TEXCOORD11; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // float4 extraV2F7 : TEXCOORD12; - // #endif - - #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) - float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) - #if defined (_ADD_PRECOMPUTED_VELOCITY) - float3 precomputedVelocity : TEXCOORD14; - #endif - #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - }; - - struct ExtraV2F - { - float4 extraV2F0; - float4 extraV2F1; - float4 extraV2F2; - float4 extraV2F3; - float4 extraV2F4; - float4 extraV2F5; - float4 extraV2F6; - float4 extraV2F7; - Blackboard blackboard; - float4 time; - }; - - - float3 WorldToTangentSpace(ShaderData d, float3 normal) - { - return mul(d.TBNMatrix, normal); - } - - float3 TangentToWorldSpace(ShaderData d, float3 normal) - { - return mul(normal, d.TBNMatrix); - } - - // in this case, make standard more like SRPs, because we can't fix - // unity_WorldToObject in HDRP, since it already does macro-fu there - - #if _STANDARD - float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; - float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; - float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; - float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; - float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } - float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } - #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) - #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) - #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); #else - #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) - #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + float3 lightDirectionWS = _LightDirection; #endif - - #undef UNITY_MATRIX_I_M - - #define UNITY_MATRIX_I_M unity_WorldToObject - - - #endif - - float3 GetCameraWorldPosition() - { - #if _HDRP - return GetCameraRelativePositionWS(_WorldSpaceCameraPos); - #else - return _WorldSpaceCameraPos; - #endif - } - - #if _GRABPASSUSED - #if _STANDARD - TEXTURE2D(%GRABTEXTURE%); - SAMPLER(sampler_%GRABTEXTURE%); - #endif - - half3 GetSceneColor(float2 uv) - { - #if _STANDARD - return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; - #else - return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); - #endif - } - #endif - - - - #if _STANDARD - UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); - float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } - float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } - float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } - #else - float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } - float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } - float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } - #endif - - float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) - { - float eye = GetLinearEyeDepth(uv); - float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); - - float dt = dot(worldSpaceViewDir, camView); - float3 div = worldSpaceViewDir/dt; - float3 wpos = (eye * div) + GetCameraWorldPosition(); - return wpos; - } - - #if _HDRP - float3 ObjectToWorldSpacePosition(float3 pos) - { - return GetAbsolutePositionWS(TransformObjectToWorld(pos)); - } - #else - float3 ObjectToWorldSpacePosition(float3 pos) - { - return TransformObjectToWorld(pos); - } - #endif - - #if _STANDARD - UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); - float3 norms = DecodeViewNormalStereo(depthNorms); - norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; - return norms; - } - #elif _HDRP && !_DECALSHADER - - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - NormalData nd; - DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); - return nd.normalWS; - } - #elif _URP - #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) - #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" - #endif - - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) - return SampleSceneNormals(uv); - #else - float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); - return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; - #endif - - } - #endif - - #if _HDRP - - half3 UnpackNormalmapRGorAG(half4 packednormal) - { - // This do the trick - packednormal.x *= packednormal.w; - - half3 normal; - normal.xy = packednormal.xy * 2 - 1; - normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); - return normal; - } - half3 UnpackNormal(half4 packednormal) - { - #if defined(UNITY_NO_DXT5nm) - return packednormal.xyz * 2 - 1; - #else - return UnpackNormalmapRGorAG(packednormal); - #endif - } - #endif - #if _HDRP || _URP - - half3 UnpackScaleNormal(half4 packednormal, half scale) - { - #ifndef UNITY_NO_DXT5nm - // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) - // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 - packednormal.x *= packednormal.w; - #endif - half3 normal; - normal.xy = (packednormal.xy * 2 - 1) * scale; - normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); - return normal; - } - - #endif - - - void GetSun(out float3 lightDir, out float3 color) - { - lightDir = float3(0.5, 0.5, 0); - color = 1; - #if _HDRP - if (_DirectionalLightCount > 0) - { - DirectionalLightData light = _DirectionalLightDatas[0]; - lightDir = -light.forward.xyz; - color = light.color; - } - #elif _STANDARD - lightDir = normalize(_WorldSpaceLightPos0.xyz); - color = _LightColor0.rgb; - #elif _URP - Light light = GetMainLight(); - lightDir = light.direction; - color = light.color; - #endif - } - - - - - half4 _Color; - half _Alpha; - half _AlphaCutoffValue; - - half _TimingSeed; - - #if TIMEISCUSTOM_ON - float4 globalCustomTime; - #endif - - half4 _MainTex_ST, _ShapeColor; - half _ShapeXSpeed, _ShapeYSpeed, _ShapeColorWeight, _ShapeAlphaWeight; - - #if SHAPE1CONTRAST_ON - half _ShapeContrast, _ShapeBrightness; - #endif - - #if SHAPE1DISTORT_ON - half4 _ShapeDistortTex_ST; - half _ShapeDistortAmount, _ShapeDistortXSpeed, _ShapeDistortYSpeed; - #endif - - #if SHAPE1ROTATE_ON - half _ShapeRotationOffset, _ShapeRotationSpeed; - #endif - - #if OFFSETSTREAM_ON - half _OffsetSh1; - #endif - - #if SHAPEWEIGHTS_ON - half _Sh1BlendOffset; - #endif - - #if SHAPE2_ON - half4 _Shape2Tex_ST, _Shape2Color; - half _Shape2XSpeed, _Shape2YSpeed, _Shape2ColorWeight, _Shape2AlphaWeight; - #if SHAPE2CONTRAST_ON - half _Shape2Contrast, _Shape2Brightness; - #endif - #if SHAPE2DISTORT_ON - half4 _Shape2DistortTex_ST; - half _Shape2DistortAmount, _Shape2DistortXSpeed, _Shape2DistortYSpeed; - #endif - #if SHAPE2ROTATE_ON - half _Shape2RotationOffset, _Shape2RotationSpeed; - #endif - #if OFFSETSTREAM_ON - half _OffsetSh2; - #endif - #if SHAPEWEIGHTS_ON - half _Sh2BlendOffset; - #endif - #endif - - #if SHAPE3_ON - half4 _Shape3Tex_ST, _Shape3Color; - half _Shape3XSpeed, _Shape3YSpeed, _Shape3ColorWeight, _Shape3AlphaWeight; - #if SHAPE3CONTRAST_ON - half _Shape3Contrast, _Shape3Brightness; - #endif - #if SHAPE3DISTORT_ON - half4 _Shape3DistortTex_ST; - half _Shape3DistortAmount, _Shape3DistortXSpeed, _Shape3DistortYSpeed; - #endif - #if SHAPE3ROTATE_ON - half _Shape3RotationOffset, _Shape3RotationSpeed; - #endif - #if OFFSETSTREAM_ON - half _OffsetSh3; - #endif - #if SHAPEWEIGHTS_ON - half _Sh3BlendOffset; - #endif - #endif - - #if GLOW_ON - half4 _GlowColor; - half _Glow, _GlowGlobal; - #if GLOWTEX_ON - half4 _GlowTex_ST; - #endif - #endif - - #if MASK_ON - half4 _MaskTex_ST; - half _MaskPow; - #endif - - #if COLORRAMP_ON - half _ColorRampLuminosity, _ColorRampBlend; - #endif - - #if ALPHASMOOTHSTEP_ON - half _AlphaStepMin, _AlphaStepMax; - #endif - - #if ALPHAFADE_ON - half _AlphaFadeAmount, _AlphaFadeSmooth, _AlphaFadePow; - #endif - - #if HSV_ON - half _HsvShift, _HsvSaturation, _HsvBright; - #endif - - #if POSTERIZE_ON - half _PosterizeNumColors; - #endif - - #if PIXELATE_ON - half _PixelateSize; - #endif - - #if DISTORT_ON - half4 _DistortTex_ST; - half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; - #endif - - #if TEXTURESCROLL_ON - half _TextureScrollXSpeed, _TextureScrollYSpeed; - #endif - - #if SHAKEUV_ON - half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; - #endif - - #if WAVEUV_ON - half _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; - #endif - - #if ROUNDWAVEUV_ON - half _RoundWaveStrength, _RoundWaveSpeed; - #endif - - #if TWISTUV_ON - half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; - #endif - - #if DOODLE_ON - half _HandDrawnAmount, _HandDrawnSpeed; - #endif - - #if ROUNDWAVEUV_ON || PIXELATE_ON - half4 _MainTex_TexelSize; - #endif - - #if VERTOFFSET_ON - half4 _VertOffsetTex_ST; - half _VertOffsetAmount, _VertOffsetPower, _VertOffsetTexXSpeed, _VertOffsetTexYSpeed; - #endif - - #if FADE_ON - half4 _FadeTex_ST; - half _FadeAmount, _FadeTransition, _FadePower, _FadeScrollXSpeed, _FadeScrollYSpeed; - #if FADEBURN_ON - half4 _FadeBurnColor, _FadeBurnTex_ST; - half _FadeBurnWidth, _FadeBurnGlow; - #endif - #endif - - #if COLORGRADING_ON - half3 _ColorGradingLight, _ColorGradingMiddle, _ColorGradingDark; - half _ColorGradingMidPoint; - #endif - - #if CAMDISTFADE_ON - half _CamDistFadeStepMin, _CamDistFadeStepMax, _CamDistProximityFade; - #endif - - #if RIM_ON - half _RimBias, _RimScale, _RimPower, _RimIntensity, _RimAddAmount, _RimErodesAlpha; - half4 _RimColor; - #endif - - #if BACKFACETINT_ON - half4 _BackFaceTint, _FrontFaceTint; - #endif - - #if SHAPEDEBUG_ON - half _DebugShape; - #endif - - #if SHAPE1MASK_ON - half4 _Shape1MaskTex_ST; - half _Shape1MaskPow; - #endif - - #if TRAILWIDTH_ON - half _TrailWidthPower; - #endif - - #if LIGHTANDSHADOW_ON - half3 _All1VfxLightDir; - half _ShadowAmount, _ShadowStepMin, _ShadowStepMax, _LightAmount; - half4 _LightColor; - #endif - - #if SHAPETEXOFFSET_ON - half _RandomSh1Mult, _RandomSh2Mult, _RandomSh3Mult; - #endif - - #if DEPTHGLOW_ON - half _DepthGlowDist, _DepthGlowPow, _DepthGlow, _DepthGlowGlobal; - half4 _DepthGlowColor; - #endif - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half _ScreenUvShDistScale,_ScreenUvSh2DistScale, _ScreenUvSh3DistScale; - #endif - - #if NORMALMAP_ON - half _NormalStrength; - #endif - - - - - - - - - - - TEXTURE2D(_MainTex); - SAMPLER(sampler_MainTex); - - #if SHAPE1DISTORT_ON - TEXTURE2D(_ShapeDistortTex); - SAMPLER(sampler_ShapeDistortTex); - #endif - - #if SHAPE2_ON - TEXTURE2D(_Shape2Tex); - SAMPLER(sampler_Shape2Tex); - #if SHAPE2DISTORT_ON - TEXTURE2D(_Shape2DistortTex); - SAMPLER(sampler_Shape2DistortTex); - #endif - #endif - - #if SHAPE3_ON - TEXTURE2D(_Shape3Tex); - SAMPLER(sampler_Shape3Tex); - #if SHAPE3DISTORT_ON - TEXTURE2D(_Shape3DistortTex); - SAMPLER(sampler_Shape3DistortTex); - #endif - #endif - - #if GLOW_ON - #if GLOWTEX_ON - TEXTURE2D(_GlowTex); - SAMPLER(sampler_GlowTex); - #endif - #endif - - #if MASK_ON - TEXTURE2D(_MaskTex); - SAMPLER(sampler_MaskTex); - #endif - - #if COLORRAMP_ON - TEXTURE2D(_ColorRampTex); - SAMPLER(sampler_ColorRampTex); - #endif - - #if COLORRAMPGRAD_ON - TEXTURE2D(_ColorRampTexGradient); - SAMPLER(sampler_ColorRampTexGradient); - #endif - - #if DISTORT_ON - TEXTURE2D(_DistortTex); - SAMPLER(sampler_DistortTex); - #endif - - #if VERTOFFSET_ON - TEXTURE2D(_VertOffsetTex); - SAMPLER(sampler_VertOffsetTex); - #endif - - #if FADE_ON - TEXTURE2D(_FadeTex); - SAMPLER(sampler_FadeTex); - #if FADEBURN_ON - TEXTURE2D(_FadeBurnTex); - SAMPLER(sampler_FadeBurnTex); - #endif - #endif - - #if SHAPE1MASK_ON - TEXTURE2D(_Shape1MaskTex); - SAMPLER(sampler_Shape1MaskTex); - #endif - - #if TRAILWIDTH_ON - TEXTURE2D(_TrailWidthGradient); - SAMPLER(sampler_TrailWidthGradient); - #endif - - #if NORMALMAP_ON - TEXTURE2D(_NormalMap); - SAMPLER(sampler_NormalMap); - #endif - - half4 SampleTextureWithScroll(in Texture2D _tex, in SamplerState _sampler, in float2 uv, in half scrollXSpeed, in half scrollYSpeed, in float time) - { - half2 _uv = uv; - _uv.x += (time * scrollXSpeed) % 1; - _uv.y += (time * scrollYSpeed) % 1; - return SAMPLE_TEXTURE2D(_tex, _sampler, _uv); - } - - half EaseOutQuint(half x) - { - return 1 - pow(1 - x, 5); - } - - half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax) - { - return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); - } - - float2 RotateUvs(float2 uv, half rotation, half4 scaleAndTranslate) - { - half2 center = half2(0.5 * scaleAndTranslate.x + scaleAndTranslate.z, 0.5 * scaleAndTranslate.y + scaleAndTranslate.w); - half cosAngle = cos(rotation); - half sinAngle = sin(rotation); - uv -= center; - uv = mul(half2x2(cosAngle, -sinAngle, sinAngle, cosAngle), uv); - uv += center; - return uv; - } - - half4 GetDebugColor(float4 resColor, half4 shape1, half4 shape2, half4 shape3) - { - half4 res = resColor; - - //MAKE SURE THE FOLLOWING CODE BLOCK IS UNCOMMENTED------------------------------------------- - #if SHAPEDEBUG_ON - if(_DebugShape < 1.5) return shape1; - #if SHAPE2_ON - else if (_DebugShape < 2.5) return shape2; - #endif - #if SHAPE3_ON - else return shape3; - #endif - #endif - - return res; - } - - void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) - { - //uvDistTex --> extraV2F0 - //uvSh1DistTex --> extraV2F1 - //uvSh2DistTex --> extraV2F2 - //uvSh3DistTex --> extraV2F3 - - #if VERTOFFSET_ON - #if TIMEISCUSTOM_ON - const half time = v.texcoord0.z + globalCustomTime.y; - #else - const half time = v.texcoord0.z + _Time.y; - #endif - half4 offsetUv = half4(TRANSFORM_TEX(v.texcoord0.xy, _VertOffsetTex), 0, 0); - offsetUv.x += (time * _VertOffsetTexXSpeed) % 1; - offsetUv.y += (time * _VertOffsetTexYSpeed) % 1; - v.vertex.xyz += v.normal * _VertOffsetAmount * pow(SAMPLE_TEXTURE2D_LOD(_VertOffsetTex, sampler_VertOffsetTex, offsetUv, 0).r, _VertOffsetPower); - #endif - - #if DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F0.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); - #endif - - #if SHAPE1DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F1.xy = TRANSFORM_TEX(v.texcoord0.xy, _ShapeDistortTex); - #endif - - #if SHAPE2_ON - #if SHAPE2DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F2.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape2DistortTex);; - #endif - #endif - - #if SHAPE3_ON - #if SHAPE3DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F3.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape3DistortTex); - #endif - #endif - } - - void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) - { - //i.uvSeed -> d.texcoord0.xy - - float seed = d.texcoord0.z + _TimingSeed; - #if TIMEISCUSTOM_ON - const float4 shaderTime = globalCustomTime; - #else - const float4 shaderTime = _Time; - #endif - float time = shaderTime.y + seed; - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half2 originalUvs = d.texcoord0.xy; - #endif - - #if PIXELATE_ON - half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; - half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); - d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; - #endif - - #if NORMALMAP_ON - half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); - half3 normalTS = UnpackNormal(normalSample); - normalTS.xy *= _NormalStrength; - o.Normal = normalTS; - #endif - - #if TWISTUV_ON - half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); - _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; - half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; - half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; - half s = sin(theta); - half c = cos(theta); - half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); - tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); - tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); - d.texcoord0.xy = tempUv; - #endif - - #if DOODLE_ON - half2 uvCopy = d.texcoord0.xy; - _HandDrawnSpeed = (floor((shaderTime.x + seed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; - uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); - uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); - d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); - #endif - - #if SHAKEUV_ON - half xShake = sin((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvX; - half yShake = cos((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvY; - d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); - #endif - - #if WAVEUV_ON - half2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; - #if ATLAS_ON - uvWave = half2(_WaveX, _WaveY) - uvRect; - #endif - uvWave.x *= _ScreenParams.x / _ScreenParams.y; - half angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((time * _WaveSpeed) % 360.0); - d.texcoord0.xy = d.texcoord0.xy + normalize(uvWave) * sin(angWave) * (_WaveStrength / 1000.0); - #endif - - #if ROUNDWAVEUV_ON - half xWave = ((0.5 * _MainTex_ST.x) - d.texcoord0.x); - half yWave = ((0.5 * _MainTex_ST.y) - d.texcoord0.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); - half ripple = -sqrt(xWave*xWave + yWave* yWave); - d.texcoord0.xy += (sin((ripple + time * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; - #endif - - #if POLARUV_ON - half2 prePolarUvs = d.texcoord0.xy; - d.texcoord0.xy = d.texcoord0.xy - half2(0.5, 0.5); - d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (1.0 * 6.28318530718), length(d.texcoord0.xy) * 2.0); - d.texcoord0.xy *= _MainTex_ST.xy; - #endif - - #if DISTORT_ON - #if POLARUVDISTORT_ON - half2 distortUvs = TRANSFORM_TEX(d.texcoord0.xy, _DistortTex); - #else - half2 distortUvs = d.extraV2F0.xy; - #endif - distortUvs.x += ((shaderTime.x + seed) * _DistortTexXSpeed) % 1; - distortUvs.y += ((shaderTime.x + seed) * _DistortTexYSpeed) % 1; - #if ATLAS_ON - d.extraV2F0.xy = half2((d.extraV2F0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.extraV2F0.y - _MinYUV) / (_MaxYUV - _MinYUV)); - #endif - half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, distortUvs).r - 0.5) * 0.2 * _DistortAmount; - d.texcoord0.x += distortAmnt; - d.texcoord0.y += distortAmnt; - #endif - - #if TEXTURESCROLL_ON - d.texcoord0.x += (time * _TextureScrollXSpeed) % 1; - d.texcoord0.y += (time * _TextureScrollYSpeed) % 1; - #endif - - #if TRAILWIDTH_ON - half width = pow(SAMPLE_TEXTURE2D(_TrailWidthGradient, sampler_TrailWidthGradient, d.texcoord0).r, _TrailWidthPower); - d.texcoord0.y = (d.texcoord0.y * 2 - 1) / width * 0.5 + 0.5; - clip(d.texcoord0.y); - clip(1 - d.texcoord0.y); - #endif - - float2 shape1Uv = d.texcoord0.xy; - #if SHAPE2_ON - float2 shape2Uv = shape1Uv; - #endif - #if SHAPE3_ON - float2 shape3Uv = shape1Uv; - #endif - - #if CAMDISTFADE_ON || SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half camDistance = distance(d.worldSpacePosition, _WorldSpaceCameraPos); - #endif - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half2 uvOffsetPostFx = d.texcoord0.xy - originalUvs; - d.texcoord0.xy = d.screenPos.xy / d.screenPos.w; - d.texcoord0.x = d.texcoord0.x * (_ScreenParams.x / _ScreenParams.y); - d.texcoord0.x -= 0.5; - d.texcoord0.xy -= uvOffsetPostFx; - originalUvs += uvOffsetPostFx; - half distanceZoom = camDistance * 0.1; - half2 scaleWithDistUvs = d.texcoord0.xy * distanceZoom + ((-distanceZoom * 0.5) + 0.5); - #if SHAPE1SCREENUV_ON - shape1Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvShDistScale); - #else - shape1Uv = originalUvs; - #endif - #if SHAPE2SCREENUV_ON && SHAPE2_ON - shape2Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh2DistScale); - #else - #if SHAPE2_ON - shape2Uv = originalUvs; - #endif - #endif - #if SHAPE3SCREENUV_ON && SHAPE3_ON - shape3Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh3DistScale); - #else - #if SHAPE3_ON - shape3Uv = originalUvs; - #endif - #endif - #endif - - shape1Uv = TRANSFORM_TEX(shape1Uv, _MainTex); - #if OFFSETSTREAM_ON - shape1Uv.x += i.offsetCustomData.x * _OffsetSh1; - shape1Uv.y += i.offsetCustomData.y * _OffsetSh1; - #endif - #if SHAPETEXOFFSET_ON - shape1Uv += seed * _RandomSh1Mult; - #endif - - #if SHAPE1DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh1DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _ShapeDistortTex); - #else - half2 sh1DistortUvs = d.extraV2F1.xy; - #endif - - sh1DistortUvs.x += ((time + seed) * _ShapeDistortXSpeed) % 1; - sh1DistortUvs.y += ((time + seed) * _ShapeDistortYSpeed) % 1; - half distortAmount = (SAMPLE_TEXTURE2D(_ShapeDistortTex, sampler_ShapeDistortTex, sh1DistortUvs).r - 0.5) * 0.2 * _ShapeDistortAmount; - shape1Uv.x += distortAmount; - shape1Uv.y += distortAmount; - #endif - #if SHAPE1ROTATE_ON - shape1Uv = RotateUvs(shape1Uv, _ShapeRotationOffset + ((_ShapeRotationSpeed * time) % 6.28318530718), _MainTex_ST); - #endif - - half4 shape1 = SampleTextureWithScroll(_MainTex, sampler_MainTex, shape1Uv, _ShapeXSpeed, _ShapeYSpeed, time); - #if SHAPE1SHAPECOLOR_ON - shape1.a = shape1.r; - shape1.rgb = _ShapeColor.rgb; - #else - shape1 *= _ShapeColor; - #endif - #if SHAPE1CONTRAST_ON - #if SHAPE1SHAPECOLOR_ON - shape1.a = saturate((shape1.a - 0.5) * _ShapeContrast + 0.5 + _ShapeBrightness); - #else - shape1.rgb = max(0, (shape1.rgb - half3(0.5, 0.5, 0.5)) * _ShapeContrast + half3(0.5, 0.5, 0.5) + _ShapeBrightness); - #endif - #endif - - half4 shape2 = 1.0; - #if SHAPE2_ON - shape2Uv = TRANSFORM_TEX(shape2Uv, _Shape2Tex); - #if OFFSETSTREAM_ON - shape2Uv.x += i.offsetCustomData.x * _OffsetSh2; - shape2Uv.y += i.offsetCustomData.y * _OffsetSh2; - #endif - #if SHAPETEXOFFSET_ON - shape2Uv += seed * _RandomSh2Mult; - #endif - #if SHAPE2DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh2DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape2DistortTex); - #else - half2 sh2DistortUvs = d.extraV2F2.xy; - #endif - sh2DistortUvs.x += ((time + seed) * _Shape2DistortXSpeed) % 1; - sh2DistortUvs.y += ((time + seed) * _Shape2DistortYSpeed) % 1; - half distortAmnt2 = (SAMPLE_TEXTURE2D(_Shape2DistortTex, sampler_Shape2DistortTex, sh2DistortUvs).r - 0.5) * 0.2 * _Shape2DistortAmount; - shape2Uv.x += distortAmnt2; - shape2Uv.y += distortAmnt2; - #endif - #if SHAPE2ROTATE_ON - shape2Uv = RotateUvs(shape2Uv, _Shape2RotationOffset + ((_Shape2RotationSpeed * time) % 6.28318530718), _Shape2Tex_ST); - #endif - - shape2 = SampleTextureWithScroll(_Shape2Tex, sampler_Shape2Tex, shape2Uv, _Shape2XSpeed, _Shape2YSpeed, time); - #if SHAPE2SHAPECOLOR_ON - shape2.a = shape2.r; - shape2.rgb = _Shape2Color.rgb; - #else - shape2 *= _Shape2Color; - #endif - #if SHAPE2CONTRAST_ON - #if SHAPE2SHAPECOLOR_ON - shape2.a = max(0, (shape2.a - 0.5) * _Shape2Contrast + 0.5 + _Shape2Brightness); - #else - shape2.rgb = max(0, (shape2.rgb - half3(0.5, 0.5, 0.5)) * _Shape2Contrast + half3(0.5, 0.5, 0.5) + _Shape2Brightness); - #endif - #endif - #endif - - half4 shape3 = 1.0; - #if SHAPE3_ON - shape3Uv = TRANSFORM_TEX(shape3Uv, _Shape3Tex); - - #if OFFSETSTREAM_ON - shape3Uv.x += i.offsetCustomData.x * _OffsetSh3; - shape3Uv.y += i.offsetCustomData.y * _OffsetSh3; - #endif - #if SHAPETEXOFFSET_ON - shape3Uv += seed * _RandomSh3Mult; - #endif - #if SHAPE3DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh3DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape3DistortTex); - #else - half2 sh3DistortUvs = d.extraV2F3.xy; - #endif - sh3DistortUvs.x += ((time + seed) * _Shape3DistortXSpeed) % 1; - sh3DistortUvs.y += ((time + seed) * _Shape3DistortYSpeed) % 1; - half distortAmnt3 = (SAMPLE_TEXTURE2D(_Shape3DistortTex, sampler_Shape3DistortTex, sh3DistortUvs).r - 0.5) * 0.3 * _Shape3DistortAmount; - shape3Uv.x += distortAmnt3; - shape3Uv.y += distortAmnt3; - #endif - #if SHAPE3ROTATE_ON - shape3Uv = RotateUvs(shape3Uv, _Shape3RotationOffset + ((_Shape3RotationSpeed * time) % 6.28318530718), _Shape3Tex_ST); - #endif - shape3 = SampleTextureWithScroll(_Shape3Tex, sampler_Shape3Tex, shape3Uv, _Shape3XSpeed, _Shape3YSpeed, time); - #if SHAPE3SHAPECOLOR_ON - shape3.a = shape3.r; - shape3.rgb = _Shape3Color.rgb; - #else - shape3 *= _Shape3Color; - #endif - #if SHAPE3CONTRAST_ON - #if SHAPE3SHAPECOLOR_ON - shape3.a = max(0, (shape3.a - 0.5) * _Shape3Contrast + 0.5 + _Shape3Brightness); - #else - shape3.rgb = max(0, (shape3.rgb - half3(0.5, 0.5, 0.5)) * _Shape3Contrast + half3(0.5, 0.5, 0.5) + _Shape3Brightness); - #endif - #endif - #endif - - half4 col = shape1; - //Mix all shapes pre: change weights if custom vertex effect active - #if SHAPEWEIGHTS_ON - half shapeWeightOffset; - #if SHAPE2_ON - shapeWeightOffset = i.offsetCustomData.z * _Sh1BlendOffset; - _ShapeColorWeight = max(0, _ShapeColorWeight + shapeWeightOffset); - _ShapeAlphaWeight = max(0, _ShapeAlphaWeight + shapeWeightOffset); - shapeWeightOffset = i.offsetCustomData.z * _Sh2BlendOffset; - _Shape2ColorWeight = max(0, _Shape2ColorWeight + shapeWeightOffset); - _Shape2AlphaWeight = max(0, _Shape2AlphaWeight + shapeWeightOffset); - #endif - #if SHAPE3_ON - shapeWeightOffset = i.offsetCustomData.z * _Sh3BlendOffset; - _Shape3ColorWeight = max(0, _Shape3ColorWeight + shapeWeightOffset); - _Shape3AlphaWeight = max(0, _Shape3AlphaWeight + shapeWeightOffset); - #endif - #endif - - //Mix all shapes - #if SHAPE2_ON - #if !SPLITRGBA_ON - _ShapeAlphaWeight = _ShapeColorWeight; - _Shape2AlphaWeight = _Shape2ColorWeight; - #endif - #if SHAPE3_ON //Shape3 On - #if !SPLITRGBA_ON - _Shape3AlphaWeight = _Shape3ColorWeight; - #endif - #if SHAPEADD_ON - col.rgb = ((shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight)) + (shape3.rgb * _Shape3ColorWeight); - col.a = saturate(max(shape3.a * _Shape3AlphaWeight, max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight))); - #else - col.rgb = ((shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight)) * (shape3.rgb * _Shape3ColorWeight); - col.a = saturate(((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)) * (shape3.a * _Shape3AlphaWeight)); - #endif - #else //Shape3 Off - #if SHAPEADD_ON - col.rgb = (shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight); - col.a = saturate(max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight)); - #else - col.rgb = (shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight); - col.a = saturate((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)); - #endif - #endif - #endif - - #if SHAPE1MASK_ON - col = lerp(col, shape1, pow(SAMPLE_TEXTURE2D(_Shape1MaskTex, sampler_Shape1MaskTex, TRANSFORM_TEX(i.uvSeed.xy, _Shape1MaskTex)).r, _Shape1MaskPow)); - #endif - - #if PREMULTIPLYCOLOR_ON - half luminance = 0; - luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; - luminance *= col.a; - col.a = min(luminance, col.a); - #endif - - col.rgb *= _Color.rgb * d.vertexColor.rgb; - #if PREMULTIPLYALPHA_ON - col.rgb *= col.a; - #endif - - #if !PREMULTIPLYCOLOR_ON && (COLORRAMP_ON || ALPHAFADE_ON || COLORGRADING_ON || FADE_ON || (ADDITIVECONFIG_ON && (GLOW_ON || DEPTHGLOW_ON))) - half luminance = 0; - luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; - luminance *= col.a; - #endif - - #if (FADE_ON || ALPHAFADE_ON) && ALPHAFADEINPUTSTREAM_ON - col.a *= d.vertexColor.a; - d.vertexColor.a = d.texcoord0.w; - #endif - - #if FADE_ON - half preFadeAlpha = col.a; - _FadeAmount = saturate(_FadeAmount + (1 - d.vertexColor.a)); - _FadeTransition = max(0.01, _FadeTransition * EaseOutQuint(saturate(_FadeAmount))); - half2 fadeUv; - fadeUv = d.texcoord0.xy + seed; - fadeUv.x += (time * _FadeScrollXSpeed) % 1; - fadeUv.y += (time * _FadeScrollYSpeed) % 1; - half2 tiledUvFade1 = TRANSFORM_TEX(fadeUv, _FadeTex); - #if ADDITIVECONFIG_ON && !PREMULTIPLYCOLOR_ON - preFadeAlpha *= luminance; - #endif - _FadeAmount = saturate(pow(_FadeAmount, _FadePower)); - #if FADEBURN_ON - half2 tiledUvFade2 = TRANSFORM_TEX(fadeUv, _FadeBurnTex); - half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; - half fadeNaturalEdge = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - col.a *= fadeNaturalEdge; - half fadeBurn = saturate(smoothstep(0.0 , _FadeTransition + _FadeBurnWidth, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - fadeBurn = fadeNaturalEdge - fadeBurn; - _FadeBurnColor.rgb *= _FadeBurnGlow; - col.rgb += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2).rgb * _FadeBurnColor.rgb * preFadeAlpha; - #else - half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; - float fade = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - col.a *= fade; - #endif - #if ALPHAFADETRANSPARENCYTOO_ON - col.a *= 1 - _FadeAmount; - #endif - #endif - - #if ALPHAFADE_ON - half alphaFadeLuminance; - _AlphaFadeAmount = saturate(_AlphaFadeAmount + (1 - d.vertexColor.a)); - _AlphaFadeAmount = saturate(pow(_AlphaFadeAmount, _AlphaFadePow)); - _AlphaFadeSmooth = max(0.01, _AlphaFadeSmooth * EaseOutQuint(saturate(_AlphaFadeAmount))); - #if ALPHAFADEUSESHAPE1_ON - alphaFadeLuminance = shape1.r; - #else - alphaFadeLuminance = luminance; - #endif - alphaFadeLuminance = saturate(alphaFadeLuminance - 0.001); - #if ALPHAFADEUSEREDCHANNEL_ON - col.a *= col.r; - #endif - col.a = saturate(col.a); - float alphaFade = saturate(smoothstep(0.0 , _AlphaFadeSmooth, RemapFloat(1.0 - _AlphaFadeAmount, 0.0, 1.0, -1.0, 1.0) + alphaFadeLuminance)); - col.a *= alphaFade; - #if ALPHAFADETRANSPARENCYTOO_ON - col.a *= 1 - _AlphaFadeAmount; - #endif - #endif - - #if BACKFACETINT_ON - col.rgb = lerp(col.rgb * _BackFaceTint, col.rgb * _FrontFaceTint, step(0, dot(d.worldSpaceNormal, d.worldSpaceViewDir))); - #endif - - //#if LIGHTANDSHADOW_ON - //half NdL = saturate(dot(d.worldSpaceNormal, -_All1VfxLightDir)); - //col.rgb += _LightColor * _LightAmount * NdL; - //NdL = max(_ShadowAmount, NdL); - //NdL = smoothstep(_ShadowStepMin, _ShadowStepMax, NdL); - //col.rgb *= NdL; - //#endif - - #if COLORGRADING_ON - col.rgb *= lerp(lerp(_ColorGradingDark, _ColorGradingMiddle, luminance/_ColorGradingMidPoint), - lerp(_ColorGradingMiddle, _ColorGradingLight, (luminance - _ColorGradingMidPoint)/(1.0 - _ColorGradingMidPoint)), step(_ColorGradingMidPoint, luminance)); - #endif - - #if COLORRAMP_ON - half colorRampLuminance = saturate(luminance + _ColorRampLuminosity); - #if COLORRAMPGRAD_ON - half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(colorRampLuminance, 0)); - #else - half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(colorRampLuminance, 0)); - #endif - col.rgb = lerp(col.rgb, colorRampRes.rgb, _ColorRampBlend); - col.a = lerp(col.a, saturate(col.a * colorRampRes.a), _ColorRampBlend); - #endif - - #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON - col.rgb = floor(col.rgb / (1.0 / _PosterizeNumColors)) * (1.0 / _PosterizeNumColors); - #endif - - #if DEPTHGLOW_ON - half sceneDepthDiff = GetLinearEyeDepth(d.screenUV) - d.screenPos.w; - #endif - - #if RIM_ON - half NdV = 1 - abs(dot(d.worldSpaceNormal, d.worldSpaceViewDir)); - half rimFactor = saturate(_RimBias + _RimScale * pow(NdV, _RimPower)); - half4 rimCol = _RimColor * rimFactor; - rimCol.rgb *= _RimIntensity; - col.rgb = lerp(col.rgb * (rimCol.rgb + half3(1,1,1)), col.rgb + rimCol.rgb, _RimAddAmount); - col.a = saturate(col.a * (1 - rimFactor * _RimErodesAlpha)); - #endif - - #if DEPTHGLOW_ON - half depthGlowMask = saturate(_DepthGlowDist * pow((1 - sceneDepthDiff), _DepthGlowPow)); - col.rgb = lerp(col.rgb, _DepthGlowGlobal * col.rgb, depthGlowMask); - half depthGlowMult = 1; - #if ADDITIVECONFIG_ON - depthGlowMult = luminance; - #endif - col.rgb += _DepthGlowColor.rgb * _DepthGlow * depthGlowMask * col.a * depthGlowMult; - #endif - - #if GLOW_ON - half glowMask = 1; - #if GLOWTEX_ON - glowMask = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, TRANSFORM_TEX(d.texcoord0.xy, _GlowTex)); - #endif - col.rgb *= _GlowGlobal * glowMask; - half glowMult = 1; - #if ADDITIVECONFIG_ON - glowMult = luminance; - #endif - - col.rgb += _GlowColor.rgb * _Glow * glowMask * col.a * glowMult; - #endif - - #if HSV_ON - half3 resultHsv = half3(col.rgb); - half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); - half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); - resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x - + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y - + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; - resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x - + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y - + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; - resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x - + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y - + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; - col.rgb = resultHsv; - #endif - - #if CAMDISTFADE_ON - col.a *= 1 - saturate(smoothstep(_CamDistFadeStepMin, _CamDistFadeStepMax, camDistance)); - col.a *= smoothstep(0.0, _CamDistProximityFade, camDistance); - #endif - - #if MASK_ON - half2 maskUv = d.texcoord0.xy; - #if POLARUV_ON - maskUv = prePolarUvs; - #endif - half4 maskSample = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, TRANSFORM_TEX(maskUv, _MaskTex)); - half mask = pow(min(maskSample.r, maskSample.a), _MaskPow); - col.a *= mask; - #endif - - #if ALPHASMOOTHSTEP_ON - col.a = smoothstep(_AlphaStepMin, _AlphaStepMax, col.a); - #endif - - half4 debugColor = col; - #if SHAPEDEBUG_ON - debugColor = GetDebugColor(col, shape1, shape2, shape3); - #endif - - clip(debugColor.a - _AlphaCutoffValue - 0.01); - - //#if FOG_ON - //UNITY_APPLY_FOG(i.fogCoord, col); - //#endif - - //Don't use a starting i.color.a lower than 1 unless using vertex stream dissolve when using a FADE effect - #if !FADE_ON && !ALPHAFADE_ON - col.a *= _Alpha * d.vertexColor.a; - #endif - #if FADE_ON || ALPHAFADE_ON - col.a *= _Alpha; - #endif - #if ADDITIVECONFIG_ON - col.rgb *= col.a; - #endif - - - #if SHAPEDEBUG_ON - o.Albedo = debugColor.rgb; - o.Alpha = debugColor.a; - #else - o.Albedo = col.rgb; - o.Alpha = col.a; - #endif - } - - - - - - void ChainSurfaceFunction(inout Surface l, inout ShaderData d) - { - Ext_SurfaceFunction0(l, d); - // Ext_SurfaceFunction1(l, d); - // Ext_SurfaceFunction2(l, d); - // Ext_SurfaceFunction3(l, d); - // Ext_SurfaceFunction4(l, d); - // Ext_SurfaceFunction5(l, d); - // Ext_SurfaceFunction6(l, d); - // Ext_SurfaceFunction7(l, d); - // Ext_SurfaceFunction8(l, d); - // Ext_SurfaceFunction9(l, d); - // Ext_SurfaceFunction10(l, d); - // Ext_SurfaceFunction11(l, d); - // Ext_SurfaceFunction12(l, d); - // Ext_SurfaceFunction13(l, d); - // Ext_SurfaceFunction14(l, d); - // Ext_SurfaceFunction15(l, d); - // Ext_SurfaceFunction16(l, d); - // Ext_SurfaceFunction17(l, d); - // Ext_SurfaceFunction18(l, d); - // Ext_SurfaceFunction19(l, d); - // Ext_SurfaceFunction20(l, d); - // Ext_SurfaceFunction21(l, d); - // Ext_SurfaceFunction22(l, d); - // Ext_SurfaceFunction23(l, d); - // Ext_SurfaceFunction24(l, d); - // Ext_SurfaceFunction25(l, d); - // Ext_SurfaceFunction26(l, d); - // Ext_SurfaceFunction27(l, d); - // Ext_SurfaceFunction28(l, d); - // Ext_SurfaceFunction29(l, d); - } - -#if !_DECALSHADER - - void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) - { - ExtraV2F d; - - ZERO_INITIALIZE(ExtraV2F, d); - ZERO_INITIALIZE(Blackboard, d.blackboard); - // due to motion vectors in HDRP, we need to use the last - // time in certain spots. So if you are going to use _Time to adjust vertices, - // you need to use this time or motion vectors will break. - d.time = time; - - Ext_ModifyVertex0(v, d); - // Ext_ModifyVertex1(v, d); - // Ext_ModifyVertex2(v, d); - // Ext_ModifyVertex3(v, d); - // Ext_ModifyVertex4(v, d); - // Ext_ModifyVertex5(v, d); - // Ext_ModifyVertex6(v, d); - // Ext_ModifyVertex7(v, d); - // Ext_ModifyVertex8(v, d); - // Ext_ModifyVertex9(v, d); - // Ext_ModifyVertex10(v, d); - // Ext_ModifyVertex11(v, d); - // Ext_ModifyVertex12(v, d); - // Ext_ModifyVertex13(v, d); - // Ext_ModifyVertex14(v, d); - // Ext_ModifyVertex15(v, d); - // Ext_ModifyVertex16(v, d); - // Ext_ModifyVertex17(v, d); - // Ext_ModifyVertex18(v, d); - // Ext_ModifyVertex19(v, d); - // Ext_ModifyVertex20(v, d); - // Ext_ModifyVertex21(v, d); - // Ext_ModifyVertex22(v, d); - // Ext_ModifyVertex23(v, d); - // Ext_ModifyVertex24(v, d); - // Ext_ModifyVertex25(v, d); - // Ext_ModifyVertex26(v, d); - // Ext_ModifyVertex27(v, d); - // Ext_ModifyVertex28(v, d); - // Ext_ModifyVertex29(v, d); - - - // #if %EXTRAV2F0REQUIREKEY% - v2p.extraV2F0 = d.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - v2p.extraV2F1 = d.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - v2p.extraV2F2 = d.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - v2p.extraV2F3 = d.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // v2p.extraV2F4 = d.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // v2p.extraV2F5 = d.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // v2p.extraV2F6 = d.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // v2p.extraV2F7 = d.extraV2F7; - // #endif - } - - void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) - { - ExtraV2F d; - ZERO_INITIALIZE(ExtraV2F, d); - ZERO_INITIALIZE(Blackboard, d.blackboard); - - // #if %EXTRAV2F0REQUIREKEY% - d.extraV2F0 = v2p.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - d.extraV2F1 = v2p.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - d.extraV2F2 = v2p.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - d.extraV2F3 = v2p.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // d.extraV2F4 = v2p.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // d.extraV2F5 = v2p.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // d.extraV2F6 = v2p.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // d.extraV2F7 = v2p.extraV2F7; - // #endif - - - // Ext_ModifyTessellatedVertex0(v, d); - // Ext_ModifyTessellatedVertex1(v, d); - // Ext_ModifyTessellatedVertex2(v, d); - // Ext_ModifyTessellatedVertex3(v, d); - // Ext_ModifyTessellatedVertex4(v, d); - // Ext_ModifyTessellatedVertex5(v, d); - // Ext_ModifyTessellatedVertex6(v, d); - // Ext_ModifyTessellatedVertex7(v, d); - // Ext_ModifyTessellatedVertex8(v, d); - // Ext_ModifyTessellatedVertex9(v, d); - // Ext_ModifyTessellatedVertex10(v, d); - // Ext_ModifyTessellatedVertex11(v, d); - // Ext_ModifyTessellatedVertex12(v, d); - // Ext_ModifyTessellatedVertex13(v, d); - // Ext_ModifyTessellatedVertex14(v, d); - // Ext_ModifyTessellatedVertex15(v, d); - // Ext_ModifyTessellatedVertex16(v, d); - // Ext_ModifyTessellatedVertex17(v, d); - // Ext_ModifyTessellatedVertex18(v, d); - // Ext_ModifyTessellatedVertex19(v, d); - // Ext_ModifyTessellatedVertex20(v, d); - // Ext_ModifyTessellatedVertex21(v, d); - // Ext_ModifyTessellatedVertex22(v, d); - // Ext_ModifyTessellatedVertex23(v, d); - // Ext_ModifyTessellatedVertex24(v, d); - // Ext_ModifyTessellatedVertex25(v, d); - // Ext_ModifyTessellatedVertex26(v, d); - // Ext_ModifyTessellatedVertex27(v, d); - // Ext_ModifyTessellatedVertex28(v, d); - // Ext_ModifyTessellatedVertex29(v, d); - - // #if %EXTRAV2F0REQUIREKEY% - v2p.extraV2F0 = d.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - v2p.extraV2F1 = d.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - v2p.extraV2F2 = d.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - v2p.extraV2F3 = d.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // v2p.extraV2F4 = d.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // v2p.extraV2F5 = d.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // v2p.extraV2F6 = d.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // v2p.extraV2F7 = d.extraV2F7; - // #endif - } - - void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) - { - // Ext_FinalColorForward0(l, d, color); - // Ext_FinalColorForward1(l, d, color); - // Ext_FinalColorForward2(l, d, color); - // Ext_FinalColorForward3(l, d, color); - // Ext_FinalColorForward4(l, d, color); - // Ext_FinalColorForward5(l, d, color); - // Ext_FinalColorForward6(l, d, color); - // Ext_FinalColorForward7(l, d, color); - // Ext_FinalColorForward8(l, d, color); - // Ext_FinalColorForward9(l, d, color); - // Ext_FinalColorForward10(l, d, color); - // Ext_FinalColorForward11(l, d, color); - // Ext_FinalColorForward12(l, d, color); - // Ext_FinalColorForward13(l, d, color); - // Ext_FinalColorForward14(l, d, color); - // Ext_FinalColorForward15(l, d, color); - // Ext_FinalColorForward16(l, d, color); - // Ext_FinalColorForward17(l, d, color); - // Ext_FinalColorForward18(l, d, color); - // Ext_FinalColorForward19(l, d, color); - // Ext_FinalColorForward20(l, d, color); - // Ext_FinalColorForward21(l, d, color); - // Ext_FinalColorForward22(l, d, color); - // Ext_FinalColorForward23(l, d, color); - // Ext_FinalColorForward24(l, d, color); - // Ext_FinalColorForward25(l, d, color); - // Ext_FinalColorForward26(l, d, color); - // Ext_FinalColorForward27(l, d, color); - // Ext_FinalColorForward28(l, d, color); - // Ext_FinalColorForward29(l, d, color); - } - - void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) - { - // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - } -#endif - - - - - -#if _DECALSHADER - - ShaderData CreateShaderData(SurfaceDescriptionInputs IN) - { - ShaderData d = (ShaderData)0; - d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); - d.worldSpaceNormal = IN.WorldSpaceNormal; - d.worldSpaceTangent = IN.WorldSpaceTangent; - - d.worldSpacePosition = IN.WorldSpacePosition; - d.texcoord0 = IN.uv0.xyxy; - d.screenPos = IN.ScreenPosition; - - d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); - - d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); - - // these rarely get used, so we back transform them. Usually will be stripped. - #if _HDRP - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; - #else - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; - #endif - // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); - // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); - - // #if %SCREENPOSREQUIREKEY% - d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); - // #endif - - return d; - } -#else - - ShaderData CreateShaderData(VertexToPixel i - #if NEED_FACING - , bool facing - #endif - ) - { - ShaderData d = (ShaderData)0; - d.clipPos = i.pos; - d.worldSpacePosition = i.worldPos; - - d.worldSpaceNormal = normalize(i.worldNormal); - d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); - - d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; - float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; - - d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); - d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); - - d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); - d.texcoord0 = i.texcoord0; - // d.texcoord1 = i.texcoord1; - // d.texcoord2 = i.texcoord2; - - // #if %TEXCOORD3REQUIREKEY% - // d.texcoord3 = i.texcoord3; - // #endif - - // d.isFrontFace = facing; - // #if %VERTEXCOLORREQUIREKEY% - d.vertexColor = i.vertexColor; - // #endif - - // these rarely get used, so we back transform them. Usually will be stripped. - #if _HDRP - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; - #else - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; - #endif - // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); - // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); - - // #if %SCREENPOSREQUIREKEY% - d.screenPos = i.screenPos; - d.screenUV = (i.screenPos.xy / i.screenPos.w); - // #endif - - - // #if %EXTRAV2F0REQUIREKEY% - d.extraV2F0 = i.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - d.extraV2F1 = i.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - d.extraV2F2 = i.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - d.extraV2F3 = i.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // d.extraV2F4 = i.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // d.extraV2F5 = i.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // d.extraV2F6 = i.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // d.extraV2F7 = i.extraV2F7; - // #endif - - return d; - } - -#endif - - - // vertex shader - VertexToPixel Vert (VertexData v) - { - UNITY_SETUP_INSTANCE_ID(v); - VertexToPixel o; - UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); - UNITY_TRANSFER_INSTANCE_ID(v,o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - -#if !_TESSELLATION_ON - ChainModifyVertex(v, o, _Time); -#endif - - o.texcoord0 = v.texcoord0; - // o.texcoord1 = v.texcoord1; - // o.texcoord2 = v.texcoord2; - - // #if %TEXCOORD3REQUIREKEY% - // o.texcoord3 = v.texcoord3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - o.vertexColor = v.vertexColor; - // #endif - - - - o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; - o.worldNormal = UnityObjectToWorldNormal(v.normal); - o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); - - - // sets o.pos, so do screenpos after. - TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) - - // #if %SCREENPOSREQUIREKEY% - o.screenPos = ComputeScreenPos(o.pos); - // #endif - - return o; - } - - - - // fragment shader - fixed4 Frag (VertexToPixel IN - #ifdef _DEPTHOFFSET_ON - , out float outputDepth : SV_Depth - #endif - #if NEED_FACING - , bool facing : SV_IsFrontFace - #endif - ) : SV_Target - { - UNITY_SETUP_INSTANCE_ID(IN); - // prepare and unpack data - - #ifdef FOG_COMBINED_WITH_TSPACE - UNITY_EXTRACT_FOG_FROM_TSPACE(IN); - #elif defined (FOG_COMBINED_WITH_WORLD_POS) - UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); - #else - UNITY_EXTRACT_FOG(IN); - #endif - - #ifndef USING_DIRECTIONAL_LIGHT - fixed3 lightDir = normalize(UnityWorldSpaceLightDir(IN.worldPos)); - #else - fixed3 lightDir = _WorldSpaceLightPos0.xyz; - #endif - - - - ShaderData d = CreateShaderData(IN - #if NEED_FACING - , facing - #endif - ); - - Surface l = (Surface)0; - - #ifdef _DEPTHOFFSET_ON - l.outputDepth = outputDepth; - #endif - - l.Albedo = half3(0.5, 0.5, 0.5); - l.Normal = float3(0,0,1); - l.Occlusion = 1; - l.Alpha = 1; - - ChainSurfaceFunction(l, d); - - #ifdef _DEPTHOFFSET_ON - outputDepth = l.outputDepth; - #endif - - SHADOW_CASTER_FRAGMENT(IN) - } - - - ENDCG - - } - - - // ---- meta information extraction pass: - Pass - { - Name "Meta" - Tags { "LightMode" = "Meta" } - Cull Off - - Tags - { - "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" - } - Cull [_CullingOption] - ZWrite [_ZWrite] - ZTest [_ZTestMode] - ColorMask [_ColorMask] -Lighting Off - - - CGPROGRAM - - #pragma vertex Vert - #pragma fragment Frag - - // compile directives - #pragma target 3.0 - #pragma multi_compile_instancing - #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2 - #pragma shader_feature EDITOR_VISUALIZATION - - #include "HLSLSupport.cginc" - #define UNITY_INSTANCED_LOD_FADE - #define UNITY_INSTANCED_SH - #define UNITY_INSTANCED_LIGHTMAPSTS - #include "UnityShaderVariables.cginc" - #include "UnityShaderUtilities.cginc" - - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - #include "UnityMetaPass.cginc" - - #define _PASSMETA 1 - - - #pragma shader_feature_local TIMEISCUSTOM_ON - #pragma shader_feature_local ADDITIVECONFIG_ON - #pragma shader_feature_local PREMULTIPLYALPHA_ON - #pragma shader_feature_local PREMULTIPLYCOLOR_ON - #pragma shader_feature_local SPLITRGBA_ON - #pragma shader_feature_local SHAPEADD_ON - - #pragma shader_feature_local SHAPE1SCREENUV_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local SHAPE2SCREENUV_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local SHAPE3SCREENUV_ON /////////////////Pipeline specific implementation - - #pragma shader_feature_local SHAPEDEBUG_ON - - #pragma shader_feature_local SHAPE1CONTRAST_ON - #pragma shader_feature_local SHAPE1DISTORT_ON - #pragma shader_feature_local SHAPE1ROTATE_ON - #pragma shader_feature_local SHAPE1SHAPECOLOR_ON - - #pragma shader_feature_local SHAPE2_ON - #pragma shader_feature_local SHAPE2CONTRAST_ON - #pragma shader_feature_local SHAPE2DISTORT_ON - #pragma shader_feature_local SHAPE2ROTATE_ON - #pragma shader_feature_local SHAPE2SHAPECOLOR_ON - - #pragma shader_feature_local SHAPE3_ON - #pragma shader_feature_local SHAPE3CONTRAST_ON - #pragma shader_feature_local SHAPE3DISTORT_ON - #pragma shader_feature_local SHAPE3ROTATE_ON - #pragma shader_feature_local SHAPE3SHAPECOLOR_ON - - #pragma shader_feature_local GLOW_ON - #pragma shader_feature_local GLOWTEX_ON - #pragma shader_feature_local DEPTHGLOW_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local MASK_ON - #pragma shader_feature_local COLORRAMP_ON - #pragma shader_feature_local COLORRAMPGRAD_ON - #pragma shader_feature_local COLORGRADING_ON - #pragma shader_feature_local HSV_ON - #pragma shader_feature_local POSTERIZE_ON - #pragma shader_feature_local PIXELATE_ON - #pragma shader_feature_local DISTORT_ON - #pragma shader_feature_local SHAKEUV_ON - #pragma shader_feature_local WAVEUV_ON - #pragma shader_feature_local ROUNDWAVEUV_ON - #pragma shader_feature_local TWISTUV_ON - #pragma shader_feature_local DOODLE_ON - #pragma shader_feature_local OFFSETSTREAM_ON - #pragma shader_feature_local TEXTURESCROLL_ON - #pragma shader_feature_local VERTOFFSET_ON - #pragma shader_feature_local RIM_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local BACKFACETINT_ON /////////////////Pipeline specific implementation - #pragma shader_feature_local POLARUV_ON - #pragma shader_feature_local POLARUVDISTORT_ON - #pragma shader_feature_local SHAPE1MASK_ON - #pragma shader_feature_local TRAILWIDTH_ON - #pragma shader_feature_local LIGHTANDSHADOW_ON - #pragma shader_feature_local SHAPETEXOFFSET_ON - #pragma shader_feature_local SHAPEWEIGHTS_ON - - #pragma shader_feature_local ALPHACUTOFF_ON - #pragma shader_feature_local ALPHASMOOTHSTEP_ON - #pragma shader_feature_local FADE_ON - #pragma shader_feature_local FADEBURN_ON - #pragma shader_feature_local ALPHAFADE_ON - #pragma shader_feature_local ALPHAFADEUSESHAPE1_ON - #pragma shader_feature_local ALPHAFADEUSEREDCHANNEL_ON - #pragma shader_feature_local ALPHAFADETRANSPARENCYTOO_ON - #pragma shader_feature_local ALPHAFADEINPUTSTREAM_ON - #pragma shader_feature_local CAMDISTFADE_ON - - #pragma shader_feature NORMALMAP_ON - - - #define _STANDARD 1 -// If your looking in here and thinking WTF, yeah, I know. These are taken from the SRPs, to allow us to use the same -// texturing library they use. However, since they are not included in the standard pipeline by default, there is no -// way to include them in and they have to be inlined, since someone could copy this shader onto another machine without -// Better Shaders installed. Unfortunate, but I'd rather do this and have a nice library for texture sampling instead -// of the patchy one Unity provides being inlined/emulated in HDRP/URP. Strangely, PSSL and XBoxOne libraries are not -// included in the standard SRP code, but they are in tons of Unity own projects on the web, so I grabbed them from there. - -#if defined(SHADER_API_GAMECORE) - - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) PLATFORM_SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) PLATFORM_SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) PLATFORM_SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) PLATFORM_SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) PLATFORM_SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) PLATFORM_SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) PLATFORM_SAMPLE_TEXTURE3D(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) PLATFORM_SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r - #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_XBOXONE) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - -#elif defined(SHADER_API_PSSL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.GetLOD(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RW_Texture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RW_Texture2D_Array textureName - #define RW_TEXTURE3D(type, textureName) RW_Texture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - - - -#elif defined(SHADER_API_D3D11) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_METAL) - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_VULKAN) -// This file assume SHADER_API_VULKAN is defined - // TODO: This is a straight copy from D3D11.hlsl. Go through all this stuff and adjust where needed. - - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_SWITCH) - // This file assume SHADER_API_SWITCH is defined - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - -#elif defined(SHADER_API_GLCORE) - - // OpenGL 4.1 SM 5.0 https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 46) - #define OPENGL4_1_SM5 1 - #else - #define OPENGL4_1_SM5 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName) - #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName) - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - - #if OPENGL4_1_SM5 - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #endif - - - #elif defined(SHADER_API_GLES3) - - // GLES 3.1 + AEP shader feature https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html - #if (SHADER_TARGET >= 40) - #define GLES3_1_AEP 1 - #else - #define GLES3_1_AEP 0 - #endif - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) textureName.CalculateLevelOfDetail(samplerName, coord2) - - // Texture abstraction - - #define TEXTURE2D(textureName) Texture2D textureName - #define TEXTURE2D_ARRAY(textureName) Texture2DArray textureName - #define TEXTURECUBE(textureName) TextureCube textureName - #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName - #define TEXTURE3D(textureName) Texture3D textureName - - #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName - - #define TEXTURE2D_HALF(textureName) Texture2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray textureName // no support to _float on Array, it's being added - #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray textureName // no support to _float on Array, it's being added - #define TEXTURE3D_HALF(textureName) Texture3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName) - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName) - #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName) - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName) - - #if GLES3_1_AEP - #define RW_TEXTURE2D(type, textureName) RWTexture2D textureName - #define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray textureName - #define RW_TEXTURE3D(type, textureName) RWTexture3D textureName - #else - #define RW_TEXTURE2D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - #endif - - #define SAMPLER(samplerName) SamplerState samplerName - #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName - - #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName) - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName) - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName) - #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName) - - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName) - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName) - #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName) - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName - - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod) - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) textureName.SampleGrad(samplerName, coord2, ddx, ddy) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index)) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias) - - #ifdef UNITY_NO_CUBEMAP_ARRAY - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #else - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index)) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias)textureName.SampleBias(samplerName, float4(coord3, index), bias) - #endif - - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w) - - - #define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0)) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod)) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0)) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod)) - #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0)) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod)) - - #if GLES3_1_AEP - #define PLATFORM_SUPPORT_GATHER - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index)) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index)) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2) - #else - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - #endif - - -#elif defined(SHADER_API_GLES) - - - #define uint int - - #define rcp(x) 1.0 / (x) - #define ddx_fine ddx - #define ddy_fine ddy - #define asfloat - #define asuint(x) asint(x) - #define f32tof16 - #define f16tof32 - - #define ERROR_ON_UNSUPPORTED_FUNCTION(funcName) #error #funcName is not supported on GLES 2.0 - - // Initialize arbitrary structure with zero values. - // Do not exist on some platform, in this case we need to have a standard name that call a function that will initialize all parameters to 0 - #define ZERO_INITIALIZE(type, name) name = (type)0; - #define ZERO_INITIALIZE_ARRAY(type, name, arraySize) { for (int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++) { name[arrayIndex] = (type)0; } } - - - // Texture util abstraction - - #define CALCULATE_TEXTURE2D_LOD(textureName, samplerName, coord2) #error calculate Level of Detail not supported in GLES2 - - // Texture abstraction - - #define TEXTURE2D(textureName) sampler2D textureName - #define TEXTURE2D_ARRAY(textureName) samplerCUBE textureName // No support to texture2DArray - #define TEXTURECUBE(textureName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY(textureName) samplerCUBE textureName // No supoport to textureCubeArray and can't emulate with texture2DArray - #define TEXTURE3D(textureName) sampler3D textureName - - #define TEXTURE2D_FLOAT(textureName) sampler2D_float textureName - #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to texture2DArray - #define TEXTURECUBE_FLOAT(textureName) samplerCUBE_float textureName - #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_FLOAT(textureName) // No support to textureCubeArray - #define TEXTURE3D_FLOAT(textureName) sampler3D_float textureName - - #define TEXTURE2D_HALF(textureName) sampler2D_half textureName - #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to texture2DArray - #define TEXTURECUBE_HALF(textureName) samplerCUBE_half textureName - #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_HALF(textureName) // No support to textureCubeArray - #define TEXTURE3D_HALF(textureName) sampler3D_half textureName - - #define TEXTURE2D_SHADOW(textureName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - #define TEXTURECUBE_SHADOW(textureName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_SHADOW(textureName) // No support to texture array - - #define RW_TEXTURE2D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2D) - #define RW_TEXTURE2D_ARRAY(type, textureName) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture2DArray) - #define RW_TEXTURE3D(type, textureNam) ERROR_ON_UNSUPPORTED_FUNCTION(RWTexture3D) - - #define SAMPLER(samplerName) - #define SAMPLER_CMP(samplerName) - - #define TEXTURE2D_PARAM(textureName, samplerName) sampler2D textureName - #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) samplerCUBE textureName - #define TEXTURE3D_PARAM(textureName, samplerName) sampler3D textureName - #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) SHADOW2D_TEXTURE_AND_SAMPLER textureName - #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) SHADOWCUBE_TEXTURE_AND_SAMPLER textureName - - #define TEXTURE2D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName - #define TEXTURE3D_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName - #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName - - #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2) - - #if (SHADER_TARGET >= 30) - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0, lod)) - #else - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, lod) - #endif - - #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) tex2Dbias(textureName, float4(coord2, 0, bias)) - #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, ddx, ddy) SAMPLE_TEXTURE2D(textureName, samplerName, coord2) - #define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY) - #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_LOD) - #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_BIAS) - #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_GRAD) - #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) texCUBE(textureName, coord3) - // No lod support. Very poor approximation with bias. - #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, lod) - #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) texCUBEbias(textureName, float4(coord3, bias)) - #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY) - #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_LOD) - #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_BIAS) - #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3) - #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE3D_LOD) - - #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) SHADOW2D_SAMPLE(textureName, samplerName, coord3) - #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURE2D_ARRAY_SHADOW) - #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) SHADOWCUBE_SAMPLE(textureName, samplerName, coord4) - #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) ERROR_ON_UNSUPPORTED_FUNCTION(SAMPLE_TEXTURECUBE_ARRAY_SHADOW) - - - // Not supported. Can't define as error because shader library is calling these functions. - #define LOAD_TEXTURE2D(textureName, unCoord2) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) half4(0, 0, 0, 0) - #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) half4(0, 0, 0, 0) - #define LOAD_TEXTURE3D(textureName, unCoord3) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D) - #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) ERROR_ON_UNSUPPORTED_FUNCTION(LOAD_TEXTURE3D_LOD) - - // Gather not supported. Fallback to regular texture sampling. - #define GATHER_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D) - #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURE2D_ARRAY) - #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE) - #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_TEXTURECUBE_ARRAY) - #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_RED_TEXTURE2D) - #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_GREEN_TEXTURE2D) - #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_BLUE_TEXTURE2D) - #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) ERROR_ON_UNSUPPORTED_FUNCTION(GATHER_ALPHA_TEXTURE2D) - -#else -#error unsupported shader api -#endif - - - - -// default flow control attributes -#ifndef UNITY_BRANCH -# define UNITY_BRANCH -#endif -#ifndef UNITY_FLATTEN -# define UNITY_FLATTEN -#endif -#ifndef UNITY_UNROLL -# define UNITY_UNROLL -#endif -#ifndef UNITY_UNROLLX -# define UNITY_UNROLLX(_x) -#endif -#ifndef UNITY_LOOP -# define UNITY_LOOP -#endif - - - - - - - - // data across stages, stripped like the above. - struct VertexToPixel - { - UNITY_POSITION(pos); - float3 worldPos : TEXCOORD0; - float3 worldNormal : TEXCOORD1; - float4 worldTangent : TEXCOORD2; - float4 texcoord0 : TEXCOORD3; - // float4 texcoord1 : TEXCOORD4; - // float4 texcoord2 : TEXCOORD5; - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD6; - // #endif - - // #if %SCREENPOSREQUIREKEY% - float4 screenPos : TEXCOORD7; - // #endif - - #ifdef EDITOR_VISUALIZATION - float2 vizUV : TEXCOORD8; - float4 lightCoord : TEXCOORD9; - #endif - - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - // #if %EXTRAV2F0REQUIREKEY% - float4 extraV2F0 : TEXCOORD10; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - float4 extraV2F1 : TEXCOORD11; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - float4 extraV2F2 : TEXCOORD12; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - float4 extraV2F3 : TEXCOORD13; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // float4 extraV2F4 : TEXCOORD14; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // float4 extraV2F5 : TEXCOORD15; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // float4 extraV2F6 : TEXCOORD16; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // float4 extraV2F7 : TEXCOORD17; - // #endif - - - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - }; - - - - // data describing the user output of a pixel - struct Surface - { - half3 Albedo; - half Height; - half3 Normal; - half Smoothness; - half3 Emission; - half Metallic; - half3 Specular; - half Occlusion; - half SpecularPower; // for simple lighting - half Alpha; - float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value - // HDRP Only - half SpecularOcclusion; - half SubsurfaceMask; - half Thickness; - half CoatMask; - half CoatSmoothness; - half Anisotropy; - half IridescenceMask; - half IridescenceThickness; - int DiffusionProfileHash; - float SpecularAAThreshold; - float SpecularAAScreenSpaceVariance; - // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines - float3 DiffuseGI; - float3 BackDiffuseGI; - float3 SpecularGI; - float ior; - float3 transmittanceColor; - float atDistance; - float transmittanceMask; - // requires _OVERRIDE_SHADOWMASK to be defines - float4 ShadowMask; - - // for decals - float NormalAlpha; - float MAOSAlpha; - - - }; - - // Data the user declares in blackboard blocks - struct Blackboard - { - - float blackboardDummyData; - }; - - // data the user might need, this will grow to be big. But easy to strip - struct ShaderData - { - float4 clipPos; // SV_POSITION - float3 localSpacePosition; - float3 localSpaceNormal; - float3 localSpaceTangent; - - float3 worldSpacePosition; - float3 worldSpaceNormal; - float3 worldSpaceTangent; - float tangentSign; - - float3 worldSpaceViewDir; - float3 tangentSpaceViewDir; - - float4 texcoord0; - float4 texcoord1; - float4 texcoord2; - float4 texcoord3; - - float2 screenUV; - float4 screenPos; - - float4 vertexColor; - bool isFrontFace; - - float4 extraV2F0; - float4 extraV2F1; - float4 extraV2F2; - float4 extraV2F3; - float4 extraV2F4; - float4 extraV2F5; - float4 extraV2F6; - float4 extraV2F7; - - float3x3 TBNMatrix; - Blackboard blackboard; - }; - - struct VertexData - { - #if SHADER_TARGET > 30 - // uint vertexID : SV_VertexID; - #endif - float4 vertex : POSITION; - float3 normal : NORMAL; - float4 tangent : TANGENT; - float4 texcoord0 : TEXCOORD0; - - // optimize out mesh coords when not in use by user or lighting system - #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) - float4 texcoord1 : TEXCOORD1; - #endif - - #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) - float4 texcoord2 : TEXCOORD2; - #endif - - #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) - float4 texcoord1 : TEXCOORD1; - #endif - #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) - float4 texcoord2 : TEXCOORD2; - #endif - - - #if _HDRP - float4 texcoord1 : TEXCOORD1; - float4 texcoord2 : TEXCOORD2; - #endif - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) - float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) - #if defined (_ADD_PRECOMPUTED_VELOCITY) - float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). - #endif - #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - }; - - struct TessVertex - { - float4 vertex : INTERNALTESSPOS; - float3 normal : NORMAL; - float4 tangent : TANGENT; - float4 texcoord0 : TEXCOORD0; - float4 texcoord1 : TEXCOORD1; - float4 texcoord2 : TEXCOORD2; - - // #if %TEXCOORD3REQUIREKEY% - // float4 texcoord3 : TEXCOORD3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - float4 vertexColor : COLOR; - // #endif - - // #if %EXTRAV2F0REQUIREKEY% - float4 extraV2F0 : TEXCOORD5; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - float4 extraV2F1 : TEXCOORD6; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - float4 extraV2F2 : TEXCOORD7; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - float4 extraV2F3 : TEXCOORD8; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // float4 extraV2F4 : TEXCOORD9; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // float4 extraV2F5 : TEXCOORD10; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // float4 extraV2F6 : TEXCOORD11; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // float4 extraV2F7 : TEXCOORD12; - // #endif - - #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) - float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) - #if defined (_ADD_PRECOMPUTED_VELOCITY) - float3 precomputedVelocity : TEXCOORD14; - #endif - #endif - - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - }; - - struct ExtraV2F - { - float4 extraV2F0; - float4 extraV2F1; - float4 extraV2F2; - float4 extraV2F3; - float4 extraV2F4; - float4 extraV2F5; - float4 extraV2F6; - float4 extraV2F7; - Blackboard blackboard; - float4 time; - }; - - - float3 WorldToTangentSpace(ShaderData d, float3 normal) - { - return mul(d.TBNMatrix, normal); - } - - float3 TangentToWorldSpace(ShaderData d, float3 normal) - { - return mul(normal, d.TBNMatrix); - } - - // in this case, make standard more like SRPs, because we can't fix - // unity_WorldToObject in HDRP, since it already does macro-fu there - - #if _STANDARD - float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; - float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; - float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; - float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; - float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } - float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } - #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) - #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) - #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); #else - #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) - #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif - #undef UNITY_MATRIX_I_M + // #if %SCREENPOSREQUIREKEY% + o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif - #define UNITY_MATRIX_I_M unity_WorldToObject - - - #endif - - float3 GetCameraWorldPosition() - { - #if _HDRP - return GetCameraRelativePositionWS(_WorldSpaceCameraPos); - #else - return _WorldSpaceCameraPos; - #endif - } - - #if _GRABPASSUSED - #if _STANDARD - TEXTURE2D(%GRABTEXTURE%); - SAMPLER(sampler_%GRABTEXTURE%); - #endif - - half3 GetSceneColor(float2 uv) - { - #if _STANDARD - return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; - #else - return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); - #endif - } - #endif - - - - #if _STANDARD - UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); - float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } - float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } - float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } - #else - float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } - float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } - float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } - #endif - - float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) - { - float eye = GetLinearEyeDepth(uv); - float3 camView = mul((float3x3)UNITY_MATRIX_M, transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) [2].xyz); - - float dt = dot(worldSpaceViewDir, camView); - float3 div = worldSpaceViewDir/dt; - float3 wpos = (eye * div) + GetCameraWorldPosition(); - return wpos; - } - - #if _HDRP - float3 ObjectToWorldSpacePosition(float3 pos) - { - return GetAbsolutePositionWS(TransformObjectToWorld(pos)); - } - #else - float3 ObjectToWorldSpacePosition(float3 pos) - { - return TransformObjectToWorld(pos); - } - #endif - - #if _STANDARD - UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); - float3 norms = DecodeViewNormalStereo(depthNorms); - norms = mul((float3x3)UNITY_MATRIX_V, norms) * 0.5 + 0.5; - return norms; - } - #elif _HDRP && !_DECALSHADER - - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - NormalData nd; - DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); - return nd.normalWS; - } - #elif _URP - #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) - #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" - #endif - - float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) - { - #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) - return SampleSceneNormals(uv); - #else - float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); - return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; - #endif - - } - #endif - - #if _HDRP - - half3 UnpackNormalmapRGorAG(half4 packednormal) - { - // This do the trick - packednormal.x *= packednormal.w; - - half3 normal; - normal.xy = packednormal.xy * 2 - 1; - normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); - return normal; - } - half3 UnpackNormal(half4 packednormal) - { - #if defined(UNITY_NO_DXT5nm) - return packednormal.xyz * 2 - 1; - #else - return UnpackNormalmapRGorAG(packednormal); - #endif - } - #endif - #if _HDRP || _URP - - half3 UnpackScaleNormal(half4 packednormal, half scale) - { - #ifndef UNITY_NO_DXT5nm - // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) - // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 - packednormal.x *= packednormal.w; - #endif - half3 normal; - normal.xy = (packednormal.xy * 2 - 1) * scale; - normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); - return normal; - } - - #endif - - - void GetSun(out float3 lightDir, out float3 color) - { - lightDir = float3(0.5, 0.5, 0); - color = 1; - #if _HDRP - if (_DirectionalLightCount > 0) - { - DirectionalLightData light = _DirectionalLightDatas[0]; - lightDir = -light.forward.xyz; - color = light.color; - } - #elif _STANDARD - lightDir = normalize(_WorldSpaceLightPos0.xyz); - color = _LightColor0.rgb; - #elif _URP - Light light = GetMainLight(); - lightDir = light.direction; - color = light.color; - #endif - } - - - - - half4 _Color; - half _Alpha; - half _AlphaCutoffValue; - - half _TimingSeed; - - #if TIMEISCUSTOM_ON - float4 globalCustomTime; - #endif - - half4 _MainTex_ST, _ShapeColor; - half _ShapeXSpeed, _ShapeYSpeed, _ShapeColorWeight, _ShapeAlphaWeight; - - #if SHAPE1CONTRAST_ON - half _ShapeContrast, _ShapeBrightness; - #endif - - #if SHAPE1DISTORT_ON - half4 _ShapeDistortTex_ST; - half _ShapeDistortAmount, _ShapeDistortXSpeed, _ShapeDistortYSpeed; - #endif - - #if SHAPE1ROTATE_ON - half _ShapeRotationOffset, _ShapeRotationSpeed; - #endif - - #if OFFSETSTREAM_ON - half _OffsetSh1; - #endif - - #if SHAPEWEIGHTS_ON - half _Sh1BlendOffset; - #endif - - #if SHAPE2_ON - half4 _Shape2Tex_ST, _Shape2Color; - half _Shape2XSpeed, _Shape2YSpeed, _Shape2ColorWeight, _Shape2AlphaWeight; - #if SHAPE2CONTRAST_ON - half _Shape2Contrast, _Shape2Brightness; - #endif - #if SHAPE2DISTORT_ON - half4 _Shape2DistortTex_ST; - half _Shape2DistortAmount, _Shape2DistortXSpeed, _Shape2DistortYSpeed; - #endif - #if SHAPE2ROTATE_ON - half _Shape2RotationOffset, _Shape2RotationSpeed; - #endif - #if OFFSETSTREAM_ON - half _OffsetSh2; - #endif - #if SHAPEWEIGHTS_ON - half _Sh2BlendOffset; - #endif - #endif - - #if SHAPE3_ON - half4 _Shape3Tex_ST, _Shape3Color; - half _Shape3XSpeed, _Shape3YSpeed, _Shape3ColorWeight, _Shape3AlphaWeight; - #if SHAPE3CONTRAST_ON - half _Shape3Contrast, _Shape3Brightness; - #endif - #if SHAPE3DISTORT_ON - half4 _Shape3DistortTex_ST; - half _Shape3DistortAmount, _Shape3DistortXSpeed, _Shape3DistortYSpeed; - #endif - #if SHAPE3ROTATE_ON - half _Shape3RotationOffset, _Shape3RotationSpeed; - #endif - #if OFFSETSTREAM_ON - half _OffsetSh3; - #endif - #if SHAPEWEIGHTS_ON - half _Sh3BlendOffset; - #endif - #endif - - #if GLOW_ON - half4 _GlowColor; - half _Glow, _GlowGlobal; - #if GLOWTEX_ON - half4 _GlowTex_ST; - #endif - #endif - - #if MASK_ON - half4 _MaskTex_ST; - half _MaskPow; - #endif - - #if COLORRAMP_ON - half _ColorRampLuminosity, _ColorRampBlend; - #endif - - #if ALPHASMOOTHSTEP_ON - half _AlphaStepMin, _AlphaStepMax; - #endif - - #if ALPHAFADE_ON - half _AlphaFadeAmount, _AlphaFadeSmooth, _AlphaFadePow; - #endif - - #if HSV_ON - half _HsvShift, _HsvSaturation, _HsvBright; - #endif - - #if POSTERIZE_ON - half _PosterizeNumColors; - #endif - - #if PIXELATE_ON - half _PixelateSize; - #endif - - #if DISTORT_ON - half4 _DistortTex_ST; - half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; - #endif - - #if TEXTURESCROLL_ON - half _TextureScrollXSpeed, _TextureScrollYSpeed; - #endif - - #if SHAKEUV_ON - half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; - #endif - - #if WAVEUV_ON - half _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; - #endif - - #if ROUNDWAVEUV_ON - half _RoundWaveStrength, _RoundWaveSpeed; - #endif - - #if TWISTUV_ON - half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; - #endif - - #if DOODLE_ON - half _HandDrawnAmount, _HandDrawnSpeed; - #endif - - #if ROUNDWAVEUV_ON || PIXELATE_ON - half4 _MainTex_TexelSize; - #endif - - #if VERTOFFSET_ON - half4 _VertOffsetTex_ST; - half _VertOffsetAmount, _VertOffsetPower, _VertOffsetTexXSpeed, _VertOffsetTexYSpeed; - #endif - - #if FADE_ON - half4 _FadeTex_ST; - half _FadeAmount, _FadeTransition, _FadePower, _FadeScrollXSpeed, _FadeScrollYSpeed; - #if FADEBURN_ON - half4 _FadeBurnColor, _FadeBurnTex_ST; - half _FadeBurnWidth, _FadeBurnGlow; - #endif - #endif - - #if COLORGRADING_ON - half3 _ColorGradingLight, _ColorGradingMiddle, _ColorGradingDark; - half _ColorGradingMidPoint; - #endif - - #if CAMDISTFADE_ON - half _CamDistFadeStepMin, _CamDistFadeStepMax, _CamDistProximityFade; - #endif - - #if RIM_ON - half _RimBias, _RimScale, _RimPower, _RimIntensity, _RimAddAmount, _RimErodesAlpha; - half4 _RimColor; - #endif - - #if BACKFACETINT_ON - half4 _BackFaceTint, _FrontFaceTint; - #endif - - #if SHAPEDEBUG_ON - half _DebugShape; - #endif - - #if SHAPE1MASK_ON - half4 _Shape1MaskTex_ST; - half _Shape1MaskPow; - #endif - - #if TRAILWIDTH_ON - half _TrailWidthPower; - #endif - - #if LIGHTANDSHADOW_ON - half3 _All1VfxLightDir; - half _ShadowAmount, _ShadowStepMin, _ShadowStepMax, _LightAmount; - half4 _LightColor; - #endif - - #if SHAPETEXOFFSET_ON - half _RandomSh1Mult, _RandomSh2Mult, _RandomSh3Mult; - #endif - - #if DEPTHGLOW_ON - half _DepthGlowDist, _DepthGlowPow, _DepthGlow, _DepthGlowGlobal; - half4 _DepthGlowColor; - #endif - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half _ScreenUvShDistScale,_ScreenUvSh2DistScale, _ScreenUvSh3DistScale; - #endif - - #if NORMALMAP_ON - half _NormalStrength; - #endif - - - - - - - - - - - TEXTURE2D(_MainTex); - SAMPLER(sampler_MainTex); - - #if SHAPE1DISTORT_ON - TEXTURE2D(_ShapeDistortTex); - SAMPLER(sampler_ShapeDistortTex); - #endif - - #if SHAPE2_ON - TEXTURE2D(_Shape2Tex); - SAMPLER(sampler_Shape2Tex); - #if SHAPE2DISTORT_ON - TEXTURE2D(_Shape2DistortTex); - SAMPLER(sampler_Shape2DistortTex); - #endif - #endif - - #if SHAPE3_ON - TEXTURE2D(_Shape3Tex); - SAMPLER(sampler_Shape3Tex); - #if SHAPE3DISTORT_ON - TEXTURE2D(_Shape3DistortTex); - SAMPLER(sampler_Shape3DistortTex); - #endif - #endif - - #if GLOW_ON - #if GLOWTEX_ON - TEXTURE2D(_GlowTex); - SAMPLER(sampler_GlowTex); - #endif - #endif - - #if MASK_ON - TEXTURE2D(_MaskTex); - SAMPLER(sampler_MaskTex); - #endif - - #if COLORRAMP_ON - TEXTURE2D(_ColorRampTex); - SAMPLER(sampler_ColorRampTex); - #endif - - #if COLORRAMPGRAD_ON - TEXTURE2D(_ColorRampTexGradient); - SAMPLER(sampler_ColorRampTexGradient); - #endif - - #if DISTORT_ON - TEXTURE2D(_DistortTex); - SAMPLER(sampler_DistortTex); - #endif - - #if VERTOFFSET_ON - TEXTURE2D(_VertOffsetTex); - SAMPLER(sampler_VertOffsetTex); - #endif - - #if FADE_ON - TEXTURE2D(_FadeTex); - SAMPLER(sampler_FadeTex); - #if FADEBURN_ON - TEXTURE2D(_FadeBurnTex); - SAMPLER(sampler_FadeBurnTex); - #endif - #endif - - #if SHAPE1MASK_ON - TEXTURE2D(_Shape1MaskTex); - SAMPLER(sampler_Shape1MaskTex); - #endif - - #if TRAILWIDTH_ON - TEXTURE2D(_TrailWidthGradient); - SAMPLER(sampler_TrailWidthGradient); - #endif - - #if NORMALMAP_ON - TEXTURE2D(_NormalMap); - SAMPLER(sampler_NormalMap); - #endif - - half4 SampleTextureWithScroll(in Texture2D _tex, in SamplerState _sampler, in float2 uv, in half scrollXSpeed, in half scrollYSpeed, in float time) - { - half2 _uv = uv; - _uv.x += (time * scrollXSpeed) % 1; - _uv.y += (time * scrollYSpeed) % 1; - return SAMPLE_TEXTURE2D(_tex, _sampler, _uv); - } - - half EaseOutQuint(half x) - { - return 1 - pow(1 - x, 5); - } - - half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax) - { - return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); - } - - float2 RotateUvs(float2 uv, half rotation, half4 scaleAndTranslate) - { - half2 center = half2(0.5 * scaleAndTranslate.x + scaleAndTranslate.z, 0.5 * scaleAndTranslate.y + scaleAndTranslate.w); - half cosAngle = cos(rotation); - half sinAngle = sin(rotation); - uv -= center; - uv = mul(half2x2(cosAngle, -sinAngle, sinAngle, cosAngle), uv); - uv += center; - return uv; - } - - half4 GetDebugColor(float4 resColor, half4 shape1, half4 shape2, half4 shape3) - { - half4 res = resColor; - - //MAKE SURE THE FOLLOWING CODE BLOCK IS UNCOMMENTED------------------------------------------- - #if SHAPEDEBUG_ON - if(_DebugShape < 1.5) return shape1; - #if SHAPE2_ON - else if (_DebugShape < 2.5) return shape2; - #endif - #if SHAPE3_ON - else return shape3; - #endif - #endif - - return res; - } - - void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) - { - //uvDistTex --> extraV2F0 - //uvSh1DistTex --> extraV2F1 - //uvSh2DistTex --> extraV2F2 - //uvSh3DistTex --> extraV2F3 - - #if VERTOFFSET_ON - #if TIMEISCUSTOM_ON - const half time = v.texcoord0.z + globalCustomTime.y; - #else - const half time = v.texcoord0.z + _Time.y; - #endif - half4 offsetUv = half4(TRANSFORM_TEX(v.texcoord0.xy, _VertOffsetTex), 0, 0); - offsetUv.x += (time * _VertOffsetTexXSpeed) % 1; - offsetUv.y += (time * _VertOffsetTexYSpeed) % 1; - v.vertex.xyz += v.normal * _VertOffsetAmount * pow(SAMPLE_TEXTURE2D_LOD(_VertOffsetTex, sampler_VertOffsetTex, offsetUv, 0).r, _VertOffsetPower); - #endif - - #if DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F0.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); - #endif - - #if SHAPE1DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F1.xy = TRANSFORM_TEX(v.texcoord0.xy, _ShapeDistortTex); - #endif - - #if SHAPE2_ON - #if SHAPE2DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F2.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape2DistortTex);; - #endif - #endif - - #if SHAPE3_ON - #if SHAPE3DISTORT_ON && !POLARUVDISTORT_ON - d.extraV2F3.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape3DistortTex); - #endif - #endif - } - - void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) - { - //i.uvSeed -> d.texcoord0.xy - - float seed = d.texcoord0.z + _TimingSeed; - #if TIMEISCUSTOM_ON - const float4 shaderTime = globalCustomTime; - #else - const float4 shaderTime = _Time; - #endif - float time = shaderTime.y + seed; - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half2 originalUvs = d.texcoord0.xy; - #endif - - #if PIXELATE_ON - half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; - half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); - d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; - #endif - - #if NORMALMAP_ON - half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); - half3 normalTS = UnpackNormal(normalSample); - normalTS.xy *= _NormalStrength; - o.Normal = normalTS; - #endif - - #if TWISTUV_ON - half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); - _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; - half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; - half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; - half s = sin(theta); - half c = cos(theta); - half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); - tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); - tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); - d.texcoord0.xy = tempUv; - #endif - - #if DOODLE_ON - half2 uvCopy = d.texcoord0.xy; - _HandDrawnSpeed = (floor((shaderTime.x + seed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; - uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); - uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); - d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); - #endif - - #if SHAKEUV_ON - half xShake = sin((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvX; - half yShake = cos((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvY; - d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); - #endif - - #if WAVEUV_ON - half2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; - #if ATLAS_ON - uvWave = half2(_WaveX, _WaveY) - uvRect; - #endif - uvWave.x *= _ScreenParams.x / _ScreenParams.y; - half angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((time * _WaveSpeed) % 360.0); - d.texcoord0.xy = d.texcoord0.xy + normalize(uvWave) * sin(angWave) * (_WaveStrength / 1000.0); - #endif - - #if ROUNDWAVEUV_ON - half xWave = ((0.5 * _MainTex_ST.x) - d.texcoord0.x); - half yWave = ((0.5 * _MainTex_ST.y) - d.texcoord0.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); - half ripple = -sqrt(xWave*xWave + yWave* yWave); - d.texcoord0.xy += (sin((ripple + time * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; - #endif - - #if POLARUV_ON - half2 prePolarUvs = d.texcoord0.xy; - d.texcoord0.xy = d.texcoord0.xy - half2(0.5, 0.5); - d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (1.0 * 6.28318530718), length(d.texcoord0.xy) * 2.0); - d.texcoord0.xy *= _MainTex_ST.xy; - #endif - - #if DISTORT_ON - #if POLARUVDISTORT_ON - half2 distortUvs = TRANSFORM_TEX(d.texcoord0.xy, _DistortTex); - #else - half2 distortUvs = d.extraV2F0.xy; - #endif - distortUvs.x += ((shaderTime.x + seed) * _DistortTexXSpeed) % 1; - distortUvs.y += ((shaderTime.x + seed) * _DistortTexYSpeed) % 1; - #if ATLAS_ON - d.extraV2F0.xy = half2((d.extraV2F0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.extraV2F0.y - _MinYUV) / (_MaxYUV - _MinYUV)); - #endif - half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, distortUvs).r - 0.5) * 0.2 * _DistortAmount; - d.texcoord0.x += distortAmnt; - d.texcoord0.y += distortAmnt; - #endif - - #if TEXTURESCROLL_ON - d.texcoord0.x += (time * _TextureScrollXSpeed) % 1; - d.texcoord0.y += (time * _TextureScrollYSpeed) % 1; - #endif - - #if TRAILWIDTH_ON - half width = pow(SAMPLE_TEXTURE2D(_TrailWidthGradient, sampler_TrailWidthGradient, d.texcoord0).r, _TrailWidthPower); - d.texcoord0.y = (d.texcoord0.y * 2 - 1) / width * 0.5 + 0.5; - clip(d.texcoord0.y); - clip(1 - d.texcoord0.y); - #endif - - float2 shape1Uv = d.texcoord0.xy; - #if SHAPE2_ON - float2 shape2Uv = shape1Uv; - #endif - #if SHAPE3_ON - float2 shape3Uv = shape1Uv; - #endif - - #if CAMDISTFADE_ON || SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half camDistance = distance(d.worldSpacePosition, _WorldSpaceCameraPos); - #endif - - #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON - half2 uvOffsetPostFx = d.texcoord0.xy - originalUvs; - d.texcoord0.xy = d.screenPos.xy / d.screenPos.w; - d.texcoord0.x = d.texcoord0.x * (_ScreenParams.x / _ScreenParams.y); - d.texcoord0.x -= 0.5; - d.texcoord0.xy -= uvOffsetPostFx; - originalUvs += uvOffsetPostFx; - half distanceZoom = camDistance * 0.1; - half2 scaleWithDistUvs = d.texcoord0.xy * distanceZoom + ((-distanceZoom * 0.5) + 0.5); - #if SHAPE1SCREENUV_ON - shape1Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvShDistScale); - #else - shape1Uv = originalUvs; - #endif - #if SHAPE2SCREENUV_ON && SHAPE2_ON - shape2Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh2DistScale); - #else - #if SHAPE2_ON - shape2Uv = originalUvs; - #endif - #endif - #if SHAPE3SCREENUV_ON && SHAPE3_ON - shape3Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh3DistScale); - #else - #if SHAPE3_ON - shape3Uv = originalUvs; - #endif - #endif - #endif - - shape1Uv = TRANSFORM_TEX(shape1Uv, _MainTex); - #if OFFSETSTREAM_ON - shape1Uv.x += i.offsetCustomData.x * _OffsetSh1; - shape1Uv.y += i.offsetCustomData.y * _OffsetSh1; - #endif - #if SHAPETEXOFFSET_ON - shape1Uv += seed * _RandomSh1Mult; - #endif - - #if SHAPE1DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh1DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _ShapeDistortTex); - #else - half2 sh1DistortUvs = d.extraV2F1.xy; - #endif - - sh1DistortUvs.x += ((time + seed) * _ShapeDistortXSpeed) % 1; - sh1DistortUvs.y += ((time + seed) * _ShapeDistortYSpeed) % 1; - half distortAmount = (SAMPLE_TEXTURE2D(_ShapeDistortTex, sampler_ShapeDistortTex, sh1DistortUvs).r - 0.5) * 0.2 * _ShapeDistortAmount; - shape1Uv.x += distortAmount; - shape1Uv.y += distortAmount; - #endif - #if SHAPE1ROTATE_ON - shape1Uv = RotateUvs(shape1Uv, _ShapeRotationOffset + ((_ShapeRotationSpeed * time) % 6.28318530718), _MainTex_ST); - #endif - - half4 shape1 = SampleTextureWithScroll(_MainTex, sampler_MainTex, shape1Uv, _ShapeXSpeed, _ShapeYSpeed, time); - #if SHAPE1SHAPECOLOR_ON - shape1.a = shape1.r; - shape1.rgb = _ShapeColor.rgb; - #else - shape1 *= _ShapeColor; - #endif - #if SHAPE1CONTRAST_ON - #if SHAPE1SHAPECOLOR_ON - shape1.a = saturate((shape1.a - 0.5) * _ShapeContrast + 0.5 + _ShapeBrightness); - #else - shape1.rgb = max(0, (shape1.rgb - half3(0.5, 0.5, 0.5)) * _ShapeContrast + half3(0.5, 0.5, 0.5) + _ShapeBrightness); - #endif - #endif - - half4 shape2 = 1.0; - #if SHAPE2_ON - shape2Uv = TRANSFORM_TEX(shape2Uv, _Shape2Tex); - #if OFFSETSTREAM_ON - shape2Uv.x += i.offsetCustomData.x * _OffsetSh2; - shape2Uv.y += i.offsetCustomData.y * _OffsetSh2; - #endif - #if SHAPETEXOFFSET_ON - shape2Uv += seed * _RandomSh2Mult; - #endif - #if SHAPE2DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh2DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape2DistortTex); - #else - half2 sh2DistortUvs = d.extraV2F2.xy; - #endif - sh2DistortUvs.x += ((time + seed) * _Shape2DistortXSpeed) % 1; - sh2DistortUvs.y += ((time + seed) * _Shape2DistortYSpeed) % 1; - half distortAmnt2 = (SAMPLE_TEXTURE2D(_Shape2DistortTex, sampler_Shape2DistortTex, sh2DistortUvs).r - 0.5) * 0.2 * _Shape2DistortAmount; - shape2Uv.x += distortAmnt2; - shape2Uv.y += distortAmnt2; - #endif - #if SHAPE2ROTATE_ON - shape2Uv = RotateUvs(shape2Uv, _Shape2RotationOffset + ((_Shape2RotationSpeed * time) % 6.28318530718), _Shape2Tex_ST); - #endif - - shape2 = SampleTextureWithScroll(_Shape2Tex, sampler_Shape2Tex, shape2Uv, _Shape2XSpeed, _Shape2YSpeed, time); - #if SHAPE2SHAPECOLOR_ON - shape2.a = shape2.r; - shape2.rgb = _Shape2Color.rgb; - #else - shape2 *= _Shape2Color; - #endif - #if SHAPE2CONTRAST_ON - #if SHAPE2SHAPECOLOR_ON - shape2.a = max(0, (shape2.a - 0.5) * _Shape2Contrast + 0.5 + _Shape2Brightness); - #else - shape2.rgb = max(0, (shape2.rgb - half3(0.5, 0.5, 0.5)) * _Shape2Contrast + half3(0.5, 0.5, 0.5) + _Shape2Brightness); - #endif - #endif - #endif - - half4 shape3 = 1.0; - #if SHAPE3_ON - shape3Uv = TRANSFORM_TEX(shape3Uv, _Shape3Tex); - - #if OFFSETSTREAM_ON - shape3Uv.x += i.offsetCustomData.x * _OffsetSh3; - shape3Uv.y += i.offsetCustomData.y * _OffsetSh3; - #endif - #if SHAPETEXOFFSET_ON - shape3Uv += seed * _RandomSh3Mult; - #endif - #if SHAPE3DISTORT_ON - #if POLARUVDISTORT_ON - half2 sh3DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape3DistortTex); - #else - half2 sh3DistortUvs = d.extraV2F3.xy; - #endif - sh3DistortUvs.x += ((time + seed) * _Shape3DistortXSpeed) % 1; - sh3DistortUvs.y += ((time + seed) * _Shape3DistortYSpeed) % 1; - half distortAmnt3 = (SAMPLE_TEXTURE2D(_Shape3DistortTex, sampler_Shape3DistortTex, sh3DistortUvs).r - 0.5) * 0.3 * _Shape3DistortAmount; - shape3Uv.x += distortAmnt3; - shape3Uv.y += distortAmnt3; - #endif - #if SHAPE3ROTATE_ON - shape3Uv = RotateUvs(shape3Uv, _Shape3RotationOffset + ((_Shape3RotationSpeed * time) % 6.28318530718), _Shape3Tex_ST); - #endif - shape3 = SampleTextureWithScroll(_Shape3Tex, sampler_Shape3Tex, shape3Uv, _Shape3XSpeed, _Shape3YSpeed, time); - #if SHAPE3SHAPECOLOR_ON - shape3.a = shape3.r; - shape3.rgb = _Shape3Color.rgb; - #else - shape3 *= _Shape3Color; - #endif - #if SHAPE3CONTRAST_ON - #if SHAPE3SHAPECOLOR_ON - shape3.a = max(0, (shape3.a - 0.5) * _Shape3Contrast + 0.5 + _Shape3Brightness); - #else - shape3.rgb = max(0, (shape3.rgb - half3(0.5, 0.5, 0.5)) * _Shape3Contrast + half3(0.5, 0.5, 0.5) + _Shape3Brightness); - #endif - #endif - #endif - - half4 col = shape1; - //Mix all shapes pre: change weights if custom vertex effect active - #if SHAPEWEIGHTS_ON - half shapeWeightOffset; - #if SHAPE2_ON - shapeWeightOffset = i.offsetCustomData.z * _Sh1BlendOffset; - _ShapeColorWeight = max(0, _ShapeColorWeight + shapeWeightOffset); - _ShapeAlphaWeight = max(0, _ShapeAlphaWeight + shapeWeightOffset); - shapeWeightOffset = i.offsetCustomData.z * _Sh2BlendOffset; - _Shape2ColorWeight = max(0, _Shape2ColorWeight + shapeWeightOffset); - _Shape2AlphaWeight = max(0, _Shape2AlphaWeight + shapeWeightOffset); - #endif - #if SHAPE3_ON - shapeWeightOffset = i.offsetCustomData.z * _Sh3BlendOffset; - _Shape3ColorWeight = max(0, _Shape3ColorWeight + shapeWeightOffset); - _Shape3AlphaWeight = max(0, _Shape3AlphaWeight + shapeWeightOffset); - #endif - #endif - - //Mix all shapes - #if SHAPE2_ON - #if !SPLITRGBA_ON - _ShapeAlphaWeight = _ShapeColorWeight; - _Shape2AlphaWeight = _Shape2ColorWeight; - #endif - #if SHAPE3_ON //Shape3 On - #if !SPLITRGBA_ON - _Shape3AlphaWeight = _Shape3ColorWeight; - #endif - #if SHAPEADD_ON - col.rgb = ((shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight)) + (shape3.rgb * _Shape3ColorWeight); - col.a = saturate(max(shape3.a * _Shape3AlphaWeight, max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight))); - #else - col.rgb = ((shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight)) * (shape3.rgb * _Shape3ColorWeight); - col.a = saturate(((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)) * (shape3.a * _Shape3AlphaWeight)); - #endif - #else //Shape3 Off - #if SHAPEADD_ON - col.rgb = (shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight); - col.a = saturate(max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight)); - #else - col.rgb = (shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight); - col.a = saturate((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)); - #endif - #endif - #endif - - #if SHAPE1MASK_ON - col = lerp(col, shape1, pow(SAMPLE_TEXTURE2D(_Shape1MaskTex, sampler_Shape1MaskTex, TRANSFORM_TEX(i.uvSeed.xy, _Shape1MaskTex)).r, _Shape1MaskPow)); - #endif - - #if PREMULTIPLYCOLOR_ON - half luminance = 0; - luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; - luminance *= col.a; - col.a = min(luminance, col.a); - #endif - - col.rgb *= _Color.rgb * d.vertexColor.rgb; - #if PREMULTIPLYALPHA_ON - col.rgb *= col.a; - #endif - - #if !PREMULTIPLYCOLOR_ON && (COLORRAMP_ON || ALPHAFADE_ON || COLORGRADING_ON || FADE_ON || (ADDITIVECONFIG_ON && (GLOW_ON || DEPTHGLOW_ON))) - half luminance = 0; - luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; - luminance *= col.a; - #endif - - #if (FADE_ON || ALPHAFADE_ON) && ALPHAFADEINPUTSTREAM_ON - col.a *= d.vertexColor.a; - d.vertexColor.a = d.texcoord0.w; - #endif - - #if FADE_ON - half preFadeAlpha = col.a; - _FadeAmount = saturate(_FadeAmount + (1 - d.vertexColor.a)); - _FadeTransition = max(0.01, _FadeTransition * EaseOutQuint(saturate(_FadeAmount))); - half2 fadeUv; - fadeUv = d.texcoord0.xy + seed; - fadeUv.x += (time * _FadeScrollXSpeed) % 1; - fadeUv.y += (time * _FadeScrollYSpeed) % 1; - half2 tiledUvFade1 = TRANSFORM_TEX(fadeUv, _FadeTex); - #if ADDITIVECONFIG_ON && !PREMULTIPLYCOLOR_ON - preFadeAlpha *= luminance; - #endif - _FadeAmount = saturate(pow(_FadeAmount, _FadePower)); - #if FADEBURN_ON - half2 tiledUvFade2 = TRANSFORM_TEX(fadeUv, _FadeBurnTex); - half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; - half fadeNaturalEdge = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - col.a *= fadeNaturalEdge; - half fadeBurn = saturate(smoothstep(0.0 , _FadeTransition + _FadeBurnWidth, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - fadeBurn = fadeNaturalEdge - fadeBurn; - _FadeBurnColor.rgb *= _FadeBurnGlow; - col.rgb += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2).rgb * _FadeBurnColor.rgb * preFadeAlpha; - #else - half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; - float fade = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); - col.a *= fade; - #endif - #if ALPHAFADETRANSPARENCYTOO_ON - col.a *= 1 - _FadeAmount; - #endif - #endif - - #if ALPHAFADE_ON - half alphaFadeLuminance; - _AlphaFadeAmount = saturate(_AlphaFadeAmount + (1 - d.vertexColor.a)); - _AlphaFadeAmount = saturate(pow(_AlphaFadeAmount, _AlphaFadePow)); - _AlphaFadeSmooth = max(0.01, _AlphaFadeSmooth * EaseOutQuint(saturate(_AlphaFadeAmount))); - #if ALPHAFADEUSESHAPE1_ON - alphaFadeLuminance = shape1.r; - #else - alphaFadeLuminance = luminance; - #endif - alphaFadeLuminance = saturate(alphaFadeLuminance - 0.001); - #if ALPHAFADEUSEREDCHANNEL_ON - col.a *= col.r; - #endif - col.a = saturate(col.a); - float alphaFade = saturate(smoothstep(0.0 , _AlphaFadeSmooth, RemapFloat(1.0 - _AlphaFadeAmount, 0.0, 1.0, -1.0, 1.0) + alphaFadeLuminance)); - col.a *= alphaFade; - #if ALPHAFADETRANSPARENCYTOO_ON - col.a *= 1 - _AlphaFadeAmount; - #endif - #endif - - #if BACKFACETINT_ON - col.rgb = lerp(col.rgb * _BackFaceTint, col.rgb * _FrontFaceTint, step(0, dot(d.worldSpaceNormal, d.worldSpaceViewDir))); - #endif - - //#if LIGHTANDSHADOW_ON - //half NdL = saturate(dot(d.worldSpaceNormal, -_All1VfxLightDir)); - //col.rgb += _LightColor * _LightAmount * NdL; - //NdL = max(_ShadowAmount, NdL); - //NdL = smoothstep(_ShadowStepMin, _ShadowStepMax, NdL); - //col.rgb *= NdL; - //#endif - - #if COLORGRADING_ON - col.rgb *= lerp(lerp(_ColorGradingDark, _ColorGradingMiddle, luminance/_ColorGradingMidPoint), - lerp(_ColorGradingMiddle, _ColorGradingLight, (luminance - _ColorGradingMidPoint)/(1.0 - _ColorGradingMidPoint)), step(_ColorGradingMidPoint, luminance)); - #endif - - #if COLORRAMP_ON - half colorRampLuminance = saturate(luminance + _ColorRampLuminosity); - #if COLORRAMPGRAD_ON - half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(colorRampLuminance, 0)); - #else - half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(colorRampLuminance, 0)); - #endif - col.rgb = lerp(col.rgb, colorRampRes.rgb, _ColorRampBlend); - col.a = lerp(col.a, saturate(col.a * colorRampRes.a), _ColorRampBlend); - #endif - - #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON - col.rgb = floor(col.rgb / (1.0 / _PosterizeNumColors)) * (1.0 / _PosterizeNumColors); - #endif - - #if DEPTHGLOW_ON - half sceneDepthDiff = GetLinearEyeDepth(d.screenUV) - d.screenPos.w; - #endif - - #if RIM_ON - half NdV = 1 - abs(dot(d.worldSpaceNormal, d.worldSpaceViewDir)); - half rimFactor = saturate(_RimBias + _RimScale * pow(NdV, _RimPower)); - half4 rimCol = _RimColor * rimFactor; - rimCol.rgb *= _RimIntensity; - col.rgb = lerp(col.rgb * (rimCol.rgb + half3(1,1,1)), col.rgb + rimCol.rgb, _RimAddAmount); - col.a = saturate(col.a * (1 - rimFactor * _RimErodesAlpha)); - #endif - - #if DEPTHGLOW_ON - half depthGlowMask = saturate(_DepthGlowDist * pow((1 - sceneDepthDiff), _DepthGlowPow)); - col.rgb = lerp(col.rgb, _DepthGlowGlobal * col.rgb, depthGlowMask); - half depthGlowMult = 1; - #if ADDITIVECONFIG_ON - depthGlowMult = luminance; - #endif - col.rgb += _DepthGlowColor.rgb * _DepthGlow * depthGlowMask * col.a * depthGlowMult; - #endif - - #if GLOW_ON - half glowMask = 1; - #if GLOWTEX_ON - glowMask = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, TRANSFORM_TEX(d.texcoord0.xy, _GlowTex)); - #endif - col.rgb *= _GlowGlobal * glowMask; - half glowMult = 1; - #if ADDITIVECONFIG_ON - glowMult = luminance; - #endif - - col.rgb += _GlowColor.rgb * _Glow * glowMask * col.a * glowMult; - #endif - - #if HSV_ON - half3 resultHsv = half3(col.rgb); - half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); - half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); - resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x - + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y - + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; - resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x - + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y - + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; - resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x - + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y - + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; - col.rgb = resultHsv; - #endif - - #if CAMDISTFADE_ON - col.a *= 1 - saturate(smoothstep(_CamDistFadeStepMin, _CamDistFadeStepMax, camDistance)); - col.a *= smoothstep(0.0, _CamDistProximityFade, camDistance); - #endif - - #if MASK_ON - half2 maskUv = d.texcoord0.xy; - #if POLARUV_ON - maskUv = prePolarUvs; - #endif - half4 maskSample = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, TRANSFORM_TEX(maskUv, _MaskTex)); - half mask = pow(min(maskSample.r, maskSample.a), _MaskPow); - col.a *= mask; - #endif - - #if ALPHASMOOTHSTEP_ON - col.a = smoothstep(_AlphaStepMin, _AlphaStepMax, col.a); - #endif - - half4 debugColor = col; - #if SHAPEDEBUG_ON - debugColor = GetDebugColor(col, shape1, shape2, shape3); - #endif - - clip(debugColor.a - _AlphaCutoffValue - 0.01); - - //#if FOG_ON - //UNITY_APPLY_FOG(i.fogCoord, col); - //#endif - - //Don't use a starting i.color.a lower than 1 unless using vertex stream dissolve when using a FADE effect - #if !FADE_ON && !ALPHAFADE_ON - col.a *= _Alpha * d.vertexColor.a; - #endif - #if FADE_ON || ALPHAFADE_ON - col.a *= _Alpha; - #endif - #if ADDITIVECONFIG_ON - col.rgb *= col.a; - #endif - - - #if SHAPEDEBUG_ON - o.Albedo = debugColor.rgb; - o.Alpha = debugColor.a; - #else - o.Albedo = col.rgb; - o.Alpha = col.a; - #endif - } - - - - - - void ChainSurfaceFunction(inout Surface l, inout ShaderData d) - { - Ext_SurfaceFunction0(l, d); - // Ext_SurfaceFunction1(l, d); - // Ext_SurfaceFunction2(l, d); - // Ext_SurfaceFunction3(l, d); - // Ext_SurfaceFunction4(l, d); - // Ext_SurfaceFunction5(l, d); - // Ext_SurfaceFunction6(l, d); - // Ext_SurfaceFunction7(l, d); - // Ext_SurfaceFunction8(l, d); - // Ext_SurfaceFunction9(l, d); - // Ext_SurfaceFunction10(l, d); - // Ext_SurfaceFunction11(l, d); - // Ext_SurfaceFunction12(l, d); - // Ext_SurfaceFunction13(l, d); - // Ext_SurfaceFunction14(l, d); - // Ext_SurfaceFunction15(l, d); - // Ext_SurfaceFunction16(l, d); - // Ext_SurfaceFunction17(l, d); - // Ext_SurfaceFunction18(l, d); - // Ext_SurfaceFunction19(l, d); - // Ext_SurfaceFunction20(l, d); - // Ext_SurfaceFunction21(l, d); - // Ext_SurfaceFunction22(l, d); - // Ext_SurfaceFunction23(l, d); - // Ext_SurfaceFunction24(l, d); - // Ext_SurfaceFunction25(l, d); - // Ext_SurfaceFunction26(l, d); - // Ext_SurfaceFunction27(l, d); - // Ext_SurfaceFunction28(l, d); - // Ext_SurfaceFunction29(l, d); - } - -#if !_DECALSHADER - - void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) - { - ExtraV2F d; - - ZERO_INITIALIZE(ExtraV2F, d); - ZERO_INITIALIZE(Blackboard, d.blackboard); - // due to motion vectors in HDRP, we need to use the last - // time in certain spots. So if you are going to use _Time to adjust vertices, - // you need to use this time or motion vectors will break. - d.time = time; - - Ext_ModifyVertex0(v, d); - // Ext_ModifyVertex1(v, d); - // Ext_ModifyVertex2(v, d); - // Ext_ModifyVertex3(v, d); - // Ext_ModifyVertex4(v, d); - // Ext_ModifyVertex5(v, d); - // Ext_ModifyVertex6(v, d); - // Ext_ModifyVertex7(v, d); - // Ext_ModifyVertex8(v, d); - // Ext_ModifyVertex9(v, d); - // Ext_ModifyVertex10(v, d); - // Ext_ModifyVertex11(v, d); - // Ext_ModifyVertex12(v, d); - // Ext_ModifyVertex13(v, d); - // Ext_ModifyVertex14(v, d); - // Ext_ModifyVertex15(v, d); - // Ext_ModifyVertex16(v, d); - // Ext_ModifyVertex17(v, d); - // Ext_ModifyVertex18(v, d); - // Ext_ModifyVertex19(v, d); - // Ext_ModifyVertex20(v, d); - // Ext_ModifyVertex21(v, d); - // Ext_ModifyVertex22(v, d); - // Ext_ModifyVertex23(v, d); - // Ext_ModifyVertex24(v, d); - // Ext_ModifyVertex25(v, d); - // Ext_ModifyVertex26(v, d); - // Ext_ModifyVertex27(v, d); - // Ext_ModifyVertex28(v, d); - // Ext_ModifyVertex29(v, d); - - - // #if %EXTRAV2F0REQUIREKEY% - v2p.extraV2F0 = d.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - v2p.extraV2F1 = d.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - v2p.extraV2F2 = d.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - v2p.extraV2F3 = d.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // v2p.extraV2F4 = d.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // v2p.extraV2F5 = d.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // v2p.extraV2F6 = d.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // v2p.extraV2F7 = d.extraV2F7; - // #endif - } - - void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) - { - ExtraV2F d; - ZERO_INITIALIZE(ExtraV2F, d); - ZERO_INITIALIZE(Blackboard, d.blackboard); - - // #if %EXTRAV2F0REQUIREKEY% - d.extraV2F0 = v2p.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - d.extraV2F1 = v2p.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - d.extraV2F2 = v2p.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - d.extraV2F3 = v2p.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // d.extraV2F4 = v2p.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // d.extraV2F5 = v2p.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // d.extraV2F6 = v2p.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // d.extraV2F7 = v2p.extraV2F7; - // #endif - - - // Ext_ModifyTessellatedVertex0(v, d); - // Ext_ModifyTessellatedVertex1(v, d); - // Ext_ModifyTessellatedVertex2(v, d); - // Ext_ModifyTessellatedVertex3(v, d); - // Ext_ModifyTessellatedVertex4(v, d); - // Ext_ModifyTessellatedVertex5(v, d); - // Ext_ModifyTessellatedVertex6(v, d); - // Ext_ModifyTessellatedVertex7(v, d); - // Ext_ModifyTessellatedVertex8(v, d); - // Ext_ModifyTessellatedVertex9(v, d); - // Ext_ModifyTessellatedVertex10(v, d); - // Ext_ModifyTessellatedVertex11(v, d); - // Ext_ModifyTessellatedVertex12(v, d); - // Ext_ModifyTessellatedVertex13(v, d); - // Ext_ModifyTessellatedVertex14(v, d); - // Ext_ModifyTessellatedVertex15(v, d); - // Ext_ModifyTessellatedVertex16(v, d); - // Ext_ModifyTessellatedVertex17(v, d); - // Ext_ModifyTessellatedVertex18(v, d); - // Ext_ModifyTessellatedVertex19(v, d); - // Ext_ModifyTessellatedVertex20(v, d); - // Ext_ModifyTessellatedVertex21(v, d); - // Ext_ModifyTessellatedVertex22(v, d); - // Ext_ModifyTessellatedVertex23(v, d); - // Ext_ModifyTessellatedVertex24(v, d); - // Ext_ModifyTessellatedVertex25(v, d); - // Ext_ModifyTessellatedVertex26(v, d); - // Ext_ModifyTessellatedVertex27(v, d); - // Ext_ModifyTessellatedVertex28(v, d); - // Ext_ModifyTessellatedVertex29(v, d); - - // #if %EXTRAV2F0REQUIREKEY% - v2p.extraV2F0 = d.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - v2p.extraV2F1 = d.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - v2p.extraV2F2 = d.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - v2p.extraV2F3 = d.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // v2p.extraV2F4 = d.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // v2p.extraV2F5 = d.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // v2p.extraV2F6 = d.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // v2p.extraV2F7 = d.extraV2F7; - // #endif - } - - void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) - { - // Ext_FinalColorForward0(l, d, color); - // Ext_FinalColorForward1(l, d, color); - // Ext_FinalColorForward2(l, d, color); - // Ext_FinalColorForward3(l, d, color); - // Ext_FinalColorForward4(l, d, color); - // Ext_FinalColorForward5(l, d, color); - // Ext_FinalColorForward6(l, d, color); - // Ext_FinalColorForward7(l, d, color); - // Ext_FinalColorForward8(l, d, color); - // Ext_FinalColorForward9(l, d, color); - // Ext_FinalColorForward10(l, d, color); - // Ext_FinalColorForward11(l, d, color); - // Ext_FinalColorForward12(l, d, color); - // Ext_FinalColorForward13(l, d, color); - // Ext_FinalColorForward14(l, d, color); - // Ext_FinalColorForward15(l, d, color); - // Ext_FinalColorForward16(l, d, color); - // Ext_FinalColorForward17(l, d, color); - // Ext_FinalColorForward18(l, d, color); - // Ext_FinalColorForward19(l, d, color); - // Ext_FinalColorForward20(l, d, color); - // Ext_FinalColorForward21(l, d, color); - // Ext_FinalColorForward22(l, d, color); - // Ext_FinalColorForward23(l, d, color); - // Ext_FinalColorForward24(l, d, color); - // Ext_FinalColorForward25(l, d, color); - // Ext_FinalColorForward26(l, d, color); - // Ext_FinalColorForward27(l, d, color); - // Ext_FinalColorForward28(l, d, color); - // Ext_FinalColorForward29(l, d, color); - } - - void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) - { - // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); - } -#endif - - - - - -#if _DECALSHADER - - ShaderData CreateShaderData(SurfaceDescriptionInputs IN) - { - ShaderData d = (ShaderData)0; - d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); - d.worldSpaceNormal = IN.WorldSpaceNormal; - d.worldSpaceTangent = IN.WorldSpaceTangent; - - d.worldSpacePosition = IN.WorldSpacePosition; - d.texcoord0 = IN.uv0.xyxy; - d.screenPos = IN.ScreenPosition; - - d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); - - d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); - - // these rarely get used, so we back transform them. Usually will be stripped. - #if _HDRP - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; - #else - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; - #endif - // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); - // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); - - // #if %SCREENPOSREQUIREKEY% - d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); - // #endif - - return d; - } -#else - - ShaderData CreateShaderData(VertexToPixel i - #if NEED_FACING - , bool facing - #endif - ) - { - ShaderData d = (ShaderData)0; - d.clipPos = i.pos; - d.worldSpacePosition = i.worldPos; - - d.worldSpaceNormal = normalize(i.worldNormal); - d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); - - d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; - float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; - - d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); - d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); - - d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); - d.texcoord0 = i.texcoord0; - // d.texcoord1 = i.texcoord1; - // d.texcoord2 = i.texcoord2; - - // #if %TEXCOORD3REQUIREKEY% - // d.texcoord3 = i.texcoord3; - // #endif - - // d.isFrontFace = facing; - // #if %VERTEXCOLORREQUIREKEY% - d.vertexColor = i.vertexColor; - // #endif - - // these rarely get used, so we back transform them. Usually will be stripped. - #if _HDRP - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; - #else - // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; - #endif - // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); - // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); - - // #if %SCREENPOSREQUIREKEY% - d.screenPos = i.screenPos; - d.screenUV = (i.screenPos.xy / i.screenPos.w); - // #endif - - - // #if %EXTRAV2F0REQUIREKEY% - d.extraV2F0 = i.extraV2F0; - // #endif - - // #if %EXTRAV2F1REQUIREKEY% - d.extraV2F1 = i.extraV2F1; - // #endif - - // #if %EXTRAV2F2REQUIREKEY% - d.extraV2F2 = i.extraV2F2; - // #endif - - // #if %EXTRAV2F3REQUIREKEY% - d.extraV2F3 = i.extraV2F3; - // #endif - - // #if %EXTRAV2F4REQUIREKEY% - // d.extraV2F4 = i.extraV2F4; - // #endif - - // #if %EXTRAV2F5REQUIREKEY% - // d.extraV2F5 = i.extraV2F5; - // #endif - - // #if %EXTRAV2F6REQUIREKEY% - // d.extraV2F6 = i.extraV2F6; - // #endif - - // #if %EXTRAV2F7REQUIREKEY% - // d.extraV2F7 = i.extraV2F7; - // #endif - - return d; - } - -#endif - - // vertex shader - VertexToPixel Vert (VertexData v) - { - UNITY_SETUP_INSTANCE_ID(v); - VertexToPixel o; - UNITY_INITIALIZE_OUTPUT(VertexToPixel,o); - UNITY_TRANSFER_INSTANCE_ID(v,o); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - -#if !_TESSELLATION_ON - ChainModifyVertex(v, o, _Time); -#endif - - - o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); - #ifdef EDITOR_VISUALIZATION - o.vizUV = 0; - o.lightCoord = 0; - if (unity_VisualizationMode == EDITORVIZ_TEXTURE) - o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord0.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST); - else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK) - { - o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; - o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(GetObjectToWorldMatrix(), float4(v.vertex.xyz, 1))); - } - #endif - - - o.texcoord0 = v.texcoord0; - // o.texcoord1 = v.texcoord1; - // o.texcoord2 = v.texcoord2; - - // #if %TEXCOORD3REQUIREKEY% - // o.texcoord3 = v.texcoord3; - // #endif - - // #if %VERTEXCOLORREQUIREKEY% - o.vertexColor = v.vertexColor; - // #endif - - // #if %SCREENPOSREQUIREKEY% - o.screenPos = ComputeScreenPos(o.pos); - // #endif - - o.worldPos = mul(GetObjectToWorldMatrix(), v.vertex).xyz; - o.worldNormal = UnityObjectToWorldNormal(v.normal); - o.worldTangent = float4(UnityObjectToWorldDir(v.tangent.xyz), v.tangent.w); - - return o; - } - - - - // fragment shader - fixed4 Frag (VertexToPixel IN - #if NEED_FACING - , bool facing : SV_IsFrontFace - #endif - ) : SV_Target - { - UNITY_SETUP_INSTANCE_ID(IN); - - #ifdef FOG_COMBINED_WITH_TSPACE - UNITY_EXTRACT_FOG_FROM_TSPACE(IN); - #elif defined (FOG_COMBINED_WITH_WORLD_POS) - UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN); - #else - UNITY_EXTRACT_FOG(IN); - #endif - - ShaderData d = CreateShaderData(IN - #if NEED_FACING - , facing - #endif - ); - - Surface l = (Surface)0; - - l.Albedo = half3(0.5, 0.5, 0.5); - l.Normal = float3(0,0,1); - l.Occlusion = 1; - l.Alpha = 1; - - - ChainSurfaceFunction(l, d); - - UnityMetaInput metaIN; - UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN); - metaIN.Albedo = l.Albedo; - metaIN.Emission = l.Emission; - #if _USESPECULAR - metaIN.SpecularColor = l.Specular; + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + // o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); #endif - #ifdef EDITOR_VISUALIZATION - metaIN.VizUV = IN.vizUV; - metaIN.LightCoord = IN.lightCoord; - #endif - return UnityMetaFragment(metaIN); + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; } - ENDCG + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL } + + + Pass + { + Name "DepthOnly" + Tags + { + "LightMode" = "DepthOnly" + } + + // Render State + Blend One Zero, One Zero + Cull Back + ZTest LEqual + ZWrite On + ColorMask 0 + + Tags + { + "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" + } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + ColorMask [_ColorMask] +Lighting Off + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + + #define _PASSDEPTH 1 + + #pragma target 3.0 + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_instancing + + + #pragma shader_feature_local TIMEISCUSTOM_ON + #pragma shader_feature_local ADDITIVECONFIG_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + #pragma shader_feature_local PREMULTIPLYCOLOR_ON + #pragma shader_feature_local SPLITRGBA_ON + #pragma shader_feature_local SHAPEADD_ON + + #pragma shader_feature_local SHAPE1SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE2SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE3SCREENUV_ON /////////////////Pipeline specific implementation + + #pragma shader_feature_local SHAPEDEBUG_ON + + #pragma shader_feature_local SHAPE1CONTRAST_ON + #pragma shader_feature_local SHAPE1DISTORT_ON + #pragma shader_feature_local SHAPE1ROTATE_ON + #pragma shader_feature_local SHAPE1SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE2_ON + #pragma shader_feature_local SHAPE2CONTRAST_ON + #pragma shader_feature_local SHAPE2DISTORT_ON + #pragma shader_feature_local SHAPE2ROTATE_ON + #pragma shader_feature_local SHAPE2SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE3_ON + #pragma shader_feature_local SHAPE3CONTRAST_ON + #pragma shader_feature_local SHAPE3DISTORT_ON + #pragma shader_feature_local SHAPE3ROTATE_ON + #pragma shader_feature_local SHAPE3SHAPECOLOR_ON + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local DEPTHGLOW_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local MASK_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local COLORRAMPGRAD_ON + #pragma shader_feature_local COLORGRADING_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local SHAKEUV_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local OFFSETSTREAM_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local VERTOFFSET_ON + #pragma shader_feature_local RIM_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local BACKFACETINT_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local POLARUVDISTORT_ON + #pragma shader_feature_local SHAPE1MASK_ON + #pragma shader_feature_local TRAILWIDTH_ON + #pragma shader_feature_local LIGHTANDSHADOW_ON + #pragma shader_feature_local SHAPETEXOFFSET_ON + #pragma shader_feature_local SHAPEWEIGHTS_ON + + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHASMOOTHSTEP_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local FADEBURN_ON + #pragma shader_feature_local ALPHAFADE_ON + #pragma shader_feature_local ALPHAFADEUSESHAPE1_ON + #pragma shader_feature_local ALPHAFADEUSEREDCHANNEL_ON + #pragma shader_feature_local ALPHAFADETRANSPARENCYTOO_ON + #pragma shader_feature_local ALPHAFADEINPUTSTREAM_ON + #pragma shader_feature_local CAMDISTFADE_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define REQUIRE_DEPTH_TEXTURE + + // Includes + //#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + //#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + // float4 texcoord1 : TEXCOORD4; + // float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half _Alpha; + half _AlphaCutoffValue; + + half _TimingSeed; + + #if TIMEISCUSTOM_ON + float4 globalCustomTime; + #endif + + half4 _MainTex_ST, _ShapeColor; + half _ShapeXSpeed, _ShapeYSpeed, _ShapeColorWeight, _ShapeAlphaWeight; + + #if SHAPE1CONTRAST_ON + half _ShapeContrast, _ShapeBrightness; + #endif + + #if SHAPE1DISTORT_ON + half4 _ShapeDistortTex_ST; + half _ShapeDistortAmount, _ShapeDistortXSpeed, _ShapeDistortYSpeed; + #endif + + #if SHAPE1ROTATE_ON + half _ShapeRotationOffset, _ShapeRotationSpeed; + #endif + + #if OFFSETSTREAM_ON + half _OffsetSh1; + #endif + + #if SHAPEWEIGHTS_ON + half _Sh1BlendOffset; + #endif + + #if SHAPE2_ON + half4 _Shape2Tex_ST, _Shape2Color; + half _Shape2XSpeed, _Shape2YSpeed, _Shape2ColorWeight, _Shape2AlphaWeight; + #if SHAPE2CONTRAST_ON + half _Shape2Contrast, _Shape2Brightness; + #endif + #if SHAPE2DISTORT_ON + half4 _Shape2DistortTex_ST; + half _Shape2DistortAmount, _Shape2DistortXSpeed, _Shape2DistortYSpeed; + #endif + #if SHAPE2ROTATE_ON + half _Shape2RotationOffset, _Shape2RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh2; + #endif + #if SHAPEWEIGHTS_ON + half _Sh2BlendOffset; + #endif + #endif + + #if SHAPE3_ON + half4 _Shape3Tex_ST, _Shape3Color; + half _Shape3XSpeed, _Shape3YSpeed, _Shape3ColorWeight, _Shape3AlphaWeight; + #if SHAPE3CONTRAST_ON + half _Shape3Contrast, _Shape3Brightness; + #endif + #if SHAPE3DISTORT_ON + half4 _Shape3DistortTex_ST; + half _Shape3DistortAmount, _Shape3DistortXSpeed, _Shape3DistortYSpeed; + #endif + #if SHAPE3ROTATE_ON + half _Shape3RotationOffset, _Shape3RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh3; + #endif + #if SHAPEWEIGHTS_ON + half _Sh3BlendOffset; + #endif + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #if GLOWTEX_ON + half4 _GlowTex_ST; + #endif + #endif + + #if MASK_ON + half4 _MaskTex_ST; + half _MaskPow; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if ALPHASMOOTHSTEP_ON + half _AlphaStepMin, _AlphaStepMax; + #endif + + #if ALPHAFADE_ON + half _AlphaFadeAmount, _AlphaFadeSmooth, _AlphaFadePow; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + half _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if ROUNDWAVEUV_ON || PIXELATE_ON + half4 _MainTex_TexelSize; + #endif + + #if VERTOFFSET_ON + half4 _VertOffsetTex_ST; + half _VertOffsetAmount, _VertOffsetPower, _VertOffsetTexXSpeed, _VertOffsetTexYSpeed; + #endif + + #if FADE_ON + half4 _FadeTex_ST; + half _FadeAmount, _FadeTransition, _FadePower, _FadeScrollXSpeed, _FadeScrollYSpeed; + #if FADEBURN_ON + half4 _FadeBurnColor, _FadeBurnTex_ST; + half _FadeBurnWidth, _FadeBurnGlow; + #endif + #endif + + #if COLORGRADING_ON + half3 _ColorGradingLight, _ColorGradingMiddle, _ColorGradingDark; + half _ColorGradingMidPoint; + #endif + + #if CAMDISTFADE_ON + half _CamDistFadeStepMin, _CamDistFadeStepMax, _CamDistProximityFade; + #endif + + #if RIM_ON + half _RimBias, _RimScale, _RimPower, _RimIntensity, _RimAddAmount, _RimErodesAlpha; + half4 _RimColor; + #endif + + #if BACKFACETINT_ON + half4 _BackFaceTint, _FrontFaceTint; + #endif + + #if SHAPEDEBUG_ON + half _DebugShape; + #endif + + #if SHAPE1MASK_ON + half4 _Shape1MaskTex_ST; + half _Shape1MaskPow; + #endif + + #if TRAILWIDTH_ON + half _TrailWidthPower; + #endif + + #if LIGHTANDSHADOW_ON + half3 _All1VfxLightDir; + half _ShadowAmount, _ShadowStepMin, _ShadowStepMax, _LightAmount; + half4 _LightColor; + #endif + + #if SHAPETEXOFFSET_ON + half _RandomSh1Mult, _RandomSh2Mult, _RandomSh3Mult; + #endif + + #if DEPTHGLOW_ON + half _DepthGlowDist, _DepthGlowPow, _DepthGlow, _DepthGlowGlobal; + half4 _DepthGlowColor; + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half _ScreenUvShDistScale,_ScreenUvSh2DistScale, _ScreenUvSh3DistScale; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if SHAPE1DISTORT_ON + TEXTURE2D(_ShapeDistortTex); + SAMPLER(sampler_ShapeDistortTex); + #endif + + #if SHAPE2_ON + TEXTURE2D(_Shape2Tex); + SAMPLER(sampler_Shape2Tex); + #if SHAPE2DISTORT_ON + TEXTURE2D(_Shape2DistortTex); + SAMPLER(sampler_Shape2DistortTex); + #endif + #endif + + #if SHAPE3_ON + TEXTURE2D(_Shape3Tex); + SAMPLER(sampler_Shape3Tex); + #if SHAPE3DISTORT_ON + TEXTURE2D(_Shape3DistortTex); + SAMPLER(sampler_Shape3DistortTex); + #endif + #endif + + #if GLOW_ON + #if GLOWTEX_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + #endif + + #if MASK_ON + TEXTURE2D(_MaskTex); + SAMPLER(sampler_MaskTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + SAMPLER(sampler_ColorRampTex); + #endif + + #if COLORRAMPGRAD_ON + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if VERTOFFSET_ON + TEXTURE2D(_VertOffsetTex); + SAMPLER(sampler_VertOffsetTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + #if FADEBURN_ON + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + #endif + + #if SHAPE1MASK_ON + TEXTURE2D(_Shape1MaskTex); + SAMPLER(sampler_Shape1MaskTex); + #endif + + #if TRAILWIDTH_ON + TEXTURE2D(_TrailWidthGradient); + SAMPLER(sampler_TrailWidthGradient); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + half4 SampleTextureWithScroll(in Texture2D _tex, in SamplerState _sampler, in float2 uv, in half scrollXSpeed, in half scrollYSpeed, in float time) + { + half2 _uv = uv; + _uv.x += (time * scrollXSpeed) % 1; + _uv.y += (time * scrollYSpeed) % 1; + return SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + } + + half EaseOutQuint(half x) + { + return 1 - pow(1 - x, 5); + } + + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax) + { + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + + float2 RotateUvs(float2 uv, half rotation, half4 scaleAndTranslate) + { + half2 center = half2(0.5 * scaleAndTranslate.x + scaleAndTranslate.z, 0.5 * scaleAndTranslate.y + scaleAndTranslate.w); + half cosAngle = cos(rotation); + half sinAngle = sin(rotation); + uv -= center; + uv = mul(half2x2(cosAngle, -sinAngle, sinAngle, cosAngle), uv); + uv += center; + return uv; + } + + half4 GetDebugColor(float4 resColor, half4 shape1, half4 shape2, half4 shape3) + { + half4 res = resColor; + + //MAKE SURE THE FOLLOWING CODE BLOCK IS UNCOMMENTED------------------------------------------- + #if SHAPEDEBUG_ON + if(_DebugShape < 1.5) return shape1; + #if SHAPE2_ON + else if (_DebugShape < 2.5) return shape2; + #endif + #if SHAPE3_ON + else return shape3; + #endif + #endif + + return res; + } + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //uvDistTex --> extraV2F0 + //uvSh1DistTex --> extraV2F1 + //uvSh2DistTex --> extraV2F2 + //uvSh3DistTex --> extraV2F3 + + #if VERTOFFSET_ON + #if TIMEISCUSTOM_ON + const half time = v.texcoord0.z + globalCustomTime.y; + #else + const half time = v.texcoord0.z + _Time.y; + #endif + half4 offsetUv = half4(TRANSFORM_TEX(v.texcoord0.xy, _VertOffsetTex), 0, 0); + offsetUv.x += (time * _VertOffsetTexXSpeed) % 1; + offsetUv.y += (time * _VertOffsetTexYSpeed) % 1; + v.vertex.xyz += v.normal * _VertOffsetAmount * pow(SAMPLE_TEXTURE2D_LOD(_VertOffsetTex, sampler_VertOffsetTex, offsetUv, 0).r, _VertOffsetPower); + #endif + + #if DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F0.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + + #if SHAPE1DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F1.xy = TRANSFORM_TEX(v.texcoord0.xy, _ShapeDistortTex); + #endif + + #if SHAPE2_ON + #if SHAPE2DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F2.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape2DistortTex);; + #endif + #endif + + #if SHAPE3_ON + #if SHAPE3DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F3.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape3DistortTex); + #endif + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + //i.uvSeed -> d.texcoord0.xy + + float seed = d.texcoord0.z + _TimingSeed; + #if TIMEISCUSTOM_ON + const float4 shaderTime = globalCustomTime; + #else + const float4 shaderTime = _Time; + #endif + float time = shaderTime.y + seed; + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 originalUvs = d.texcoord0.xy; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + #if TWISTUV_ON + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + #if DOODLE_ON + half2 uvCopy = d.texcoord0.xy; + _HandDrawnSpeed = (floor((shaderTime.x + seed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if WAVEUV_ON + half2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + half angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((time * _WaveSpeed) % 360.0); + d.texcoord0.xy = d.texcoord0.xy + normalize(uvWave) * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - d.texcoord0.x); + half yWave = ((0.5 * _MainTex_ST.y) - d.texcoord0.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + time * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if POLARUV_ON + half2 prePolarUvs = d.texcoord0.xy; + d.texcoord0.xy = d.texcoord0.xy - half2(0.5, 0.5); + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (1.0 * 6.28318530718), length(d.texcoord0.xy) * 2.0); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + #if DISTORT_ON + #if POLARUVDISTORT_ON + half2 distortUvs = TRANSFORM_TEX(d.texcoord0.xy, _DistortTex); + #else + half2 distortUvs = d.extraV2F0.xy; + #endif + distortUvs.x += ((shaderTime.x + seed) * _DistortTexXSpeed) % 1; + distortUvs.y += ((shaderTime.x + seed) * _DistortTexYSpeed) % 1; + #if ATLAS_ON + d.extraV2F0.xy = half2((d.extraV2F0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.extraV2F0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, distortUvs).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + + #if TEXTURESCROLL_ON + d.texcoord0.x += (time * _TextureScrollXSpeed) % 1; + d.texcoord0.y += (time * _TextureScrollYSpeed) % 1; + #endif + + #if TRAILWIDTH_ON + half width = pow(SAMPLE_TEXTURE2D(_TrailWidthGradient, sampler_TrailWidthGradient, d.texcoord0).r, _TrailWidthPower); + d.texcoord0.y = (d.texcoord0.y * 2 - 1) / width * 0.5 + 0.5; + clip(d.texcoord0.y); + clip(1 - d.texcoord0.y); + #endif + + float2 shape1Uv = d.texcoord0.xy; + #if SHAPE2_ON + float2 shape2Uv = shape1Uv; + #endif + #if SHAPE3_ON + float2 shape3Uv = shape1Uv; + #endif + + #if CAMDISTFADE_ON || SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half camDistance = distance(d.worldSpacePosition, _WorldSpaceCameraPos); + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 uvOffsetPostFx = d.texcoord0.xy - originalUvs; + d.texcoord0.xy = d.screenPos.xy / d.screenPos.w; + d.texcoord0.x = d.texcoord0.x * (_ScreenParams.x / _ScreenParams.y); + d.texcoord0.x -= 0.5; + d.texcoord0.xy -= uvOffsetPostFx; + originalUvs += uvOffsetPostFx; + half distanceZoom = camDistance * 0.1; + half2 scaleWithDistUvs = d.texcoord0.xy * distanceZoom + ((-distanceZoom * 0.5) + 0.5); + #if SHAPE1SCREENUV_ON + shape1Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvShDistScale); + #else + shape1Uv = originalUvs; + #endif + #if SHAPE2SCREENUV_ON && SHAPE2_ON + shape2Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh2DistScale); + #else + #if SHAPE2_ON + shape2Uv = originalUvs; + #endif + #endif + #if SHAPE3SCREENUV_ON && SHAPE3_ON + shape3Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh3DistScale); + #else + #if SHAPE3_ON + shape3Uv = originalUvs; + #endif + #endif + #endif + + shape1Uv = TRANSFORM_TEX(shape1Uv, _MainTex); + #if OFFSETSTREAM_ON + shape1Uv.x += i.offsetCustomData.x * _OffsetSh1; + shape1Uv.y += i.offsetCustomData.y * _OffsetSh1; + #endif + #if SHAPETEXOFFSET_ON + shape1Uv += seed * _RandomSh1Mult; + #endif + + #if SHAPE1DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh1DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _ShapeDistortTex); + #else + half2 sh1DistortUvs = d.extraV2F1.xy; + #endif + + sh1DistortUvs.x += ((time + seed) * _ShapeDistortXSpeed) % 1; + sh1DistortUvs.y += ((time + seed) * _ShapeDistortYSpeed) % 1; + half distortAmount = (SAMPLE_TEXTURE2D(_ShapeDistortTex, sampler_ShapeDistortTex, sh1DistortUvs).r - 0.5) * 0.2 * _ShapeDistortAmount; + shape1Uv.x += distortAmount; + shape1Uv.y += distortAmount; + #endif + #if SHAPE1ROTATE_ON + shape1Uv = RotateUvs(shape1Uv, _ShapeRotationOffset + ((_ShapeRotationSpeed * time) % 6.28318530718), _MainTex_ST); + #endif + + half4 shape1 = SampleTextureWithScroll(_MainTex, sampler_MainTex, shape1Uv, _ShapeXSpeed, _ShapeYSpeed, time); + #if SHAPE1SHAPECOLOR_ON + shape1.a = shape1.r; + shape1.rgb = _ShapeColor.rgb; + #else + shape1 *= _ShapeColor; + #endif + #if SHAPE1CONTRAST_ON + #if SHAPE1SHAPECOLOR_ON + shape1.a = saturate((shape1.a - 0.5) * _ShapeContrast + 0.5 + _ShapeBrightness); + #else + shape1.rgb = max(0, (shape1.rgb - half3(0.5, 0.5, 0.5)) * _ShapeContrast + half3(0.5, 0.5, 0.5) + _ShapeBrightness); + #endif + #endif + + half4 shape2 = 1.0; + #if SHAPE2_ON + shape2Uv = TRANSFORM_TEX(shape2Uv, _Shape2Tex); + #if OFFSETSTREAM_ON + shape2Uv.x += i.offsetCustomData.x * _OffsetSh2; + shape2Uv.y += i.offsetCustomData.y * _OffsetSh2; + #endif + #if SHAPETEXOFFSET_ON + shape2Uv += seed * _RandomSh2Mult; + #endif + #if SHAPE2DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh2DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape2DistortTex); + #else + half2 sh2DistortUvs = d.extraV2F2.xy; + #endif + sh2DistortUvs.x += ((time + seed) * _Shape2DistortXSpeed) % 1; + sh2DistortUvs.y += ((time + seed) * _Shape2DistortYSpeed) % 1; + half distortAmnt2 = (SAMPLE_TEXTURE2D(_Shape2DistortTex, sampler_Shape2DistortTex, sh2DistortUvs).r - 0.5) * 0.2 * _Shape2DistortAmount; + shape2Uv.x += distortAmnt2; + shape2Uv.y += distortAmnt2; + #endif + #if SHAPE2ROTATE_ON + shape2Uv = RotateUvs(shape2Uv, _Shape2RotationOffset + ((_Shape2RotationSpeed * time) % 6.28318530718), _Shape2Tex_ST); + #endif + + shape2 = SampleTextureWithScroll(_Shape2Tex, sampler_Shape2Tex, shape2Uv, _Shape2XSpeed, _Shape2YSpeed, time); + #if SHAPE2SHAPECOLOR_ON + shape2.a = shape2.r; + shape2.rgb = _Shape2Color.rgb; + #else + shape2 *= _Shape2Color; + #endif + #if SHAPE2CONTRAST_ON + #if SHAPE2SHAPECOLOR_ON + shape2.a = max(0, (shape2.a - 0.5) * _Shape2Contrast + 0.5 + _Shape2Brightness); + #else + shape2.rgb = max(0, (shape2.rgb - half3(0.5, 0.5, 0.5)) * _Shape2Contrast + half3(0.5, 0.5, 0.5) + _Shape2Brightness); + #endif + #endif + #endif + + half4 shape3 = 1.0; + #if SHAPE3_ON + shape3Uv = TRANSFORM_TEX(shape3Uv, _Shape3Tex); + + #if OFFSETSTREAM_ON + shape3Uv.x += i.offsetCustomData.x * _OffsetSh3; + shape3Uv.y += i.offsetCustomData.y * _OffsetSh3; + #endif + #if SHAPETEXOFFSET_ON + shape3Uv += seed * _RandomSh3Mult; + #endif + #if SHAPE3DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh3DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape3DistortTex); + #else + half2 sh3DistortUvs = d.extraV2F3.xy; + #endif + sh3DistortUvs.x += ((time + seed) * _Shape3DistortXSpeed) % 1; + sh3DistortUvs.y += ((time + seed) * _Shape3DistortYSpeed) % 1; + half distortAmnt3 = (SAMPLE_TEXTURE2D(_Shape3DistortTex, sampler_Shape3DistortTex, sh3DistortUvs).r - 0.5) * 0.3 * _Shape3DistortAmount; + shape3Uv.x += distortAmnt3; + shape3Uv.y += distortAmnt3; + #endif + #if SHAPE3ROTATE_ON + shape3Uv = RotateUvs(shape3Uv, _Shape3RotationOffset + ((_Shape3RotationSpeed * time) % 6.28318530718), _Shape3Tex_ST); + #endif + shape3 = SampleTextureWithScroll(_Shape3Tex, sampler_Shape3Tex, shape3Uv, _Shape3XSpeed, _Shape3YSpeed, time); + #if SHAPE3SHAPECOLOR_ON + shape3.a = shape3.r; + shape3.rgb = _Shape3Color.rgb; + #else + shape3 *= _Shape3Color; + #endif + #if SHAPE3CONTRAST_ON + #if SHAPE3SHAPECOLOR_ON + shape3.a = max(0, (shape3.a - 0.5) * _Shape3Contrast + 0.5 + _Shape3Brightness); + #else + shape3.rgb = max(0, (shape3.rgb - half3(0.5, 0.5, 0.5)) * _Shape3Contrast + half3(0.5, 0.5, 0.5) + _Shape3Brightness); + #endif + #endif + #endif + + half4 col = shape1; + //Mix all shapes pre: change weights if custom vertex effect active + #if SHAPEWEIGHTS_ON + half shapeWeightOffset; + #if SHAPE2_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh1BlendOffset; + _ShapeColorWeight = max(0, _ShapeColorWeight + shapeWeightOffset); + _ShapeAlphaWeight = max(0, _ShapeAlphaWeight + shapeWeightOffset); + shapeWeightOffset = i.offsetCustomData.z * _Sh2BlendOffset; + _Shape2ColorWeight = max(0, _Shape2ColorWeight + shapeWeightOffset); + _Shape2AlphaWeight = max(0, _Shape2AlphaWeight + shapeWeightOffset); + #endif + #if SHAPE3_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh3BlendOffset; + _Shape3ColorWeight = max(0, _Shape3ColorWeight + shapeWeightOffset); + _Shape3AlphaWeight = max(0, _Shape3AlphaWeight + shapeWeightOffset); + #endif + #endif + + //Mix all shapes + #if SHAPE2_ON + #if !SPLITRGBA_ON + _ShapeAlphaWeight = _ShapeColorWeight; + _Shape2AlphaWeight = _Shape2ColorWeight; + #endif + #if SHAPE3_ON //Shape3 On + #if !SPLITRGBA_ON + _Shape3AlphaWeight = _Shape3ColorWeight; + #endif + #if SHAPEADD_ON + col.rgb = ((shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight)) + (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(max(shape3.a * _Shape3AlphaWeight, max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight))); + #else + col.rgb = ((shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight)) * (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)) * (shape3.a * _Shape3AlphaWeight)); + #endif + #else //Shape3 Off + #if SHAPEADD_ON + col.rgb = (shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight); + col.a = saturate(max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight)); + #else + col.rgb = (shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight); + col.a = saturate((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)); + #endif + #endif + #endif + + #if SHAPE1MASK_ON + col = lerp(col, shape1, pow(SAMPLE_TEXTURE2D(_Shape1MaskTex, sampler_Shape1MaskTex, TRANSFORM_TEX(i.uvSeed.xy, _Shape1MaskTex)).r, _Shape1MaskPow)); + #endif + + #if PREMULTIPLYCOLOR_ON + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + col.a = min(luminance, col.a); + #endif + + col.rgb *= _Color.rgb * d.vertexColor.rgb; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if !PREMULTIPLYCOLOR_ON && (COLORRAMP_ON || ALPHAFADE_ON || COLORGRADING_ON || FADE_ON || (ADDITIVECONFIG_ON && (GLOW_ON || DEPTHGLOW_ON))) + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + #endif + + #if (FADE_ON || ALPHAFADE_ON) && ALPHAFADEINPUTSTREAM_ON + col.a *= d.vertexColor.a; + d.vertexColor.a = d.texcoord0.w; + #endif + + #if FADE_ON + half preFadeAlpha = col.a; + _FadeAmount = saturate(_FadeAmount + (1 - d.vertexColor.a)); + _FadeTransition = max(0.01, _FadeTransition * EaseOutQuint(saturate(_FadeAmount))); + half2 fadeUv; + fadeUv = d.texcoord0.xy + seed; + fadeUv.x += (time * _FadeScrollXSpeed) % 1; + fadeUv.y += (time * _FadeScrollYSpeed) % 1; + half2 tiledUvFade1 = TRANSFORM_TEX(fadeUv, _FadeTex); + #if ADDITIVECONFIG_ON && !PREMULTIPLYCOLOR_ON + preFadeAlpha *= luminance; + #endif + _FadeAmount = saturate(pow(_FadeAmount, _FadePower)); + #if FADEBURN_ON + half2 tiledUvFade2 = TRANSFORM_TEX(fadeUv, _FadeBurnTex); + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fadeNaturalEdge = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fadeNaturalEdge; + half fadeBurn = saturate(smoothstep(0.0 , _FadeTransition + _FadeBurnWidth, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + fadeBurn = fadeNaturalEdge - fadeBurn; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col.rgb += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2).rgb * _FadeBurnColor.rgb * preFadeAlpha; + #else + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + float fade = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fade; + #endif + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _FadeAmount; + #endif + #endif + + #if ALPHAFADE_ON + half alphaFadeLuminance; + _AlphaFadeAmount = saturate(_AlphaFadeAmount + (1 - d.vertexColor.a)); + _AlphaFadeAmount = saturate(pow(_AlphaFadeAmount, _AlphaFadePow)); + _AlphaFadeSmooth = max(0.01, _AlphaFadeSmooth * EaseOutQuint(saturate(_AlphaFadeAmount))); + #if ALPHAFADEUSESHAPE1_ON + alphaFadeLuminance = shape1.r; + #else + alphaFadeLuminance = luminance; + #endif + alphaFadeLuminance = saturate(alphaFadeLuminance - 0.001); + #if ALPHAFADEUSEREDCHANNEL_ON + col.a *= col.r; + #endif + col.a = saturate(col.a); + float alphaFade = saturate(smoothstep(0.0 , _AlphaFadeSmooth, RemapFloat(1.0 - _AlphaFadeAmount, 0.0, 1.0, -1.0, 1.0) + alphaFadeLuminance)); + col.a *= alphaFade; + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _AlphaFadeAmount; + #endif + #endif + + #if BACKFACETINT_ON + col.rgb = lerp(col.rgb * _BackFaceTint, col.rgb * _FrontFaceTint, step(0, dot(d.worldSpaceNormal, d.worldSpaceViewDir))); + #endif + + //#if LIGHTANDSHADOW_ON + //half NdL = saturate(dot(d.worldSpaceNormal, -_All1VfxLightDir)); + //col.rgb += _LightColor * _LightAmount * NdL; + //NdL = max(_ShadowAmount, NdL); + //NdL = smoothstep(_ShadowStepMin, _ShadowStepMax, NdL); + //col.rgb *= NdL; + //#endif + + #if COLORGRADING_ON + col.rgb *= lerp(lerp(_ColorGradingDark, _ColorGradingMiddle, luminance/_ColorGradingMidPoint), + lerp(_ColorGradingMiddle, _ColorGradingLight, (luminance - _ColorGradingMidPoint)/(1.0 - _ColorGradingMidPoint)), step(_ColorGradingMidPoint, luminance)); + #endif + + #if COLORRAMP_ON + half colorRampLuminance = saturate(luminance + _ColorRampLuminosity); + #if COLORRAMPGRAD_ON + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(colorRampLuminance, 0)); + #else + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(colorRampLuminance, 0)); + #endif + col.rgb = lerp(col.rgb, colorRampRes.rgb, _ColorRampBlend); + col.a = lerp(col.a, saturate(col.a * colorRampRes.a), _ColorRampBlend); + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = floor(col.rgb / (1.0 / _PosterizeNumColors)) * (1.0 / _PosterizeNumColors); + #endif + + #if DEPTHGLOW_ON + half sceneDepthDiff = GetLinearEyeDepth(d.screenUV) - d.screenPos.w; + #endif + + #if RIM_ON + half NdV = 1 - abs(dot(d.worldSpaceNormal, d.worldSpaceViewDir)); + half rimFactor = saturate(_RimBias + _RimScale * pow(NdV, _RimPower)); + half4 rimCol = _RimColor * rimFactor; + rimCol.rgb *= _RimIntensity; + col.rgb = lerp(col.rgb * (rimCol.rgb + half3(1,1,1)), col.rgb + rimCol.rgb, _RimAddAmount); + col.a = saturate(col.a * (1 - rimFactor * _RimErodesAlpha)); + #endif + + #if DEPTHGLOW_ON + half depthGlowMask = saturate(_DepthGlowDist * pow((1 - sceneDepthDiff), _DepthGlowPow)); + col.rgb = lerp(col.rgb, _DepthGlowGlobal * col.rgb, depthGlowMask); + half depthGlowMult = 1; + #if ADDITIVECONFIG_ON + depthGlowMult = luminance; + #endif + col.rgb += _DepthGlowColor.rgb * _DepthGlow * depthGlowMask * col.a * depthGlowMult; + #endif + + #if GLOW_ON + half glowMask = 1; + #if GLOWTEX_ON + glowMask = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, TRANSFORM_TEX(d.texcoord0.xy, _GlowTex)); + #endif + col.rgb *= _GlowGlobal * glowMask; + half glowMult = 1; + #if ADDITIVECONFIG_ON + glowMult = luminance; + #endif + + col.rgb += _GlowColor.rgb * _Glow * glowMask * col.a * glowMult; + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if CAMDISTFADE_ON + col.a *= 1 - saturate(smoothstep(_CamDistFadeStepMin, _CamDistFadeStepMax, camDistance)); + col.a *= smoothstep(0.0, _CamDistProximityFade, camDistance); + #endif + + #if MASK_ON + half2 maskUv = d.texcoord0.xy; + #if POLARUV_ON + maskUv = prePolarUvs; + #endif + half4 maskSample = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, TRANSFORM_TEX(maskUv, _MaskTex)); + half mask = pow(min(maskSample.r, maskSample.a), _MaskPow); + col.a *= mask; + #endif + + #if ALPHASMOOTHSTEP_ON + col.a = smoothstep(_AlphaStepMin, _AlphaStepMax, col.a); + #endif + + half4 debugColor = col; + #if SHAPEDEBUG_ON + debugColor = GetDebugColor(col, shape1, shape2, shape3); + #endif + + clip(debugColor.a - _AlphaCutoffValue - 0.01); + + //#if FOG_ON + //UNITY_APPLY_FOG(i.fogCoord, col); + //#endif + + //Don't use a starting i.color.a lower than 1 unless using vertex stream dissolve when using a FADE effect + #if !FADE_ON && !ALPHAFADE_ON + col.a *= _Alpha * d.vertexColor.a; + #endif + #if FADE_ON || ALPHAFADE_ON + col.a *= _Alpha; + #endif + #if ADDITIVECONFIG_ON + col.rgb *= col.a; + #endif + + + #if SHAPEDEBUG_ON + o.Albedo = debugColor.rgb; + o.Alpha = debugColor.a; + #else + o.Albedo = col.rgb; + o.Alpha = col.a; + #endif + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + // d.texcoord1 = i.texcoord1; + // d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenPos = i.screenPos; + d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + // o.texcoord1 = v.texcoord1; + // o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + // o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) && USE_UNITY_CROSSFADE + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + return 0; + + } + + ENDHLSL + + } + + + + Pass + { + Name "Meta" + Tags + { + "LightMode" = "Meta" + } + + Cull Off + + + Tags + { + "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" + } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + ColorMask [_ColorMask] +Lighting Off + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + + #define SHADERPASS SHADERPASS_META + #define _PASSMETA 1 + + + + #pragma shader_feature_local TIMEISCUSTOM_ON + #pragma shader_feature_local ADDITIVECONFIG_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + #pragma shader_feature_local PREMULTIPLYCOLOR_ON + #pragma shader_feature_local SPLITRGBA_ON + #pragma shader_feature_local SHAPEADD_ON + + #pragma shader_feature_local SHAPE1SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE2SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE3SCREENUV_ON /////////////////Pipeline specific implementation + + #pragma shader_feature_local SHAPEDEBUG_ON + + #pragma shader_feature_local SHAPE1CONTRAST_ON + #pragma shader_feature_local SHAPE1DISTORT_ON + #pragma shader_feature_local SHAPE1ROTATE_ON + #pragma shader_feature_local SHAPE1SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE2_ON + #pragma shader_feature_local SHAPE2CONTRAST_ON + #pragma shader_feature_local SHAPE2DISTORT_ON + #pragma shader_feature_local SHAPE2ROTATE_ON + #pragma shader_feature_local SHAPE2SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE3_ON + #pragma shader_feature_local SHAPE3CONTRAST_ON + #pragma shader_feature_local SHAPE3DISTORT_ON + #pragma shader_feature_local SHAPE3ROTATE_ON + #pragma shader_feature_local SHAPE3SHAPECOLOR_ON + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local DEPTHGLOW_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local MASK_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local COLORRAMPGRAD_ON + #pragma shader_feature_local COLORGRADING_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local SHAKEUV_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local OFFSETSTREAM_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local VERTOFFSET_ON + #pragma shader_feature_local RIM_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local BACKFACETINT_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local POLARUVDISTORT_ON + #pragma shader_feature_local SHAPE1MASK_ON + #pragma shader_feature_local TRAILWIDTH_ON + #pragma shader_feature_local LIGHTANDSHADOW_ON + #pragma shader_feature_local SHAPETEXOFFSET_ON + #pragma shader_feature_local SHAPEWEIGHTS_ON + + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHASMOOTHSTEP_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local FADEBURN_ON + #pragma shader_feature_local ALPHAFADE_ON + #pragma shader_feature_local ALPHAFADEUSESHAPE1_ON + #pragma shader_feature_local ALPHAFADEUSEREDCHANNEL_ON + #pragma shader_feature_local ALPHAFADETRANSPARENCYTOO_ON + #pragma shader_feature_local ALPHAFADEINPUTSTREAM_ON + #pragma shader_feature_local CAMDISTFADE_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define REQUIRE_DEPTH_TEXTURE + + + + // Includes + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + // float4 texcoord1 : TEXCOORD4; + // float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half _Alpha; + half _AlphaCutoffValue; + + half _TimingSeed; + + #if TIMEISCUSTOM_ON + float4 globalCustomTime; + #endif + + half4 _MainTex_ST, _ShapeColor; + half _ShapeXSpeed, _ShapeYSpeed, _ShapeColorWeight, _ShapeAlphaWeight; + + #if SHAPE1CONTRAST_ON + half _ShapeContrast, _ShapeBrightness; + #endif + + #if SHAPE1DISTORT_ON + half4 _ShapeDistortTex_ST; + half _ShapeDistortAmount, _ShapeDistortXSpeed, _ShapeDistortYSpeed; + #endif + + #if SHAPE1ROTATE_ON + half _ShapeRotationOffset, _ShapeRotationSpeed; + #endif + + #if OFFSETSTREAM_ON + half _OffsetSh1; + #endif + + #if SHAPEWEIGHTS_ON + half _Sh1BlendOffset; + #endif + + #if SHAPE2_ON + half4 _Shape2Tex_ST, _Shape2Color; + half _Shape2XSpeed, _Shape2YSpeed, _Shape2ColorWeight, _Shape2AlphaWeight; + #if SHAPE2CONTRAST_ON + half _Shape2Contrast, _Shape2Brightness; + #endif + #if SHAPE2DISTORT_ON + half4 _Shape2DistortTex_ST; + half _Shape2DistortAmount, _Shape2DistortXSpeed, _Shape2DistortYSpeed; + #endif + #if SHAPE2ROTATE_ON + half _Shape2RotationOffset, _Shape2RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh2; + #endif + #if SHAPEWEIGHTS_ON + half _Sh2BlendOffset; + #endif + #endif + + #if SHAPE3_ON + half4 _Shape3Tex_ST, _Shape3Color; + half _Shape3XSpeed, _Shape3YSpeed, _Shape3ColorWeight, _Shape3AlphaWeight; + #if SHAPE3CONTRAST_ON + half _Shape3Contrast, _Shape3Brightness; + #endif + #if SHAPE3DISTORT_ON + half4 _Shape3DistortTex_ST; + half _Shape3DistortAmount, _Shape3DistortXSpeed, _Shape3DistortYSpeed; + #endif + #if SHAPE3ROTATE_ON + half _Shape3RotationOffset, _Shape3RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh3; + #endif + #if SHAPEWEIGHTS_ON + half _Sh3BlendOffset; + #endif + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #if GLOWTEX_ON + half4 _GlowTex_ST; + #endif + #endif + + #if MASK_ON + half4 _MaskTex_ST; + half _MaskPow; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if ALPHASMOOTHSTEP_ON + half _AlphaStepMin, _AlphaStepMax; + #endif + + #if ALPHAFADE_ON + half _AlphaFadeAmount, _AlphaFadeSmooth, _AlphaFadePow; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + half _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if ROUNDWAVEUV_ON || PIXELATE_ON + half4 _MainTex_TexelSize; + #endif + + #if VERTOFFSET_ON + half4 _VertOffsetTex_ST; + half _VertOffsetAmount, _VertOffsetPower, _VertOffsetTexXSpeed, _VertOffsetTexYSpeed; + #endif + + #if FADE_ON + half4 _FadeTex_ST; + half _FadeAmount, _FadeTransition, _FadePower, _FadeScrollXSpeed, _FadeScrollYSpeed; + #if FADEBURN_ON + half4 _FadeBurnColor, _FadeBurnTex_ST; + half _FadeBurnWidth, _FadeBurnGlow; + #endif + #endif + + #if COLORGRADING_ON + half3 _ColorGradingLight, _ColorGradingMiddle, _ColorGradingDark; + half _ColorGradingMidPoint; + #endif + + #if CAMDISTFADE_ON + half _CamDistFadeStepMin, _CamDistFadeStepMax, _CamDistProximityFade; + #endif + + #if RIM_ON + half _RimBias, _RimScale, _RimPower, _RimIntensity, _RimAddAmount, _RimErodesAlpha; + half4 _RimColor; + #endif + + #if BACKFACETINT_ON + half4 _BackFaceTint, _FrontFaceTint; + #endif + + #if SHAPEDEBUG_ON + half _DebugShape; + #endif + + #if SHAPE1MASK_ON + half4 _Shape1MaskTex_ST; + half _Shape1MaskPow; + #endif + + #if TRAILWIDTH_ON + half _TrailWidthPower; + #endif + + #if LIGHTANDSHADOW_ON + half3 _All1VfxLightDir; + half _ShadowAmount, _ShadowStepMin, _ShadowStepMax, _LightAmount; + half4 _LightColor; + #endif + + #if SHAPETEXOFFSET_ON + half _RandomSh1Mult, _RandomSh2Mult, _RandomSh3Mult; + #endif + + #if DEPTHGLOW_ON + half _DepthGlowDist, _DepthGlowPow, _DepthGlow, _DepthGlowGlobal; + half4 _DepthGlowColor; + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half _ScreenUvShDistScale,_ScreenUvSh2DistScale, _ScreenUvSh3DistScale; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if SHAPE1DISTORT_ON + TEXTURE2D(_ShapeDistortTex); + SAMPLER(sampler_ShapeDistortTex); + #endif + + #if SHAPE2_ON + TEXTURE2D(_Shape2Tex); + SAMPLER(sampler_Shape2Tex); + #if SHAPE2DISTORT_ON + TEXTURE2D(_Shape2DistortTex); + SAMPLER(sampler_Shape2DistortTex); + #endif + #endif + + #if SHAPE3_ON + TEXTURE2D(_Shape3Tex); + SAMPLER(sampler_Shape3Tex); + #if SHAPE3DISTORT_ON + TEXTURE2D(_Shape3DistortTex); + SAMPLER(sampler_Shape3DistortTex); + #endif + #endif + + #if GLOW_ON + #if GLOWTEX_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + #endif + + #if MASK_ON + TEXTURE2D(_MaskTex); + SAMPLER(sampler_MaskTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + SAMPLER(sampler_ColorRampTex); + #endif + + #if COLORRAMPGRAD_ON + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if VERTOFFSET_ON + TEXTURE2D(_VertOffsetTex); + SAMPLER(sampler_VertOffsetTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + #if FADEBURN_ON + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + #endif + + #if SHAPE1MASK_ON + TEXTURE2D(_Shape1MaskTex); + SAMPLER(sampler_Shape1MaskTex); + #endif + + #if TRAILWIDTH_ON + TEXTURE2D(_TrailWidthGradient); + SAMPLER(sampler_TrailWidthGradient); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + half4 SampleTextureWithScroll(in Texture2D _tex, in SamplerState _sampler, in float2 uv, in half scrollXSpeed, in half scrollYSpeed, in float time) + { + half2 _uv = uv; + _uv.x += (time * scrollXSpeed) % 1; + _uv.y += (time * scrollYSpeed) % 1; + return SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + } + + half EaseOutQuint(half x) + { + return 1 - pow(1 - x, 5); + } + + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax) + { + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + + float2 RotateUvs(float2 uv, half rotation, half4 scaleAndTranslate) + { + half2 center = half2(0.5 * scaleAndTranslate.x + scaleAndTranslate.z, 0.5 * scaleAndTranslate.y + scaleAndTranslate.w); + half cosAngle = cos(rotation); + half sinAngle = sin(rotation); + uv -= center; + uv = mul(half2x2(cosAngle, -sinAngle, sinAngle, cosAngle), uv); + uv += center; + return uv; + } + + half4 GetDebugColor(float4 resColor, half4 shape1, half4 shape2, half4 shape3) + { + half4 res = resColor; + + //MAKE SURE THE FOLLOWING CODE BLOCK IS UNCOMMENTED------------------------------------------- + #if SHAPEDEBUG_ON + if(_DebugShape < 1.5) return shape1; + #if SHAPE2_ON + else if (_DebugShape < 2.5) return shape2; + #endif + #if SHAPE3_ON + else return shape3; + #endif + #endif + + return res; + } + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //uvDistTex --> extraV2F0 + //uvSh1DistTex --> extraV2F1 + //uvSh2DistTex --> extraV2F2 + //uvSh3DistTex --> extraV2F3 + + #if VERTOFFSET_ON + #if TIMEISCUSTOM_ON + const half time = v.texcoord0.z + globalCustomTime.y; + #else + const half time = v.texcoord0.z + _Time.y; + #endif + half4 offsetUv = half4(TRANSFORM_TEX(v.texcoord0.xy, _VertOffsetTex), 0, 0); + offsetUv.x += (time * _VertOffsetTexXSpeed) % 1; + offsetUv.y += (time * _VertOffsetTexYSpeed) % 1; + v.vertex.xyz += v.normal * _VertOffsetAmount * pow(SAMPLE_TEXTURE2D_LOD(_VertOffsetTex, sampler_VertOffsetTex, offsetUv, 0).r, _VertOffsetPower); + #endif + + #if DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F0.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + + #if SHAPE1DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F1.xy = TRANSFORM_TEX(v.texcoord0.xy, _ShapeDistortTex); + #endif + + #if SHAPE2_ON + #if SHAPE2DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F2.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape2DistortTex);; + #endif + #endif + + #if SHAPE3_ON + #if SHAPE3DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F3.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape3DistortTex); + #endif + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + //i.uvSeed -> d.texcoord0.xy + + float seed = d.texcoord0.z + _TimingSeed; + #if TIMEISCUSTOM_ON + const float4 shaderTime = globalCustomTime; + #else + const float4 shaderTime = _Time; + #endif + float time = shaderTime.y + seed; + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 originalUvs = d.texcoord0.xy; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + #if TWISTUV_ON + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + #if DOODLE_ON + half2 uvCopy = d.texcoord0.xy; + _HandDrawnSpeed = (floor((shaderTime.x + seed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if WAVEUV_ON + half2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + half angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((time * _WaveSpeed) % 360.0); + d.texcoord0.xy = d.texcoord0.xy + normalize(uvWave) * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - d.texcoord0.x); + half yWave = ((0.5 * _MainTex_ST.y) - d.texcoord0.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + time * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if POLARUV_ON + half2 prePolarUvs = d.texcoord0.xy; + d.texcoord0.xy = d.texcoord0.xy - half2(0.5, 0.5); + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (1.0 * 6.28318530718), length(d.texcoord0.xy) * 2.0); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + #if DISTORT_ON + #if POLARUVDISTORT_ON + half2 distortUvs = TRANSFORM_TEX(d.texcoord0.xy, _DistortTex); + #else + half2 distortUvs = d.extraV2F0.xy; + #endif + distortUvs.x += ((shaderTime.x + seed) * _DistortTexXSpeed) % 1; + distortUvs.y += ((shaderTime.x + seed) * _DistortTexYSpeed) % 1; + #if ATLAS_ON + d.extraV2F0.xy = half2((d.extraV2F0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.extraV2F0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, distortUvs).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + + #if TEXTURESCROLL_ON + d.texcoord0.x += (time * _TextureScrollXSpeed) % 1; + d.texcoord0.y += (time * _TextureScrollYSpeed) % 1; + #endif + + #if TRAILWIDTH_ON + half width = pow(SAMPLE_TEXTURE2D(_TrailWidthGradient, sampler_TrailWidthGradient, d.texcoord0).r, _TrailWidthPower); + d.texcoord0.y = (d.texcoord0.y * 2 - 1) / width * 0.5 + 0.5; + clip(d.texcoord0.y); + clip(1 - d.texcoord0.y); + #endif + + float2 shape1Uv = d.texcoord0.xy; + #if SHAPE2_ON + float2 shape2Uv = shape1Uv; + #endif + #if SHAPE3_ON + float2 shape3Uv = shape1Uv; + #endif + + #if CAMDISTFADE_ON || SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half camDistance = distance(d.worldSpacePosition, _WorldSpaceCameraPos); + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 uvOffsetPostFx = d.texcoord0.xy - originalUvs; + d.texcoord0.xy = d.screenPos.xy / d.screenPos.w; + d.texcoord0.x = d.texcoord0.x * (_ScreenParams.x / _ScreenParams.y); + d.texcoord0.x -= 0.5; + d.texcoord0.xy -= uvOffsetPostFx; + originalUvs += uvOffsetPostFx; + half distanceZoom = camDistance * 0.1; + half2 scaleWithDistUvs = d.texcoord0.xy * distanceZoom + ((-distanceZoom * 0.5) + 0.5); + #if SHAPE1SCREENUV_ON + shape1Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvShDistScale); + #else + shape1Uv = originalUvs; + #endif + #if SHAPE2SCREENUV_ON && SHAPE2_ON + shape2Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh2DistScale); + #else + #if SHAPE2_ON + shape2Uv = originalUvs; + #endif + #endif + #if SHAPE3SCREENUV_ON && SHAPE3_ON + shape3Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh3DistScale); + #else + #if SHAPE3_ON + shape3Uv = originalUvs; + #endif + #endif + #endif + + shape1Uv = TRANSFORM_TEX(shape1Uv, _MainTex); + #if OFFSETSTREAM_ON + shape1Uv.x += i.offsetCustomData.x * _OffsetSh1; + shape1Uv.y += i.offsetCustomData.y * _OffsetSh1; + #endif + #if SHAPETEXOFFSET_ON + shape1Uv += seed * _RandomSh1Mult; + #endif + + #if SHAPE1DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh1DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _ShapeDistortTex); + #else + half2 sh1DistortUvs = d.extraV2F1.xy; + #endif + + sh1DistortUvs.x += ((time + seed) * _ShapeDistortXSpeed) % 1; + sh1DistortUvs.y += ((time + seed) * _ShapeDistortYSpeed) % 1; + half distortAmount = (SAMPLE_TEXTURE2D(_ShapeDistortTex, sampler_ShapeDistortTex, sh1DistortUvs).r - 0.5) * 0.2 * _ShapeDistortAmount; + shape1Uv.x += distortAmount; + shape1Uv.y += distortAmount; + #endif + #if SHAPE1ROTATE_ON + shape1Uv = RotateUvs(shape1Uv, _ShapeRotationOffset + ((_ShapeRotationSpeed * time) % 6.28318530718), _MainTex_ST); + #endif + + half4 shape1 = SampleTextureWithScroll(_MainTex, sampler_MainTex, shape1Uv, _ShapeXSpeed, _ShapeYSpeed, time); + #if SHAPE1SHAPECOLOR_ON + shape1.a = shape1.r; + shape1.rgb = _ShapeColor.rgb; + #else + shape1 *= _ShapeColor; + #endif + #if SHAPE1CONTRAST_ON + #if SHAPE1SHAPECOLOR_ON + shape1.a = saturate((shape1.a - 0.5) * _ShapeContrast + 0.5 + _ShapeBrightness); + #else + shape1.rgb = max(0, (shape1.rgb - half3(0.5, 0.5, 0.5)) * _ShapeContrast + half3(0.5, 0.5, 0.5) + _ShapeBrightness); + #endif + #endif + + half4 shape2 = 1.0; + #if SHAPE2_ON + shape2Uv = TRANSFORM_TEX(shape2Uv, _Shape2Tex); + #if OFFSETSTREAM_ON + shape2Uv.x += i.offsetCustomData.x * _OffsetSh2; + shape2Uv.y += i.offsetCustomData.y * _OffsetSh2; + #endif + #if SHAPETEXOFFSET_ON + shape2Uv += seed * _RandomSh2Mult; + #endif + #if SHAPE2DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh2DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape2DistortTex); + #else + half2 sh2DistortUvs = d.extraV2F2.xy; + #endif + sh2DistortUvs.x += ((time + seed) * _Shape2DistortXSpeed) % 1; + sh2DistortUvs.y += ((time + seed) * _Shape2DistortYSpeed) % 1; + half distortAmnt2 = (SAMPLE_TEXTURE2D(_Shape2DistortTex, sampler_Shape2DistortTex, sh2DistortUvs).r - 0.5) * 0.2 * _Shape2DistortAmount; + shape2Uv.x += distortAmnt2; + shape2Uv.y += distortAmnt2; + #endif + #if SHAPE2ROTATE_ON + shape2Uv = RotateUvs(shape2Uv, _Shape2RotationOffset + ((_Shape2RotationSpeed * time) % 6.28318530718), _Shape2Tex_ST); + #endif + + shape2 = SampleTextureWithScroll(_Shape2Tex, sampler_Shape2Tex, shape2Uv, _Shape2XSpeed, _Shape2YSpeed, time); + #if SHAPE2SHAPECOLOR_ON + shape2.a = shape2.r; + shape2.rgb = _Shape2Color.rgb; + #else + shape2 *= _Shape2Color; + #endif + #if SHAPE2CONTRAST_ON + #if SHAPE2SHAPECOLOR_ON + shape2.a = max(0, (shape2.a - 0.5) * _Shape2Contrast + 0.5 + _Shape2Brightness); + #else + shape2.rgb = max(0, (shape2.rgb - half3(0.5, 0.5, 0.5)) * _Shape2Contrast + half3(0.5, 0.5, 0.5) + _Shape2Brightness); + #endif + #endif + #endif + + half4 shape3 = 1.0; + #if SHAPE3_ON + shape3Uv = TRANSFORM_TEX(shape3Uv, _Shape3Tex); + + #if OFFSETSTREAM_ON + shape3Uv.x += i.offsetCustomData.x * _OffsetSh3; + shape3Uv.y += i.offsetCustomData.y * _OffsetSh3; + #endif + #if SHAPETEXOFFSET_ON + shape3Uv += seed * _RandomSh3Mult; + #endif + #if SHAPE3DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh3DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape3DistortTex); + #else + half2 sh3DistortUvs = d.extraV2F3.xy; + #endif + sh3DistortUvs.x += ((time + seed) * _Shape3DistortXSpeed) % 1; + sh3DistortUvs.y += ((time + seed) * _Shape3DistortYSpeed) % 1; + half distortAmnt3 = (SAMPLE_TEXTURE2D(_Shape3DistortTex, sampler_Shape3DistortTex, sh3DistortUvs).r - 0.5) * 0.3 * _Shape3DistortAmount; + shape3Uv.x += distortAmnt3; + shape3Uv.y += distortAmnt3; + #endif + #if SHAPE3ROTATE_ON + shape3Uv = RotateUvs(shape3Uv, _Shape3RotationOffset + ((_Shape3RotationSpeed * time) % 6.28318530718), _Shape3Tex_ST); + #endif + shape3 = SampleTextureWithScroll(_Shape3Tex, sampler_Shape3Tex, shape3Uv, _Shape3XSpeed, _Shape3YSpeed, time); + #if SHAPE3SHAPECOLOR_ON + shape3.a = shape3.r; + shape3.rgb = _Shape3Color.rgb; + #else + shape3 *= _Shape3Color; + #endif + #if SHAPE3CONTRAST_ON + #if SHAPE3SHAPECOLOR_ON + shape3.a = max(0, (shape3.a - 0.5) * _Shape3Contrast + 0.5 + _Shape3Brightness); + #else + shape3.rgb = max(0, (shape3.rgb - half3(0.5, 0.5, 0.5)) * _Shape3Contrast + half3(0.5, 0.5, 0.5) + _Shape3Brightness); + #endif + #endif + #endif + + half4 col = shape1; + //Mix all shapes pre: change weights if custom vertex effect active + #if SHAPEWEIGHTS_ON + half shapeWeightOffset; + #if SHAPE2_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh1BlendOffset; + _ShapeColorWeight = max(0, _ShapeColorWeight + shapeWeightOffset); + _ShapeAlphaWeight = max(0, _ShapeAlphaWeight + shapeWeightOffset); + shapeWeightOffset = i.offsetCustomData.z * _Sh2BlendOffset; + _Shape2ColorWeight = max(0, _Shape2ColorWeight + shapeWeightOffset); + _Shape2AlphaWeight = max(0, _Shape2AlphaWeight + shapeWeightOffset); + #endif + #if SHAPE3_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh3BlendOffset; + _Shape3ColorWeight = max(0, _Shape3ColorWeight + shapeWeightOffset); + _Shape3AlphaWeight = max(0, _Shape3AlphaWeight + shapeWeightOffset); + #endif + #endif + + //Mix all shapes + #if SHAPE2_ON + #if !SPLITRGBA_ON + _ShapeAlphaWeight = _ShapeColorWeight; + _Shape2AlphaWeight = _Shape2ColorWeight; + #endif + #if SHAPE3_ON //Shape3 On + #if !SPLITRGBA_ON + _Shape3AlphaWeight = _Shape3ColorWeight; + #endif + #if SHAPEADD_ON + col.rgb = ((shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight)) + (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(max(shape3.a * _Shape3AlphaWeight, max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight))); + #else + col.rgb = ((shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight)) * (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)) * (shape3.a * _Shape3AlphaWeight)); + #endif + #else //Shape3 Off + #if SHAPEADD_ON + col.rgb = (shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight); + col.a = saturate(max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight)); + #else + col.rgb = (shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight); + col.a = saturate((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)); + #endif + #endif + #endif + + #if SHAPE1MASK_ON + col = lerp(col, shape1, pow(SAMPLE_TEXTURE2D(_Shape1MaskTex, sampler_Shape1MaskTex, TRANSFORM_TEX(i.uvSeed.xy, _Shape1MaskTex)).r, _Shape1MaskPow)); + #endif + + #if PREMULTIPLYCOLOR_ON + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + col.a = min(luminance, col.a); + #endif + + col.rgb *= _Color.rgb * d.vertexColor.rgb; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if !PREMULTIPLYCOLOR_ON && (COLORRAMP_ON || ALPHAFADE_ON || COLORGRADING_ON || FADE_ON || (ADDITIVECONFIG_ON && (GLOW_ON || DEPTHGLOW_ON))) + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + #endif + + #if (FADE_ON || ALPHAFADE_ON) && ALPHAFADEINPUTSTREAM_ON + col.a *= d.vertexColor.a; + d.vertexColor.a = d.texcoord0.w; + #endif + + #if FADE_ON + half preFadeAlpha = col.a; + _FadeAmount = saturate(_FadeAmount + (1 - d.vertexColor.a)); + _FadeTransition = max(0.01, _FadeTransition * EaseOutQuint(saturate(_FadeAmount))); + half2 fadeUv; + fadeUv = d.texcoord0.xy + seed; + fadeUv.x += (time * _FadeScrollXSpeed) % 1; + fadeUv.y += (time * _FadeScrollYSpeed) % 1; + half2 tiledUvFade1 = TRANSFORM_TEX(fadeUv, _FadeTex); + #if ADDITIVECONFIG_ON && !PREMULTIPLYCOLOR_ON + preFadeAlpha *= luminance; + #endif + _FadeAmount = saturate(pow(_FadeAmount, _FadePower)); + #if FADEBURN_ON + half2 tiledUvFade2 = TRANSFORM_TEX(fadeUv, _FadeBurnTex); + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fadeNaturalEdge = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fadeNaturalEdge; + half fadeBurn = saturate(smoothstep(0.0 , _FadeTransition + _FadeBurnWidth, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + fadeBurn = fadeNaturalEdge - fadeBurn; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col.rgb += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2).rgb * _FadeBurnColor.rgb * preFadeAlpha; + #else + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + float fade = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fade; + #endif + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _FadeAmount; + #endif + #endif + + #if ALPHAFADE_ON + half alphaFadeLuminance; + _AlphaFadeAmount = saturate(_AlphaFadeAmount + (1 - d.vertexColor.a)); + _AlphaFadeAmount = saturate(pow(_AlphaFadeAmount, _AlphaFadePow)); + _AlphaFadeSmooth = max(0.01, _AlphaFadeSmooth * EaseOutQuint(saturate(_AlphaFadeAmount))); + #if ALPHAFADEUSESHAPE1_ON + alphaFadeLuminance = shape1.r; + #else + alphaFadeLuminance = luminance; + #endif + alphaFadeLuminance = saturate(alphaFadeLuminance - 0.001); + #if ALPHAFADEUSEREDCHANNEL_ON + col.a *= col.r; + #endif + col.a = saturate(col.a); + float alphaFade = saturate(smoothstep(0.0 , _AlphaFadeSmooth, RemapFloat(1.0 - _AlphaFadeAmount, 0.0, 1.0, -1.0, 1.0) + alphaFadeLuminance)); + col.a *= alphaFade; + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _AlphaFadeAmount; + #endif + #endif + + #if BACKFACETINT_ON + col.rgb = lerp(col.rgb * _BackFaceTint, col.rgb * _FrontFaceTint, step(0, dot(d.worldSpaceNormal, d.worldSpaceViewDir))); + #endif + + //#if LIGHTANDSHADOW_ON + //half NdL = saturate(dot(d.worldSpaceNormal, -_All1VfxLightDir)); + //col.rgb += _LightColor * _LightAmount * NdL; + //NdL = max(_ShadowAmount, NdL); + //NdL = smoothstep(_ShadowStepMin, _ShadowStepMax, NdL); + //col.rgb *= NdL; + //#endif + + #if COLORGRADING_ON + col.rgb *= lerp(lerp(_ColorGradingDark, _ColorGradingMiddle, luminance/_ColorGradingMidPoint), + lerp(_ColorGradingMiddle, _ColorGradingLight, (luminance - _ColorGradingMidPoint)/(1.0 - _ColorGradingMidPoint)), step(_ColorGradingMidPoint, luminance)); + #endif + + #if COLORRAMP_ON + half colorRampLuminance = saturate(luminance + _ColorRampLuminosity); + #if COLORRAMPGRAD_ON + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(colorRampLuminance, 0)); + #else + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(colorRampLuminance, 0)); + #endif + col.rgb = lerp(col.rgb, colorRampRes.rgb, _ColorRampBlend); + col.a = lerp(col.a, saturate(col.a * colorRampRes.a), _ColorRampBlend); + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = floor(col.rgb / (1.0 / _PosterizeNumColors)) * (1.0 / _PosterizeNumColors); + #endif + + #if DEPTHGLOW_ON + half sceneDepthDiff = GetLinearEyeDepth(d.screenUV) - d.screenPos.w; + #endif + + #if RIM_ON + half NdV = 1 - abs(dot(d.worldSpaceNormal, d.worldSpaceViewDir)); + half rimFactor = saturate(_RimBias + _RimScale * pow(NdV, _RimPower)); + half4 rimCol = _RimColor * rimFactor; + rimCol.rgb *= _RimIntensity; + col.rgb = lerp(col.rgb * (rimCol.rgb + half3(1,1,1)), col.rgb + rimCol.rgb, _RimAddAmount); + col.a = saturate(col.a * (1 - rimFactor * _RimErodesAlpha)); + #endif + + #if DEPTHGLOW_ON + half depthGlowMask = saturate(_DepthGlowDist * pow((1 - sceneDepthDiff), _DepthGlowPow)); + col.rgb = lerp(col.rgb, _DepthGlowGlobal * col.rgb, depthGlowMask); + half depthGlowMult = 1; + #if ADDITIVECONFIG_ON + depthGlowMult = luminance; + #endif + col.rgb += _DepthGlowColor.rgb * _DepthGlow * depthGlowMask * col.a * depthGlowMult; + #endif + + #if GLOW_ON + half glowMask = 1; + #if GLOWTEX_ON + glowMask = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, TRANSFORM_TEX(d.texcoord0.xy, _GlowTex)); + #endif + col.rgb *= _GlowGlobal * glowMask; + half glowMult = 1; + #if ADDITIVECONFIG_ON + glowMult = luminance; + #endif + + col.rgb += _GlowColor.rgb * _Glow * glowMask * col.a * glowMult; + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if CAMDISTFADE_ON + col.a *= 1 - saturate(smoothstep(_CamDistFadeStepMin, _CamDistFadeStepMax, camDistance)); + col.a *= smoothstep(0.0, _CamDistProximityFade, camDistance); + #endif + + #if MASK_ON + half2 maskUv = d.texcoord0.xy; + #if POLARUV_ON + maskUv = prePolarUvs; + #endif + half4 maskSample = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, TRANSFORM_TEX(maskUv, _MaskTex)); + half mask = pow(min(maskSample.r, maskSample.a), _MaskPow); + col.a *= mask; + #endif + + #if ALPHASMOOTHSTEP_ON + col.a = smoothstep(_AlphaStepMin, _AlphaStepMax, col.a); + #endif + + half4 debugColor = col; + #if SHAPEDEBUG_ON + debugColor = GetDebugColor(col, shape1, shape2, shape3); + #endif + + clip(debugColor.a - _AlphaCutoffValue - 0.01); + + //#if FOG_ON + //UNITY_APPLY_FOG(i.fogCoord, col); + //#endif + + //Don't use a starting i.color.a lower than 1 unless using vertex stream dissolve when using a FADE effect + #if !FADE_ON && !ALPHAFADE_ON + col.a *= _Alpha * d.vertexColor.a; + #endif + #if FADE_ON || ALPHAFADE_ON + col.a *= _Alpha; + #endif + #if ADDITIVECONFIG_ON + col.rgb *= col.a; + #endif + + + #if SHAPEDEBUG_ON + o.Albedo = debugColor.rgb; + o.Alpha = debugColor.a; + #else + o.Albedo = col.rgb; + o.Alpha = col.a; + #endif + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + // d.texcoord1 = i.texcoord1; + // d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenPos = i.screenPos; + d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + // o.texcoord1 = v.texcoord1; + // o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + // o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + half4 Frag (VertexToPixel IN + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(IN); + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + + Surface l = (Surface)0; + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + MetaInput metaInput = (MetaInput)0; + metaInput.Albedo = l.Albedo; + metaInput.Emission = l.Emission; + + return MetaFragment(metaInput); + + } + + ENDHLSL + + } + + + + Pass + { + Name "DepthNormals" + Tags + { + "LightMode" = "DepthNormals" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + + Tags + { + "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" + } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + ColorMask [_ColorMask] +Lighting Off + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #pragma target 3.0 + + #pragma prefer_hlslcc gles + #pragma exclude_renderers d3d11_9x + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE + #pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS + + #define SHADERPASS SHADERPASS_DEPTHNORMALSONLY + #define _PASSDEPTH 1 + #define _PASSDEPTHNORMALS 1 + + + + #pragma shader_feature_local TIMEISCUSTOM_ON + #pragma shader_feature_local ADDITIVECONFIG_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + #pragma shader_feature_local PREMULTIPLYCOLOR_ON + #pragma shader_feature_local SPLITRGBA_ON + #pragma shader_feature_local SHAPEADD_ON + + #pragma shader_feature_local SHAPE1SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE2SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE3SCREENUV_ON /////////////////Pipeline specific implementation + + #pragma shader_feature_local SHAPEDEBUG_ON + + #pragma shader_feature_local SHAPE1CONTRAST_ON + #pragma shader_feature_local SHAPE1DISTORT_ON + #pragma shader_feature_local SHAPE1ROTATE_ON + #pragma shader_feature_local SHAPE1SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE2_ON + #pragma shader_feature_local SHAPE2CONTRAST_ON + #pragma shader_feature_local SHAPE2DISTORT_ON + #pragma shader_feature_local SHAPE2ROTATE_ON + #pragma shader_feature_local SHAPE2SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE3_ON + #pragma shader_feature_local SHAPE3CONTRAST_ON + #pragma shader_feature_local SHAPE3DISTORT_ON + #pragma shader_feature_local SHAPE3ROTATE_ON + #pragma shader_feature_local SHAPE3SHAPECOLOR_ON + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local DEPTHGLOW_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local MASK_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local COLORRAMPGRAD_ON + #pragma shader_feature_local COLORGRADING_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local SHAKEUV_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local OFFSETSTREAM_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local VERTOFFSET_ON + #pragma shader_feature_local RIM_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local BACKFACETINT_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local POLARUVDISTORT_ON + #pragma shader_feature_local SHAPE1MASK_ON + #pragma shader_feature_local TRAILWIDTH_ON + #pragma shader_feature_local LIGHTANDSHADOW_ON + #pragma shader_feature_local SHAPETEXOFFSET_ON + #pragma shader_feature_local SHAPEWEIGHTS_ON + + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHASMOOTHSTEP_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local FADEBURN_ON + #pragma shader_feature_local ALPHAFADE_ON + #pragma shader_feature_local ALPHAFADEUSESHAPE1_ON + #pragma shader_feature_local ALPHAFADEUSEREDCHANNEL_ON + #pragma shader_feature_local ALPHAFADETRANSPARENCYTOO_ON + #pragma shader_feature_local ALPHAFADEINPUTSTREAM_ON + #pragma shader_feature_local CAMDISTFADE_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define REQUIRE_DEPTH_TEXTURE + + + // this has to be here or specular color will be ignored. Not in SG code + #if _SIMPLELIT + #define _SPECULAR_COLOR + #endif + + + // Includes + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl" + + + + + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + // float4 texcoord1 : TEXCOORD4; + // float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half _Alpha; + half _AlphaCutoffValue; + + half _TimingSeed; + + #if TIMEISCUSTOM_ON + float4 globalCustomTime; + #endif + + half4 _MainTex_ST, _ShapeColor; + half _ShapeXSpeed, _ShapeYSpeed, _ShapeColorWeight, _ShapeAlphaWeight; + + #if SHAPE1CONTRAST_ON + half _ShapeContrast, _ShapeBrightness; + #endif + + #if SHAPE1DISTORT_ON + half4 _ShapeDistortTex_ST; + half _ShapeDistortAmount, _ShapeDistortXSpeed, _ShapeDistortYSpeed; + #endif + + #if SHAPE1ROTATE_ON + half _ShapeRotationOffset, _ShapeRotationSpeed; + #endif + + #if OFFSETSTREAM_ON + half _OffsetSh1; + #endif + + #if SHAPEWEIGHTS_ON + half _Sh1BlendOffset; + #endif + + #if SHAPE2_ON + half4 _Shape2Tex_ST, _Shape2Color; + half _Shape2XSpeed, _Shape2YSpeed, _Shape2ColorWeight, _Shape2AlphaWeight; + #if SHAPE2CONTRAST_ON + half _Shape2Contrast, _Shape2Brightness; + #endif + #if SHAPE2DISTORT_ON + half4 _Shape2DistortTex_ST; + half _Shape2DistortAmount, _Shape2DistortXSpeed, _Shape2DistortYSpeed; + #endif + #if SHAPE2ROTATE_ON + half _Shape2RotationOffset, _Shape2RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh2; + #endif + #if SHAPEWEIGHTS_ON + half _Sh2BlendOffset; + #endif + #endif + + #if SHAPE3_ON + half4 _Shape3Tex_ST, _Shape3Color; + half _Shape3XSpeed, _Shape3YSpeed, _Shape3ColorWeight, _Shape3AlphaWeight; + #if SHAPE3CONTRAST_ON + half _Shape3Contrast, _Shape3Brightness; + #endif + #if SHAPE3DISTORT_ON + half4 _Shape3DistortTex_ST; + half _Shape3DistortAmount, _Shape3DistortXSpeed, _Shape3DistortYSpeed; + #endif + #if SHAPE3ROTATE_ON + half _Shape3RotationOffset, _Shape3RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh3; + #endif + #if SHAPEWEIGHTS_ON + half _Sh3BlendOffset; + #endif + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #if GLOWTEX_ON + half4 _GlowTex_ST; + #endif + #endif + + #if MASK_ON + half4 _MaskTex_ST; + half _MaskPow; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if ALPHASMOOTHSTEP_ON + half _AlphaStepMin, _AlphaStepMax; + #endif + + #if ALPHAFADE_ON + half _AlphaFadeAmount, _AlphaFadeSmooth, _AlphaFadePow; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + half _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if ROUNDWAVEUV_ON || PIXELATE_ON + half4 _MainTex_TexelSize; + #endif + + #if VERTOFFSET_ON + half4 _VertOffsetTex_ST; + half _VertOffsetAmount, _VertOffsetPower, _VertOffsetTexXSpeed, _VertOffsetTexYSpeed; + #endif + + #if FADE_ON + half4 _FadeTex_ST; + half _FadeAmount, _FadeTransition, _FadePower, _FadeScrollXSpeed, _FadeScrollYSpeed; + #if FADEBURN_ON + half4 _FadeBurnColor, _FadeBurnTex_ST; + half _FadeBurnWidth, _FadeBurnGlow; + #endif + #endif + + #if COLORGRADING_ON + half3 _ColorGradingLight, _ColorGradingMiddle, _ColorGradingDark; + half _ColorGradingMidPoint; + #endif + + #if CAMDISTFADE_ON + half _CamDistFadeStepMin, _CamDistFadeStepMax, _CamDistProximityFade; + #endif + + #if RIM_ON + half _RimBias, _RimScale, _RimPower, _RimIntensity, _RimAddAmount, _RimErodesAlpha; + half4 _RimColor; + #endif + + #if BACKFACETINT_ON + half4 _BackFaceTint, _FrontFaceTint; + #endif + + #if SHAPEDEBUG_ON + half _DebugShape; + #endif + + #if SHAPE1MASK_ON + half4 _Shape1MaskTex_ST; + half _Shape1MaskPow; + #endif + + #if TRAILWIDTH_ON + half _TrailWidthPower; + #endif + + #if LIGHTANDSHADOW_ON + half3 _All1VfxLightDir; + half _ShadowAmount, _ShadowStepMin, _ShadowStepMax, _LightAmount; + half4 _LightColor; + #endif + + #if SHAPETEXOFFSET_ON + half _RandomSh1Mult, _RandomSh2Mult, _RandomSh3Mult; + #endif + + #if DEPTHGLOW_ON + half _DepthGlowDist, _DepthGlowPow, _DepthGlow, _DepthGlowGlobal; + half4 _DepthGlowColor; + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half _ScreenUvShDistScale,_ScreenUvSh2DistScale, _ScreenUvSh3DistScale; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if SHAPE1DISTORT_ON + TEXTURE2D(_ShapeDistortTex); + SAMPLER(sampler_ShapeDistortTex); + #endif + + #if SHAPE2_ON + TEXTURE2D(_Shape2Tex); + SAMPLER(sampler_Shape2Tex); + #if SHAPE2DISTORT_ON + TEXTURE2D(_Shape2DistortTex); + SAMPLER(sampler_Shape2DistortTex); + #endif + #endif + + #if SHAPE3_ON + TEXTURE2D(_Shape3Tex); + SAMPLER(sampler_Shape3Tex); + #if SHAPE3DISTORT_ON + TEXTURE2D(_Shape3DistortTex); + SAMPLER(sampler_Shape3DistortTex); + #endif + #endif + + #if GLOW_ON + #if GLOWTEX_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + #endif + + #if MASK_ON + TEXTURE2D(_MaskTex); + SAMPLER(sampler_MaskTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + SAMPLER(sampler_ColorRampTex); + #endif + + #if COLORRAMPGRAD_ON + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if VERTOFFSET_ON + TEXTURE2D(_VertOffsetTex); + SAMPLER(sampler_VertOffsetTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + #if FADEBURN_ON + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + #endif + + #if SHAPE1MASK_ON + TEXTURE2D(_Shape1MaskTex); + SAMPLER(sampler_Shape1MaskTex); + #endif + + #if TRAILWIDTH_ON + TEXTURE2D(_TrailWidthGradient); + SAMPLER(sampler_TrailWidthGradient); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + half4 SampleTextureWithScroll(in Texture2D _tex, in SamplerState _sampler, in float2 uv, in half scrollXSpeed, in half scrollYSpeed, in float time) + { + half2 _uv = uv; + _uv.x += (time * scrollXSpeed) % 1; + _uv.y += (time * scrollYSpeed) % 1; + return SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + } + + half EaseOutQuint(half x) + { + return 1 - pow(1 - x, 5); + } + + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax) + { + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + + float2 RotateUvs(float2 uv, half rotation, half4 scaleAndTranslate) + { + half2 center = half2(0.5 * scaleAndTranslate.x + scaleAndTranslate.z, 0.5 * scaleAndTranslate.y + scaleAndTranslate.w); + half cosAngle = cos(rotation); + half sinAngle = sin(rotation); + uv -= center; + uv = mul(half2x2(cosAngle, -sinAngle, sinAngle, cosAngle), uv); + uv += center; + return uv; + } + + half4 GetDebugColor(float4 resColor, half4 shape1, half4 shape2, half4 shape3) + { + half4 res = resColor; + + //MAKE SURE THE FOLLOWING CODE BLOCK IS UNCOMMENTED------------------------------------------- + #if SHAPEDEBUG_ON + if(_DebugShape < 1.5) return shape1; + #if SHAPE2_ON + else if (_DebugShape < 2.5) return shape2; + #endif + #if SHAPE3_ON + else return shape3; + #endif + #endif + + return res; + } + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //uvDistTex --> extraV2F0 + //uvSh1DistTex --> extraV2F1 + //uvSh2DistTex --> extraV2F2 + //uvSh3DistTex --> extraV2F3 + + #if VERTOFFSET_ON + #if TIMEISCUSTOM_ON + const half time = v.texcoord0.z + globalCustomTime.y; + #else + const half time = v.texcoord0.z + _Time.y; + #endif + half4 offsetUv = half4(TRANSFORM_TEX(v.texcoord0.xy, _VertOffsetTex), 0, 0); + offsetUv.x += (time * _VertOffsetTexXSpeed) % 1; + offsetUv.y += (time * _VertOffsetTexYSpeed) % 1; + v.vertex.xyz += v.normal * _VertOffsetAmount * pow(SAMPLE_TEXTURE2D_LOD(_VertOffsetTex, sampler_VertOffsetTex, offsetUv, 0).r, _VertOffsetPower); + #endif + + #if DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F0.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + + #if SHAPE1DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F1.xy = TRANSFORM_TEX(v.texcoord0.xy, _ShapeDistortTex); + #endif + + #if SHAPE2_ON + #if SHAPE2DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F2.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape2DistortTex);; + #endif + #endif + + #if SHAPE3_ON + #if SHAPE3DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F3.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape3DistortTex); + #endif + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + //i.uvSeed -> d.texcoord0.xy + + float seed = d.texcoord0.z + _TimingSeed; + #if TIMEISCUSTOM_ON + const float4 shaderTime = globalCustomTime; + #else + const float4 shaderTime = _Time; + #endif + float time = shaderTime.y + seed; + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 originalUvs = d.texcoord0.xy; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + #if TWISTUV_ON + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + #if DOODLE_ON + half2 uvCopy = d.texcoord0.xy; + _HandDrawnSpeed = (floor((shaderTime.x + seed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if WAVEUV_ON + half2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + half angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((time * _WaveSpeed) % 360.0); + d.texcoord0.xy = d.texcoord0.xy + normalize(uvWave) * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - d.texcoord0.x); + half yWave = ((0.5 * _MainTex_ST.y) - d.texcoord0.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + time * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if POLARUV_ON + half2 prePolarUvs = d.texcoord0.xy; + d.texcoord0.xy = d.texcoord0.xy - half2(0.5, 0.5); + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (1.0 * 6.28318530718), length(d.texcoord0.xy) * 2.0); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + #if DISTORT_ON + #if POLARUVDISTORT_ON + half2 distortUvs = TRANSFORM_TEX(d.texcoord0.xy, _DistortTex); + #else + half2 distortUvs = d.extraV2F0.xy; + #endif + distortUvs.x += ((shaderTime.x + seed) * _DistortTexXSpeed) % 1; + distortUvs.y += ((shaderTime.x + seed) * _DistortTexYSpeed) % 1; + #if ATLAS_ON + d.extraV2F0.xy = half2((d.extraV2F0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.extraV2F0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, distortUvs).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + + #if TEXTURESCROLL_ON + d.texcoord0.x += (time * _TextureScrollXSpeed) % 1; + d.texcoord0.y += (time * _TextureScrollYSpeed) % 1; + #endif + + #if TRAILWIDTH_ON + half width = pow(SAMPLE_TEXTURE2D(_TrailWidthGradient, sampler_TrailWidthGradient, d.texcoord0).r, _TrailWidthPower); + d.texcoord0.y = (d.texcoord0.y * 2 - 1) / width * 0.5 + 0.5; + clip(d.texcoord0.y); + clip(1 - d.texcoord0.y); + #endif + + float2 shape1Uv = d.texcoord0.xy; + #if SHAPE2_ON + float2 shape2Uv = shape1Uv; + #endif + #if SHAPE3_ON + float2 shape3Uv = shape1Uv; + #endif + + #if CAMDISTFADE_ON || SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half camDistance = distance(d.worldSpacePosition, _WorldSpaceCameraPos); + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 uvOffsetPostFx = d.texcoord0.xy - originalUvs; + d.texcoord0.xy = d.screenPos.xy / d.screenPos.w; + d.texcoord0.x = d.texcoord0.x * (_ScreenParams.x / _ScreenParams.y); + d.texcoord0.x -= 0.5; + d.texcoord0.xy -= uvOffsetPostFx; + originalUvs += uvOffsetPostFx; + half distanceZoom = camDistance * 0.1; + half2 scaleWithDistUvs = d.texcoord0.xy * distanceZoom + ((-distanceZoom * 0.5) + 0.5); + #if SHAPE1SCREENUV_ON + shape1Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvShDistScale); + #else + shape1Uv = originalUvs; + #endif + #if SHAPE2SCREENUV_ON && SHAPE2_ON + shape2Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh2DistScale); + #else + #if SHAPE2_ON + shape2Uv = originalUvs; + #endif + #endif + #if SHAPE3SCREENUV_ON && SHAPE3_ON + shape3Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh3DistScale); + #else + #if SHAPE3_ON + shape3Uv = originalUvs; + #endif + #endif + #endif + + shape1Uv = TRANSFORM_TEX(shape1Uv, _MainTex); + #if OFFSETSTREAM_ON + shape1Uv.x += i.offsetCustomData.x * _OffsetSh1; + shape1Uv.y += i.offsetCustomData.y * _OffsetSh1; + #endif + #if SHAPETEXOFFSET_ON + shape1Uv += seed * _RandomSh1Mult; + #endif + + #if SHAPE1DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh1DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _ShapeDistortTex); + #else + half2 sh1DistortUvs = d.extraV2F1.xy; + #endif + + sh1DistortUvs.x += ((time + seed) * _ShapeDistortXSpeed) % 1; + sh1DistortUvs.y += ((time + seed) * _ShapeDistortYSpeed) % 1; + half distortAmount = (SAMPLE_TEXTURE2D(_ShapeDistortTex, sampler_ShapeDistortTex, sh1DistortUvs).r - 0.5) * 0.2 * _ShapeDistortAmount; + shape1Uv.x += distortAmount; + shape1Uv.y += distortAmount; + #endif + #if SHAPE1ROTATE_ON + shape1Uv = RotateUvs(shape1Uv, _ShapeRotationOffset + ((_ShapeRotationSpeed * time) % 6.28318530718), _MainTex_ST); + #endif + + half4 shape1 = SampleTextureWithScroll(_MainTex, sampler_MainTex, shape1Uv, _ShapeXSpeed, _ShapeYSpeed, time); + #if SHAPE1SHAPECOLOR_ON + shape1.a = shape1.r; + shape1.rgb = _ShapeColor.rgb; + #else + shape1 *= _ShapeColor; + #endif + #if SHAPE1CONTRAST_ON + #if SHAPE1SHAPECOLOR_ON + shape1.a = saturate((shape1.a - 0.5) * _ShapeContrast + 0.5 + _ShapeBrightness); + #else + shape1.rgb = max(0, (shape1.rgb - half3(0.5, 0.5, 0.5)) * _ShapeContrast + half3(0.5, 0.5, 0.5) + _ShapeBrightness); + #endif + #endif + + half4 shape2 = 1.0; + #if SHAPE2_ON + shape2Uv = TRANSFORM_TEX(shape2Uv, _Shape2Tex); + #if OFFSETSTREAM_ON + shape2Uv.x += i.offsetCustomData.x * _OffsetSh2; + shape2Uv.y += i.offsetCustomData.y * _OffsetSh2; + #endif + #if SHAPETEXOFFSET_ON + shape2Uv += seed * _RandomSh2Mult; + #endif + #if SHAPE2DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh2DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape2DistortTex); + #else + half2 sh2DistortUvs = d.extraV2F2.xy; + #endif + sh2DistortUvs.x += ((time + seed) * _Shape2DistortXSpeed) % 1; + sh2DistortUvs.y += ((time + seed) * _Shape2DistortYSpeed) % 1; + half distortAmnt2 = (SAMPLE_TEXTURE2D(_Shape2DistortTex, sampler_Shape2DistortTex, sh2DistortUvs).r - 0.5) * 0.2 * _Shape2DistortAmount; + shape2Uv.x += distortAmnt2; + shape2Uv.y += distortAmnt2; + #endif + #if SHAPE2ROTATE_ON + shape2Uv = RotateUvs(shape2Uv, _Shape2RotationOffset + ((_Shape2RotationSpeed * time) % 6.28318530718), _Shape2Tex_ST); + #endif + + shape2 = SampleTextureWithScroll(_Shape2Tex, sampler_Shape2Tex, shape2Uv, _Shape2XSpeed, _Shape2YSpeed, time); + #if SHAPE2SHAPECOLOR_ON + shape2.a = shape2.r; + shape2.rgb = _Shape2Color.rgb; + #else + shape2 *= _Shape2Color; + #endif + #if SHAPE2CONTRAST_ON + #if SHAPE2SHAPECOLOR_ON + shape2.a = max(0, (shape2.a - 0.5) * _Shape2Contrast + 0.5 + _Shape2Brightness); + #else + shape2.rgb = max(0, (shape2.rgb - half3(0.5, 0.5, 0.5)) * _Shape2Contrast + half3(0.5, 0.5, 0.5) + _Shape2Brightness); + #endif + #endif + #endif + + half4 shape3 = 1.0; + #if SHAPE3_ON + shape3Uv = TRANSFORM_TEX(shape3Uv, _Shape3Tex); + + #if OFFSETSTREAM_ON + shape3Uv.x += i.offsetCustomData.x * _OffsetSh3; + shape3Uv.y += i.offsetCustomData.y * _OffsetSh3; + #endif + #if SHAPETEXOFFSET_ON + shape3Uv += seed * _RandomSh3Mult; + #endif + #if SHAPE3DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh3DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape3DistortTex); + #else + half2 sh3DistortUvs = d.extraV2F3.xy; + #endif + sh3DistortUvs.x += ((time + seed) * _Shape3DistortXSpeed) % 1; + sh3DistortUvs.y += ((time + seed) * _Shape3DistortYSpeed) % 1; + half distortAmnt3 = (SAMPLE_TEXTURE2D(_Shape3DistortTex, sampler_Shape3DistortTex, sh3DistortUvs).r - 0.5) * 0.3 * _Shape3DistortAmount; + shape3Uv.x += distortAmnt3; + shape3Uv.y += distortAmnt3; + #endif + #if SHAPE3ROTATE_ON + shape3Uv = RotateUvs(shape3Uv, _Shape3RotationOffset + ((_Shape3RotationSpeed * time) % 6.28318530718), _Shape3Tex_ST); + #endif + shape3 = SampleTextureWithScroll(_Shape3Tex, sampler_Shape3Tex, shape3Uv, _Shape3XSpeed, _Shape3YSpeed, time); + #if SHAPE3SHAPECOLOR_ON + shape3.a = shape3.r; + shape3.rgb = _Shape3Color.rgb; + #else + shape3 *= _Shape3Color; + #endif + #if SHAPE3CONTRAST_ON + #if SHAPE3SHAPECOLOR_ON + shape3.a = max(0, (shape3.a - 0.5) * _Shape3Contrast + 0.5 + _Shape3Brightness); + #else + shape3.rgb = max(0, (shape3.rgb - half3(0.5, 0.5, 0.5)) * _Shape3Contrast + half3(0.5, 0.5, 0.5) + _Shape3Brightness); + #endif + #endif + #endif + + half4 col = shape1; + //Mix all shapes pre: change weights if custom vertex effect active + #if SHAPEWEIGHTS_ON + half shapeWeightOffset; + #if SHAPE2_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh1BlendOffset; + _ShapeColorWeight = max(0, _ShapeColorWeight + shapeWeightOffset); + _ShapeAlphaWeight = max(0, _ShapeAlphaWeight + shapeWeightOffset); + shapeWeightOffset = i.offsetCustomData.z * _Sh2BlendOffset; + _Shape2ColorWeight = max(0, _Shape2ColorWeight + shapeWeightOffset); + _Shape2AlphaWeight = max(0, _Shape2AlphaWeight + shapeWeightOffset); + #endif + #if SHAPE3_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh3BlendOffset; + _Shape3ColorWeight = max(0, _Shape3ColorWeight + shapeWeightOffset); + _Shape3AlphaWeight = max(0, _Shape3AlphaWeight + shapeWeightOffset); + #endif + #endif + + //Mix all shapes + #if SHAPE2_ON + #if !SPLITRGBA_ON + _ShapeAlphaWeight = _ShapeColorWeight; + _Shape2AlphaWeight = _Shape2ColorWeight; + #endif + #if SHAPE3_ON //Shape3 On + #if !SPLITRGBA_ON + _Shape3AlphaWeight = _Shape3ColorWeight; + #endif + #if SHAPEADD_ON + col.rgb = ((shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight)) + (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(max(shape3.a * _Shape3AlphaWeight, max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight))); + #else + col.rgb = ((shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight)) * (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)) * (shape3.a * _Shape3AlphaWeight)); + #endif + #else //Shape3 Off + #if SHAPEADD_ON + col.rgb = (shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight); + col.a = saturate(max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight)); + #else + col.rgb = (shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight); + col.a = saturate((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)); + #endif + #endif + #endif + + #if SHAPE1MASK_ON + col = lerp(col, shape1, pow(SAMPLE_TEXTURE2D(_Shape1MaskTex, sampler_Shape1MaskTex, TRANSFORM_TEX(i.uvSeed.xy, _Shape1MaskTex)).r, _Shape1MaskPow)); + #endif + + #if PREMULTIPLYCOLOR_ON + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + col.a = min(luminance, col.a); + #endif + + col.rgb *= _Color.rgb * d.vertexColor.rgb; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if !PREMULTIPLYCOLOR_ON && (COLORRAMP_ON || ALPHAFADE_ON || COLORGRADING_ON || FADE_ON || (ADDITIVECONFIG_ON && (GLOW_ON || DEPTHGLOW_ON))) + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + #endif + + #if (FADE_ON || ALPHAFADE_ON) && ALPHAFADEINPUTSTREAM_ON + col.a *= d.vertexColor.a; + d.vertexColor.a = d.texcoord0.w; + #endif + + #if FADE_ON + half preFadeAlpha = col.a; + _FadeAmount = saturate(_FadeAmount + (1 - d.vertexColor.a)); + _FadeTransition = max(0.01, _FadeTransition * EaseOutQuint(saturate(_FadeAmount))); + half2 fadeUv; + fadeUv = d.texcoord0.xy + seed; + fadeUv.x += (time * _FadeScrollXSpeed) % 1; + fadeUv.y += (time * _FadeScrollYSpeed) % 1; + half2 tiledUvFade1 = TRANSFORM_TEX(fadeUv, _FadeTex); + #if ADDITIVECONFIG_ON && !PREMULTIPLYCOLOR_ON + preFadeAlpha *= luminance; + #endif + _FadeAmount = saturate(pow(_FadeAmount, _FadePower)); + #if FADEBURN_ON + half2 tiledUvFade2 = TRANSFORM_TEX(fadeUv, _FadeBurnTex); + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fadeNaturalEdge = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fadeNaturalEdge; + half fadeBurn = saturate(smoothstep(0.0 , _FadeTransition + _FadeBurnWidth, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + fadeBurn = fadeNaturalEdge - fadeBurn; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col.rgb += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2).rgb * _FadeBurnColor.rgb * preFadeAlpha; + #else + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + float fade = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fade; + #endif + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _FadeAmount; + #endif + #endif + + #if ALPHAFADE_ON + half alphaFadeLuminance; + _AlphaFadeAmount = saturate(_AlphaFadeAmount + (1 - d.vertexColor.a)); + _AlphaFadeAmount = saturate(pow(_AlphaFadeAmount, _AlphaFadePow)); + _AlphaFadeSmooth = max(0.01, _AlphaFadeSmooth * EaseOutQuint(saturate(_AlphaFadeAmount))); + #if ALPHAFADEUSESHAPE1_ON + alphaFadeLuminance = shape1.r; + #else + alphaFadeLuminance = luminance; + #endif + alphaFadeLuminance = saturate(alphaFadeLuminance - 0.001); + #if ALPHAFADEUSEREDCHANNEL_ON + col.a *= col.r; + #endif + col.a = saturate(col.a); + float alphaFade = saturate(smoothstep(0.0 , _AlphaFadeSmooth, RemapFloat(1.0 - _AlphaFadeAmount, 0.0, 1.0, -1.0, 1.0) + alphaFadeLuminance)); + col.a *= alphaFade; + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _AlphaFadeAmount; + #endif + #endif + + #if BACKFACETINT_ON + col.rgb = lerp(col.rgb * _BackFaceTint, col.rgb * _FrontFaceTint, step(0, dot(d.worldSpaceNormal, d.worldSpaceViewDir))); + #endif + + //#if LIGHTANDSHADOW_ON + //half NdL = saturate(dot(d.worldSpaceNormal, -_All1VfxLightDir)); + //col.rgb += _LightColor * _LightAmount * NdL; + //NdL = max(_ShadowAmount, NdL); + //NdL = smoothstep(_ShadowStepMin, _ShadowStepMax, NdL); + //col.rgb *= NdL; + //#endif + + #if COLORGRADING_ON + col.rgb *= lerp(lerp(_ColorGradingDark, _ColorGradingMiddle, luminance/_ColorGradingMidPoint), + lerp(_ColorGradingMiddle, _ColorGradingLight, (luminance - _ColorGradingMidPoint)/(1.0 - _ColorGradingMidPoint)), step(_ColorGradingMidPoint, luminance)); + #endif + + #if COLORRAMP_ON + half colorRampLuminance = saturate(luminance + _ColorRampLuminosity); + #if COLORRAMPGRAD_ON + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(colorRampLuminance, 0)); + #else + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(colorRampLuminance, 0)); + #endif + col.rgb = lerp(col.rgb, colorRampRes.rgb, _ColorRampBlend); + col.a = lerp(col.a, saturate(col.a * colorRampRes.a), _ColorRampBlend); + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = floor(col.rgb / (1.0 / _PosterizeNumColors)) * (1.0 / _PosterizeNumColors); + #endif + + #if DEPTHGLOW_ON + half sceneDepthDiff = GetLinearEyeDepth(d.screenUV) - d.screenPos.w; + #endif + + #if RIM_ON + half NdV = 1 - abs(dot(d.worldSpaceNormal, d.worldSpaceViewDir)); + half rimFactor = saturate(_RimBias + _RimScale * pow(NdV, _RimPower)); + half4 rimCol = _RimColor * rimFactor; + rimCol.rgb *= _RimIntensity; + col.rgb = lerp(col.rgb * (rimCol.rgb + half3(1,1,1)), col.rgb + rimCol.rgb, _RimAddAmount); + col.a = saturate(col.a * (1 - rimFactor * _RimErodesAlpha)); + #endif + + #if DEPTHGLOW_ON + half depthGlowMask = saturate(_DepthGlowDist * pow((1 - sceneDepthDiff), _DepthGlowPow)); + col.rgb = lerp(col.rgb, _DepthGlowGlobal * col.rgb, depthGlowMask); + half depthGlowMult = 1; + #if ADDITIVECONFIG_ON + depthGlowMult = luminance; + #endif + col.rgb += _DepthGlowColor.rgb * _DepthGlow * depthGlowMask * col.a * depthGlowMult; + #endif + + #if GLOW_ON + half glowMask = 1; + #if GLOWTEX_ON + glowMask = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, TRANSFORM_TEX(d.texcoord0.xy, _GlowTex)); + #endif + col.rgb *= _GlowGlobal * glowMask; + half glowMult = 1; + #if ADDITIVECONFIG_ON + glowMult = luminance; + #endif + + col.rgb += _GlowColor.rgb * _Glow * glowMask * col.a * glowMult; + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if CAMDISTFADE_ON + col.a *= 1 - saturate(smoothstep(_CamDistFadeStepMin, _CamDistFadeStepMax, camDistance)); + col.a *= smoothstep(0.0, _CamDistProximityFade, camDistance); + #endif + + #if MASK_ON + half2 maskUv = d.texcoord0.xy; + #if POLARUV_ON + maskUv = prePolarUvs; + #endif + half4 maskSample = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, TRANSFORM_TEX(maskUv, _MaskTex)); + half mask = pow(min(maskSample.r, maskSample.a), _MaskPow); + col.a *= mask; + #endif + + #if ALPHASMOOTHSTEP_ON + col.a = smoothstep(_AlphaStepMin, _AlphaStepMax, col.a); + #endif + + half4 debugColor = col; + #if SHAPEDEBUG_ON + debugColor = GetDebugColor(col, shape1, shape2, shape3); + #endif + + clip(debugColor.a - _AlphaCutoffValue - 0.01); + + //#if FOG_ON + //UNITY_APPLY_FOG(i.fogCoord, col); + //#endif + + //Don't use a starting i.color.a lower than 1 unless using vertex stream dissolve when using a FADE effect + #if !FADE_ON && !ALPHAFADE_ON + col.a *= _Alpha * d.vertexColor.a; + #endif + #if FADE_ON || ALPHAFADE_ON + col.a *= _Alpha; + #endif + #if ADDITIVECONFIG_ON + col.rgb *= col.a; + #endif + + + #if SHAPEDEBUG_ON + o.Albedo = debugColor.rgb; + o.Alpha = debugColor.a; + #else + o.Albedo = col.rgb; + o.Alpha = col.a; + #endif + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + // d.texcoord1 = i.texcoord1; + // d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenPos = i.screenPos; + d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + // o.texcoord1 = v.texcoord1; + // o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + // o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // fragment shader + void Frag (VertexToPixel IN + , out half4 outNormalWS : SV_Target0 + #ifdef _WRITE_RENDERING_LAYERS + , out float4 outRenderingLayers : SV_Target1 + #endif + #ifdef _DEPTHOFFSET_ON + , out float outputDepth : SV_Depth + #endif + #if NEED_FACING + , bool facing : SV_IsFrontFace + #endif + ) + { + UNITY_SETUP_INSTANCE_ID(IN); + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN); + + #if defined(LOD_FADE_CROSSFADE) + LODFadeCrossFade(IN.pos); + #endif + + ShaderData d = CreateShaderData(IN + #if NEED_FACING + , facing + #endif + ); + Surface l = (Surface)0; + + #ifdef _DEPTHOFFSET_ON + l.outputDepth = outputDepth; + #endif + + l.Albedo = half3(0.5, 0.5, 0.5); + l.Normal = float3(0,0,1); + l.Occlusion = 1; + l.Alpha = 1; + + ChainSurfaceFunction(l, d); + + #ifdef _DEPTHOFFSET_ON + outputDepth = l.outputDepth; + #endif + + #if defined(_GBUFFER_NORMALS_OCT) + float3 normalWS = d.worldSpaceNormal; + float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on some platforms + float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1] + half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1] + outNormalWS = half4(packedNormalWS, 0.0); + #else + float3 wsn = l.Normal; + #if !_WORLDSPACENORMAL + wsn = TangentToWorldSpace(d, l.Normal); + #endif + outNormalWS = half4(NormalizeNormalPerPixel(wsn), 0.0); + #endif + + #ifdef _WRITE_RENDERING_LAYERS + uint renderingLayers = GetMeshRenderingLayer(); + outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0); + #endif + + + } + + ENDHLSL + + } + + + + Pass + { + Name "MotionVectors" + Tags + { + "LightMode" = "MotionVectors" + } + + // Render State + Cull Back + ZTest LEqual + ZWrite On + ColorMask RG + + Tags + { + "RenderType" = "Opaque" "Queue" = "Geometry" "PreviewType" = "Sphere" + } + Cull [_CullingOption] + ZWrite [_ZWrite] + ZTest [_ZTestMode] + ColorMask [_ColorMask] +Lighting Off + + + HLSLPROGRAM + + #pragma vertex Vert + #pragma fragment Frag + + #define _PASSMOTIONVECTOR 1 + + #pragma target 3.5 + #pragma multi_compile_instancing + #pragma vertex vert + #pragma fragment frag + + #define SHADERPASS SHADERPASS_MOTION_VECTORS + #define RAYTRACING_SHADER_GRAPH_DEFAULT + #define VARYINGS_NEED_PASS + #define _PASSMOTIONVECTOR 1 + + + #pragma shader_feature_local TIMEISCUSTOM_ON + #pragma shader_feature_local ADDITIVECONFIG_ON + #pragma shader_feature_local PREMULTIPLYALPHA_ON + #pragma shader_feature_local PREMULTIPLYCOLOR_ON + #pragma shader_feature_local SPLITRGBA_ON + #pragma shader_feature_local SHAPEADD_ON + + #pragma shader_feature_local SHAPE1SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE2SCREENUV_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local SHAPE3SCREENUV_ON /////////////////Pipeline specific implementation + + #pragma shader_feature_local SHAPEDEBUG_ON + + #pragma shader_feature_local SHAPE1CONTRAST_ON + #pragma shader_feature_local SHAPE1DISTORT_ON + #pragma shader_feature_local SHAPE1ROTATE_ON + #pragma shader_feature_local SHAPE1SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE2_ON + #pragma shader_feature_local SHAPE2CONTRAST_ON + #pragma shader_feature_local SHAPE2DISTORT_ON + #pragma shader_feature_local SHAPE2ROTATE_ON + #pragma shader_feature_local SHAPE2SHAPECOLOR_ON + + #pragma shader_feature_local SHAPE3_ON + #pragma shader_feature_local SHAPE3CONTRAST_ON + #pragma shader_feature_local SHAPE3DISTORT_ON + #pragma shader_feature_local SHAPE3ROTATE_ON + #pragma shader_feature_local SHAPE3SHAPECOLOR_ON + + #pragma shader_feature_local GLOW_ON + #pragma shader_feature_local GLOWTEX_ON + #pragma shader_feature_local DEPTHGLOW_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local MASK_ON + #pragma shader_feature_local COLORRAMP_ON + #pragma shader_feature_local COLORRAMPGRAD_ON + #pragma shader_feature_local COLORGRADING_ON + #pragma shader_feature_local HSV_ON + #pragma shader_feature_local POSTERIZE_ON + #pragma shader_feature_local PIXELATE_ON + #pragma shader_feature_local DISTORT_ON + #pragma shader_feature_local SHAKEUV_ON + #pragma shader_feature_local WAVEUV_ON + #pragma shader_feature_local ROUNDWAVEUV_ON + #pragma shader_feature_local TWISTUV_ON + #pragma shader_feature_local DOODLE_ON + #pragma shader_feature_local OFFSETSTREAM_ON + #pragma shader_feature_local TEXTURESCROLL_ON + #pragma shader_feature_local VERTOFFSET_ON + #pragma shader_feature_local RIM_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local BACKFACETINT_ON /////////////////Pipeline specific implementation + #pragma shader_feature_local POLARUV_ON + #pragma shader_feature_local POLARUVDISTORT_ON + #pragma shader_feature_local SHAPE1MASK_ON + #pragma shader_feature_local TRAILWIDTH_ON + #pragma shader_feature_local LIGHTANDSHADOW_ON + #pragma shader_feature_local SHAPETEXOFFSET_ON + #pragma shader_feature_local SHAPEWEIGHTS_ON + + #pragma shader_feature_local ALPHACUTOFF_ON + #pragma shader_feature_local ALPHASMOOTHSTEP_ON + #pragma shader_feature_local FADE_ON + #pragma shader_feature_local FADEBURN_ON + #pragma shader_feature_local ALPHAFADE_ON + #pragma shader_feature_local ALPHAFADEUSESHAPE1_ON + #pragma shader_feature_local ALPHAFADEUSEREDCHANNEL_ON + #pragma shader_feature_local ALPHAFADETRANSPARENCYTOO_ON + #pragma shader_feature_local ALPHAFADEINPUTSTREAM_ON + #pragma shader_feature_local CAMDISTFADE_ON + + #pragma shader_feature NORMALMAP_ON + + + #define _URP 1 +#define REQUIRE_DEPTH_TEXTURE + + + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl" + #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DebugMipmapStreamingMacros.hlsl" + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl" + #include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl" + + #undef WorldNormalVector + #define WorldNormalVector(data, normal) mul(normal, data.TBNMatrix) + + #define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal) + + #define _WorldSpaceLightPos0 _MainLightPosition + + #define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name); + #define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name); + #define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name); + + #define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z) + #define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod) + #define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord) + #define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord) + + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler_##tex, coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) SAMPLE_TEXTURE2D_LOD (tex, sampler##samplertex,coord, lod) + + #if defined(UNITY_COMPILER_HLSL) + #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0; + #else + #define UNITY_INITIALIZE_OUTPUT(type,name) + #endif + + #define sampler2D_float sampler2D + #define sampler2D_half sampler2D + + + + // data across stages, stripped like the above. + struct VertexToPixel + { + float4 pos : SV_POSITION; + float3 worldPos : TEXCOORD0; + float3 worldNormal : TEXCOORD1; + float4 worldTangent : TEXCOORD2; + float4 texcoord0 : TEXCOORD3; + // float4 texcoord1 : TEXCOORD4; + // float4 texcoord2 : TEXCOORD5; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD6; + // #endif + + // #if %SCREENPOSREQUIREKEY% + float4 screenPos : TEXCOORD7; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + half4 vertexColor : COLOR; + // #endif + + #if defined(LIGHTMAP_ON) + float2 lightmapUV : TEXCOORD8; + #endif + #if defined(DYNAMICLIGHTMAP_ON) + float2 dynamicLightmapUV : TEXCOORD9; + #endif + #if !defined(LIGHTMAP_ON) + float4 probeOcclusion : TEXCOORD8; + float3 sh : TEXCOORD10; + #endif + + #if defined(VARYINGS_NEED_FOG_AND_VERTEX_LIGHT) + float4 fogFactorAndVertexLight : TEXCOORD11; + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + float4 shadowCoord : TEXCOORD12; + #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD13; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD14; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD15; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD16; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD17; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD18; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD19; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD20; + // #endif + + #if UNITY_ANY_INSTANCING_ENABLED + uint instanceID : CUSTOM_INSTANCE_ID; + #endif + #if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE))) + uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0; + #endif + #if (defined(UNITY_STEREO_INSTANCING_ENABLED)) + uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex; + #endif + #if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE) + FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC; + #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float4 previousPositionCS : TEXCOORD21; // Contain previous transform position (in case of skinning for example) + float4 positionCS : TEXCOORD22; + #endif + }; + + + + + // data describing the user output of a pixel + struct Surface + { + half3 Albedo; + half Height; + half3 Normal; + half Smoothness; + half3 Emission; + half Metallic; + half3 Specular; + half Occlusion; + half SpecularPower; // for simple lighting + half Alpha; + float outputDepth; // if written, SV_Depth semantic is used. ShaderData.clipPos.z is unused value + // HDRP Only + half SpecularOcclusion; + half SubsurfaceMask; + half Thickness; + half CoatMask; + half CoatSmoothness; + half Anisotropy; + half IridescenceMask; + half IridescenceThickness; + int DiffusionProfileHash; + float SpecularAAThreshold; + float SpecularAAScreenSpaceVariance; + // requires _OVERRIDE_BAKEDGI to be defined, but is mapped in all pipelines + float3 DiffuseGI; + float3 BackDiffuseGI; + float3 SpecularGI; + float ior; + float3 transmittanceColor; + float atDistance; + float transmittanceMask; + // requires _OVERRIDE_SHADOWMASK to be defines + float4 ShadowMask; + + // for decals + float NormalAlpha; + float MAOSAlpha; + + + }; + + // Data the user declares in blackboard blocks + struct Blackboard + { + + float blackboardDummyData; + }; + + // data the user might need, this will grow to be big. But easy to strip + struct ShaderData + { + float4 clipPos; // SV_POSITION + float3 localSpacePosition; + float3 localSpaceNormal; + float3 localSpaceTangent; + + float3 worldSpacePosition; + float3 worldSpaceNormal; + float3 worldSpaceTangent; + float tangentSign; + + float3 worldSpaceViewDir; + float3 tangentSpaceViewDir; + + float4 texcoord0; + float4 texcoord1; + float4 texcoord2; + float4 texcoord3; + + float2 screenUV; + float4 screenPos; + + float4 vertexColor; + bool isFrontFace; + + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + + float3x3 TBNMatrix; + Blackboard blackboard; + }; + + struct VertexData + { + #if SHADER_TARGET > 30 + // uint vertexID : SV_VertexID; + #endif + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + + // optimize out mesh coords when not in use by user or lighting system + #if _URP && (_USINGTEXCOORD1 || _PASSMETA || _PASSFORWARD || _PASSGBUFFER) + float4 texcoord1 : TEXCOORD1; + #endif + + #if _URP && (_USINGTEXCOORD2 || _PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && defined(DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + #if _STANDARD && (_USINGTEXCOORD1 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER || _PASSFORWARDADD) && LIGHTMAP_ON))) + float4 texcoord1 : TEXCOORD1; + #endif + #if _STANDARD && (_USINGTEXCOORD2 || (_PASSMETA || ((_PASSFORWARD || _PASSGBUFFER) && DYNAMICLIGHTMAP_ON))) + float4 texcoord2 : TEXCOORD2; + #endif + + + #if _HDRP + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + #endif + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD4; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD5; // Add Precomputed Velocity (Alembic computes velocities on runtime side). + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct TessVertex + { + float4 vertex : INTERNALTESSPOS; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float4 texcoord0 : TEXCOORD0; + float4 texcoord1 : TEXCOORD1; + float4 texcoord2 : TEXCOORD2; + + // #if %TEXCOORD3REQUIREKEY% + // float4 texcoord3 : TEXCOORD3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + float4 vertexColor : COLOR; + // #endif + + // #if %EXTRAV2F0REQUIREKEY% + float4 extraV2F0 : TEXCOORD5; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + float4 extraV2F1 : TEXCOORD6; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + float4 extraV2F2 : TEXCOORD7; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + float4 extraV2F3 : TEXCOORD8; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // float4 extraV2F4 : TEXCOORD9; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // float4 extraV2F5 : TEXCOORD10; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // float4 extraV2F6 : TEXCOORD11; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // float4 extraV2F7 : TEXCOORD12; + // #endif + + #if _PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR)) + float3 previousPositionOS : TEXCOORD13; // Contain previous transform position (in case of skinning for example) + #if defined (_ADD_PRECOMPUTED_VELOCITY) + float3 precomputedVelocity : TEXCOORD14; + #endif + #endif + + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + }; + + struct ExtraV2F + { + float4 extraV2F0; + float4 extraV2F1; + float4 extraV2F2; + float4 extraV2F3; + float4 extraV2F4; + float4 extraV2F5; + float4 extraV2F6; + float4 extraV2F7; + Blackboard blackboard; + float4 time; + }; + + + float3 WorldToTangentSpace(ShaderData d, float3 normal) + { + return mul(d.TBNMatrix, normal); + } + + float3 TangentToWorldSpace(ShaderData d, float3 normal) + { + return mul(normal, d.TBNMatrix); + } + + // in this case, make standard more like SRPs, because we can't fix + // unity_WorldToObject in HDRP, since it already does macro-fu there + + #if _STANDARD + float3 TransformWorldToObject(float3 p) { return mul(unity_WorldToObject, float4(p, 1)); }; + float3 TransformObjectToWorld(float3 p) { return mul(unity_ObjectToWorld, float4(p, 1)); }; + float4 TransformWorldToObject(float4 p) { return mul(unity_WorldToObject, p); }; + float4 TransformObjectToWorld(float4 p) { return mul(unity_ObjectToWorld, p); }; + float4x4 GetWorldToObjectMatrix() { return unity_WorldToObject; } + float4x4 GetObjectToWorldMatrix() { return unity_ObjectToWorld; } + #if (defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (SHADER_TARGET_SURFACE_ANALYSIS && !SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER)) + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord, lod) tex.SampleLevel (sampler##tex,coord, lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord, lod) tex.SampleLevel (sampler##samplertex,coord, lod) + #else + #define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2D (tex,coord,0,lod) + #define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplertex,coord,lod) tex2D (tex,coord,0,lod) + #endif + + #undef GetWorldToObjectMatrix() + + #define GetWorldToObjectMatrix() unity_WorldToObject + + + #endif + + float3 GetCameraWorldPosition() + { + #if _HDRP + return GetCameraRelativePositionWS(_WorldSpaceCameraPos); + #else + return _WorldSpaceCameraPos; + #endif + } + + #if _GRABPASSUSED + #if _STANDARD + TEXTURE2D(%GRABTEXTURE%); + SAMPLER(sampler_%GRABTEXTURE%); + #endif + + half3 GetSceneColor(float2 uv) + { + #if _STANDARD + return SAMPLE_TEXTURE2D(%GRABTEXTURE%, sampler_%GRABTEXTURE%, uv).rgb; + #else + return SHADERGRAPH_SAMPLE_SCENE_COLOR(uv); + #endif + } + #endif + + + + #if _STANDARD + UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); + float GetSceneDepth(float2 uv) { return SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv)); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv)); } + #else + float GetSceneDepth(float2 uv) { return SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv); } + float GetLinear01Depth(float2 uv) { return Linear01Depth(GetSceneDepth(uv), _ZBufferParams); } + float GetLinearEyeDepth(float2 uv) { return LinearEyeDepth(GetSceneDepth(uv), _ZBufferParams); } + #endif + + float3 GetWorldPositionFromDepthBuffer(float2 uv, float3 worldSpaceViewDir) + { + float eye = GetLinearEyeDepth(uv); + float3 camView = mul((float3x3)GetObjectToWorldMatrix(), transpose(mul(GetWorldToObjectMatrix(), UNITY_MATRIX_I_V)) [2].xyz); + + float dt = dot(worldSpaceViewDir, camView); + float3 div = worldSpaceViewDir/dt; + float3 wpos = (eye * div) + GetCameraWorldPosition(); + return wpos; + } + + #if _HDRP + float3 ObjectToWorldSpacePosition(float3 pos) + { + return GetAbsolutePositionWS(TransformObjectToWorld(pos)); + } + #else + float3 ObjectToWorldSpacePosition(float3 pos) + { + return TransformObjectToWorld(pos); + } + #endif + + #if _STANDARD + UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture); + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + float4 depthNorms = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture, uv); + float3 norms = DecodeViewNormalStereo(depthNorms); + norms = mul((float3x3)GetWorldToViewMatrix(), norms) * 0.5 + 0.5; + return norms; + } + #elif _HDRP && !_DECALSHADER + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + NormalData nd; + DecodeFromNormalBuffer(_ScreenSize.xy * uv, nd); + return nd.normalWS; + } + #elif _URP + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl" + #endif + + float3 GetSceneNormal(float2 uv, float3 worldSpaceViewDir) + { + #if (SHADER_LIBRARY_VERSION_MAJOR >= 10) + return SampleSceneNormals(uv); + #else + float3 wpos = GetWorldPositionFromDepthBuffer(uv, worldSpaceViewDir); + return normalize(-cross(ddx(wpos), ddy(wpos))) * 0.5 + 0.5; + #endif + + } + #endif + + #if _HDRP + + half3 UnpackNormalmapRGorAG(half4 packednormal) + { + // This do the trick + packednormal.x *= packednormal.w; + + half3 normal; + normal.xy = packednormal.xy * 2 - 1; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + half3 UnpackNormal(half4 packednormal) + { + #if defined(UNITY_NO_DXT5nm) + return packednormal.xyz * 2 - 1; + #else + return UnpackNormalmapRGorAG(packednormal); + #endif + } + #endif + #if _HDRP || _URP + + half3 UnpackScaleNormal(half4 packednormal, half scale) + { + #ifndef UNITY_NO_DXT5nm + // Unpack normal as DXT5nm (1, y, 1, x) or BC5 (x, y, 0, 1) + // Note neutral texture like "bump" is (0, 0, 1, 1) to work with both plain RGB normal and DXT5nm/BC5 + packednormal.x *= packednormal.w; + #endif + half3 normal; + normal.xy = (packednormal.xy * 2 - 1) * scale; + normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy))); + return normal; + } + + #endif + + + void GetSun(out float3 lightDir, out float3 color) + { + lightDir = float3(0.5, 0.5, 0); + color = 1; + #if _HDRP + if (_DirectionalLightCount > 0) + { + DirectionalLightData light = _DirectionalLightDatas[0]; + lightDir = -light.forward.xyz; + color = light.color; + } + #elif _STANDARD + lightDir = normalize(_WorldSpaceLightPos0.xyz); + color = _LightColor0.rgb; + #elif _URP + Light light = GetMainLight(); + lightDir = light.direction; + color = light.color; + #endif + } + + + + CBUFFER_START(UnityPerMaterial) + + + half4 _Color; + half _Alpha; + half _AlphaCutoffValue; + + half _TimingSeed; + + #if TIMEISCUSTOM_ON + float4 globalCustomTime; + #endif + + half4 _MainTex_ST, _ShapeColor; + half _ShapeXSpeed, _ShapeYSpeed, _ShapeColorWeight, _ShapeAlphaWeight; + + #if SHAPE1CONTRAST_ON + half _ShapeContrast, _ShapeBrightness; + #endif + + #if SHAPE1DISTORT_ON + half4 _ShapeDistortTex_ST; + half _ShapeDistortAmount, _ShapeDistortXSpeed, _ShapeDistortYSpeed; + #endif + + #if SHAPE1ROTATE_ON + half _ShapeRotationOffset, _ShapeRotationSpeed; + #endif + + #if OFFSETSTREAM_ON + half _OffsetSh1; + #endif + + #if SHAPEWEIGHTS_ON + half _Sh1BlendOffset; + #endif + + #if SHAPE2_ON + half4 _Shape2Tex_ST, _Shape2Color; + half _Shape2XSpeed, _Shape2YSpeed, _Shape2ColorWeight, _Shape2AlphaWeight; + #if SHAPE2CONTRAST_ON + half _Shape2Contrast, _Shape2Brightness; + #endif + #if SHAPE2DISTORT_ON + half4 _Shape2DistortTex_ST; + half _Shape2DistortAmount, _Shape2DistortXSpeed, _Shape2DistortYSpeed; + #endif + #if SHAPE2ROTATE_ON + half _Shape2RotationOffset, _Shape2RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh2; + #endif + #if SHAPEWEIGHTS_ON + half _Sh2BlendOffset; + #endif + #endif + + #if SHAPE3_ON + half4 _Shape3Tex_ST, _Shape3Color; + half _Shape3XSpeed, _Shape3YSpeed, _Shape3ColorWeight, _Shape3AlphaWeight; + #if SHAPE3CONTRAST_ON + half _Shape3Contrast, _Shape3Brightness; + #endif + #if SHAPE3DISTORT_ON + half4 _Shape3DistortTex_ST; + half _Shape3DistortAmount, _Shape3DistortXSpeed, _Shape3DistortYSpeed; + #endif + #if SHAPE3ROTATE_ON + half _Shape3RotationOffset, _Shape3RotationSpeed; + #endif + #if OFFSETSTREAM_ON + half _OffsetSh3; + #endif + #if SHAPEWEIGHTS_ON + half _Sh3BlendOffset; + #endif + #endif + + #if GLOW_ON + half4 _GlowColor; + half _Glow, _GlowGlobal; + #if GLOWTEX_ON + half4 _GlowTex_ST; + #endif + #endif + + #if MASK_ON + half4 _MaskTex_ST; + half _MaskPow; + #endif + + #if COLORRAMP_ON + half _ColorRampLuminosity, _ColorRampBlend; + #endif + + #if ALPHASMOOTHSTEP_ON + half _AlphaStepMin, _AlphaStepMax; + #endif + + #if ALPHAFADE_ON + half _AlphaFadeAmount, _AlphaFadeSmooth, _AlphaFadePow; + #endif + + #if HSV_ON + half _HsvShift, _HsvSaturation, _HsvBright; + #endif + + #if POSTERIZE_ON + half _PosterizeNumColors; + #endif + + #if PIXELATE_ON + half _PixelateSize; + #endif + + #if DISTORT_ON + half4 _DistortTex_ST; + half _DistortTexXSpeed, _DistortTexYSpeed, _DistortAmount; + #endif + + #if TEXTURESCROLL_ON + half _TextureScrollXSpeed, _TextureScrollYSpeed; + #endif + + #if SHAKEUV_ON + half _ShakeUvSpeed, _ShakeUvX, _ShakeUvY; + #endif + + #if WAVEUV_ON + half _WaveAmount, _WaveSpeed, _WaveStrength, _WaveX, _WaveY; + #endif + + #if ROUNDWAVEUV_ON + half _RoundWaveStrength, _RoundWaveSpeed; + #endif + + #if TWISTUV_ON + half _TwistUvAmount, _TwistUvPosX, _TwistUvPosY, _TwistUvRadius; + #endif + + #if DOODLE_ON + half _HandDrawnAmount, _HandDrawnSpeed; + #endif + + #if ROUNDWAVEUV_ON || PIXELATE_ON + half4 _MainTex_TexelSize; + #endif + + #if VERTOFFSET_ON + half4 _VertOffsetTex_ST; + half _VertOffsetAmount, _VertOffsetPower, _VertOffsetTexXSpeed, _VertOffsetTexYSpeed; + #endif + + #if FADE_ON + half4 _FadeTex_ST; + half _FadeAmount, _FadeTransition, _FadePower, _FadeScrollXSpeed, _FadeScrollYSpeed; + #if FADEBURN_ON + half4 _FadeBurnColor, _FadeBurnTex_ST; + half _FadeBurnWidth, _FadeBurnGlow; + #endif + #endif + + #if COLORGRADING_ON + half3 _ColorGradingLight, _ColorGradingMiddle, _ColorGradingDark; + half _ColorGradingMidPoint; + #endif + + #if CAMDISTFADE_ON + half _CamDistFadeStepMin, _CamDistFadeStepMax, _CamDistProximityFade; + #endif + + #if RIM_ON + half _RimBias, _RimScale, _RimPower, _RimIntensity, _RimAddAmount, _RimErodesAlpha; + half4 _RimColor; + #endif + + #if BACKFACETINT_ON + half4 _BackFaceTint, _FrontFaceTint; + #endif + + #if SHAPEDEBUG_ON + half _DebugShape; + #endif + + #if SHAPE1MASK_ON + half4 _Shape1MaskTex_ST; + half _Shape1MaskPow; + #endif + + #if TRAILWIDTH_ON + half _TrailWidthPower; + #endif + + #if LIGHTANDSHADOW_ON + half3 _All1VfxLightDir; + half _ShadowAmount, _ShadowStepMin, _ShadowStepMax, _LightAmount; + half4 _LightColor; + #endif + + #if SHAPETEXOFFSET_ON + half _RandomSh1Mult, _RandomSh2Mult, _RandomSh3Mult; + #endif + + #if DEPTHGLOW_ON + half _DepthGlowDist, _DepthGlowPow, _DepthGlow, _DepthGlowGlobal; + half4 _DepthGlowColor; + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half _ScreenUvShDistScale,_ScreenUvSh2DistScale, _ScreenUvSh3DistScale; + #endif + + #if NORMALMAP_ON + half _NormalStrength; + #endif + + + + + CBUFFER_END + + + + + + + + TEXTURE2D(_MainTex); + SAMPLER(sampler_MainTex); + + #if SHAPE1DISTORT_ON + TEXTURE2D(_ShapeDistortTex); + SAMPLER(sampler_ShapeDistortTex); + #endif + + #if SHAPE2_ON + TEXTURE2D(_Shape2Tex); + SAMPLER(sampler_Shape2Tex); + #if SHAPE2DISTORT_ON + TEXTURE2D(_Shape2DistortTex); + SAMPLER(sampler_Shape2DistortTex); + #endif + #endif + + #if SHAPE3_ON + TEXTURE2D(_Shape3Tex); + SAMPLER(sampler_Shape3Tex); + #if SHAPE3DISTORT_ON + TEXTURE2D(_Shape3DistortTex); + SAMPLER(sampler_Shape3DistortTex); + #endif + #endif + + #if GLOW_ON + #if GLOWTEX_ON + TEXTURE2D(_GlowTex); + SAMPLER(sampler_GlowTex); + #endif + #endif + + #if MASK_ON + TEXTURE2D(_MaskTex); + SAMPLER(sampler_MaskTex); + #endif + + #if COLORRAMP_ON + TEXTURE2D(_ColorRampTex); + SAMPLER(sampler_ColorRampTex); + #endif + + #if COLORRAMPGRAD_ON + TEXTURE2D(_ColorRampTexGradient); + SAMPLER(sampler_ColorRampTexGradient); + #endif + + #if DISTORT_ON + TEXTURE2D(_DistortTex); + SAMPLER(sampler_DistortTex); + #endif + + #if VERTOFFSET_ON + TEXTURE2D(_VertOffsetTex); + SAMPLER(sampler_VertOffsetTex); + #endif + + #if FADE_ON + TEXTURE2D(_FadeTex); + SAMPLER(sampler_FadeTex); + #if FADEBURN_ON + TEXTURE2D(_FadeBurnTex); + SAMPLER(sampler_FadeBurnTex); + #endif + #endif + + #if SHAPE1MASK_ON + TEXTURE2D(_Shape1MaskTex); + SAMPLER(sampler_Shape1MaskTex); + #endif + + #if TRAILWIDTH_ON + TEXTURE2D(_TrailWidthGradient); + SAMPLER(sampler_TrailWidthGradient); + #endif + + #if NORMALMAP_ON + TEXTURE2D(_NormalMap); + SAMPLER(sampler_NormalMap); + #endif + + half4 SampleTextureWithScroll(in Texture2D _tex, in SamplerState _sampler, in float2 uv, in half scrollXSpeed, in half scrollYSpeed, in float time) + { + half2 _uv = uv; + _uv.x += (time * scrollXSpeed) % 1; + _uv.y += (time * scrollYSpeed) % 1; + return SAMPLE_TEXTURE2D(_tex, _sampler, _uv); + } + + half EaseOutQuint(half x) + { + return 1 - pow(1 - x, 5); + } + + half RemapFloat(half inValue, half inMin, half inMax, half outMin, half outMax) + { + return outMin + (inValue - inMin) * (outMax - outMin) / (inMax - inMin); + } + + float2 RotateUvs(float2 uv, half rotation, half4 scaleAndTranslate) + { + half2 center = half2(0.5 * scaleAndTranslate.x + scaleAndTranslate.z, 0.5 * scaleAndTranslate.y + scaleAndTranslate.w); + half cosAngle = cos(rotation); + half sinAngle = sin(rotation); + uv -= center; + uv = mul(half2x2(cosAngle, -sinAngle, sinAngle, cosAngle), uv); + uv += center; + return uv; + } + + half4 GetDebugColor(float4 resColor, half4 shape1, half4 shape2, half4 shape3) + { + half4 res = resColor; + + //MAKE SURE THE FOLLOWING CODE BLOCK IS UNCOMMENTED------------------------------------------- + #if SHAPEDEBUG_ON + if(_DebugShape < 1.5) return shape1; + #if SHAPE2_ON + else if (_DebugShape < 2.5) return shape2; + #endif + #if SHAPE3_ON + else return shape3; + #endif + #endif + + return res; + } + + void Ext_ModifyVertex0 (inout VertexData v, inout ExtraV2F d) + { + //uvDistTex --> extraV2F0 + //uvSh1DistTex --> extraV2F1 + //uvSh2DistTex --> extraV2F2 + //uvSh3DistTex --> extraV2F3 + + #if VERTOFFSET_ON + #if TIMEISCUSTOM_ON + const half time = v.texcoord0.z + globalCustomTime.y; + #else + const half time = v.texcoord0.z + _Time.y; + #endif + half4 offsetUv = half4(TRANSFORM_TEX(v.texcoord0.xy, _VertOffsetTex), 0, 0); + offsetUv.x += (time * _VertOffsetTexXSpeed) % 1; + offsetUv.y += (time * _VertOffsetTexYSpeed) % 1; + v.vertex.xyz += v.normal * _VertOffsetAmount * pow(SAMPLE_TEXTURE2D_LOD(_VertOffsetTex, sampler_VertOffsetTex, offsetUv, 0).r, _VertOffsetPower); + #endif + + #if DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F0.xy = TRANSFORM_TEX(v.texcoord0.xy, _DistortTex); + #endif + + #if SHAPE1DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F1.xy = TRANSFORM_TEX(v.texcoord0.xy, _ShapeDistortTex); + #endif + + #if SHAPE2_ON + #if SHAPE2DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F2.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape2DistortTex);; + #endif + #endif + + #if SHAPE3_ON + #if SHAPE3DISTORT_ON && !POLARUVDISTORT_ON + d.extraV2F3.xy = TRANSFORM_TEX(v.texcoord0.xy, _Shape3DistortTex); + #endif + #endif + } + + void Ext_SurfaceFunction0 (inout Surface o, ShaderData d) + { + //i.uvSeed -> d.texcoord0.xy + + float seed = d.texcoord0.z + _TimingSeed; + #if TIMEISCUSTOM_ON + const float4 shaderTime = globalCustomTime; + #else + const float4 shaderTime = _Time; + #endif + float time = shaderTime.y + seed; + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 originalUvs = d.texcoord0.xy; + #endif + + #if PIXELATE_ON + half aspectRatio = _MainTex_TexelSize.x / _MainTex_TexelSize.y; + half2 pixelSize = float2(_PixelateSize, _PixelateSize * aspectRatio); + d.texcoord0.xy = floor(d.texcoord0.xy * pixelSize) / pixelSize; + #endif + + #if NORMALMAP_ON + half4 normalSample = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, d.texcoord0.xy); + half3 normalTS = UnpackNormal(normalSample); + normalTS.xy *= _NormalStrength; + o.Normal = normalTS; + #endif + + #if TWISTUV_ON + half2 tempUv = d.texcoord0.xy - half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + _TwistUvRadius *= (_MainTex_ST.x + _MainTex_ST.y) / 2; + half percent = (_TwistUvRadius - length(tempUv)) / _TwistUvRadius; + half theta = percent * percent * (2.0 * sin(_TwistUvAmount)) * 8.0; + half s = sin(theta); + half c = cos(theta); + half beta = max(sign(_TwistUvRadius - length(tempUv)), 0.0); + tempUv = half2(dot(tempUv, half2(c, -s)), dot(tempUv, half2(s, c))) * beta + tempUv * (1 - beta); + tempUv += half2(_TwistUvPosX * _MainTex_ST.x, _TwistUvPosY * _MainTex_ST.y); + d.texcoord0.xy = tempUv; + #endif + + #if DOODLE_ON + half2 uvCopy = d.texcoord0.xy; + _HandDrawnSpeed = (floor((shaderTime.x + seed) * 20 * _HandDrawnSpeed) / _HandDrawnSpeed) * _HandDrawnSpeed; + uvCopy.x = sin((uvCopy.x * _HandDrawnAmount + _HandDrawnSpeed) * 4); + uvCopy.y = cos((uvCopy.y * _HandDrawnAmount + _HandDrawnSpeed) * 4); + d.texcoord0.xy = lerp(d.texcoord0.xy, d.texcoord0.xy + uvCopy, 0.0005 * _HandDrawnAmount); + #endif + + #if SHAKEUV_ON + half xShake = sin((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvX; + half yShake = cos((shaderTime.x + seed) * _ShakeUvSpeed * 50) * _ShakeUvY; + d.texcoord0.xy += half2(xShake * 0.012, yShake * 0.01); + #endif + + #if WAVEUV_ON + half2 uvWave = half2(_WaveX * _MainTex_ST.x, _WaveY * _MainTex_ST.y) - d.texcoord0.xy; + #if ATLAS_ON + uvWave = half2(_WaveX, _WaveY) - uvRect; + #endif + uvWave.x *= _ScreenParams.x / _ScreenParams.y; + half angWave = (sqrt(dot(uvWave, uvWave)) * _WaveAmount) - ((time * _WaveSpeed) % 360.0); + d.texcoord0.xy = d.texcoord0.xy + normalize(uvWave) * sin(angWave) * (_WaveStrength / 1000.0); + #endif + + #if ROUNDWAVEUV_ON + half xWave = ((0.5 * _MainTex_ST.x) - d.texcoord0.x); + half yWave = ((0.5 * _MainTex_ST.y) - d.texcoord0.y) * (_MainTex_TexelSize.w / _MainTex_TexelSize.z); + half ripple = -sqrt(xWave*xWave + yWave* yWave); + d.texcoord0.xy += (sin((ripple + time * (_RoundWaveSpeed/10.0)) / 0.015) * (_RoundWaveStrength/10.0)) % 1; + #endif + + #if POLARUV_ON + half2 prePolarUvs = d.texcoord0.xy; + d.texcoord0.xy = d.texcoord0.xy - half2(0.5, 0.5); + d.texcoord0.xy = half2(atan2(d.texcoord0.y, d.texcoord0.x) / (1.0 * 6.28318530718), length(d.texcoord0.xy) * 2.0); + d.texcoord0.xy *= _MainTex_ST.xy; + #endif + + #if DISTORT_ON + #if POLARUVDISTORT_ON + half2 distortUvs = TRANSFORM_TEX(d.texcoord0.xy, _DistortTex); + #else + half2 distortUvs = d.extraV2F0.xy; + #endif + distortUvs.x += ((shaderTime.x + seed) * _DistortTexXSpeed) % 1; + distortUvs.y += ((shaderTime.x + seed) * _DistortTexYSpeed) % 1; + #if ATLAS_ON + d.extraV2F0.xy = half2((d.extraV2F0.x - _MinXUV) / (_MaxXUV - _MinXUV), (d.extraV2F0.y - _MinYUV) / (_MaxYUV - _MinYUV)); + #endif + half distortAmnt = (SAMPLE_TEXTURE2D(_DistortTex, sampler_DistortTex, distortUvs).r - 0.5) * 0.2 * _DistortAmount; + d.texcoord0.x += distortAmnt; + d.texcoord0.y += distortAmnt; + #endif + + #if TEXTURESCROLL_ON + d.texcoord0.x += (time * _TextureScrollXSpeed) % 1; + d.texcoord0.y += (time * _TextureScrollYSpeed) % 1; + #endif + + #if TRAILWIDTH_ON + half width = pow(SAMPLE_TEXTURE2D(_TrailWidthGradient, sampler_TrailWidthGradient, d.texcoord0).r, _TrailWidthPower); + d.texcoord0.y = (d.texcoord0.y * 2 - 1) / width * 0.5 + 0.5; + clip(d.texcoord0.y); + clip(1 - d.texcoord0.y); + #endif + + float2 shape1Uv = d.texcoord0.xy; + #if SHAPE2_ON + float2 shape2Uv = shape1Uv; + #endif + #if SHAPE3_ON + float2 shape3Uv = shape1Uv; + #endif + + #if CAMDISTFADE_ON || SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half camDistance = distance(d.worldSpacePosition, _WorldSpaceCameraPos); + #endif + + #if SHAPE1SCREENUV_ON || SHAPE2SCREENUV_ON || SHAPE3SCREENUV_ON + half2 uvOffsetPostFx = d.texcoord0.xy - originalUvs; + d.texcoord0.xy = d.screenPos.xy / d.screenPos.w; + d.texcoord0.x = d.texcoord0.x * (_ScreenParams.x / _ScreenParams.y); + d.texcoord0.x -= 0.5; + d.texcoord0.xy -= uvOffsetPostFx; + originalUvs += uvOffsetPostFx; + half distanceZoom = camDistance * 0.1; + half2 scaleWithDistUvs = d.texcoord0.xy * distanceZoom + ((-distanceZoom * 0.5) + 0.5); + #if SHAPE1SCREENUV_ON + shape1Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvShDistScale); + #else + shape1Uv = originalUvs; + #endif + #if SHAPE2SCREENUV_ON && SHAPE2_ON + shape2Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh2DistScale); + #else + #if SHAPE2_ON + shape2Uv = originalUvs; + #endif + #endif + #if SHAPE3SCREENUV_ON && SHAPE3_ON + shape3Uv = lerp(d.texcoord0.xy, scaleWithDistUvs, _ScreenUvSh3DistScale); + #else + #if SHAPE3_ON + shape3Uv = originalUvs; + #endif + #endif + #endif + + shape1Uv = TRANSFORM_TEX(shape1Uv, _MainTex); + #if OFFSETSTREAM_ON + shape1Uv.x += i.offsetCustomData.x * _OffsetSh1; + shape1Uv.y += i.offsetCustomData.y * _OffsetSh1; + #endif + #if SHAPETEXOFFSET_ON + shape1Uv += seed * _RandomSh1Mult; + #endif + + #if SHAPE1DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh1DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _ShapeDistortTex); + #else + half2 sh1DistortUvs = d.extraV2F1.xy; + #endif + + sh1DistortUvs.x += ((time + seed) * _ShapeDistortXSpeed) % 1; + sh1DistortUvs.y += ((time + seed) * _ShapeDistortYSpeed) % 1; + half distortAmount = (SAMPLE_TEXTURE2D(_ShapeDistortTex, sampler_ShapeDistortTex, sh1DistortUvs).r - 0.5) * 0.2 * _ShapeDistortAmount; + shape1Uv.x += distortAmount; + shape1Uv.y += distortAmount; + #endif + #if SHAPE1ROTATE_ON + shape1Uv = RotateUvs(shape1Uv, _ShapeRotationOffset + ((_ShapeRotationSpeed * time) % 6.28318530718), _MainTex_ST); + #endif + + half4 shape1 = SampleTextureWithScroll(_MainTex, sampler_MainTex, shape1Uv, _ShapeXSpeed, _ShapeYSpeed, time); + #if SHAPE1SHAPECOLOR_ON + shape1.a = shape1.r; + shape1.rgb = _ShapeColor.rgb; + #else + shape1 *= _ShapeColor; + #endif + #if SHAPE1CONTRAST_ON + #if SHAPE1SHAPECOLOR_ON + shape1.a = saturate((shape1.a - 0.5) * _ShapeContrast + 0.5 + _ShapeBrightness); + #else + shape1.rgb = max(0, (shape1.rgb - half3(0.5, 0.5, 0.5)) * _ShapeContrast + half3(0.5, 0.5, 0.5) + _ShapeBrightness); + #endif + #endif + + half4 shape2 = 1.0; + #if SHAPE2_ON + shape2Uv = TRANSFORM_TEX(shape2Uv, _Shape2Tex); + #if OFFSETSTREAM_ON + shape2Uv.x += i.offsetCustomData.x * _OffsetSh2; + shape2Uv.y += i.offsetCustomData.y * _OffsetSh2; + #endif + #if SHAPETEXOFFSET_ON + shape2Uv += seed * _RandomSh2Mult; + #endif + #if SHAPE2DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh2DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape2DistortTex); + #else + half2 sh2DistortUvs = d.extraV2F2.xy; + #endif + sh2DistortUvs.x += ((time + seed) * _Shape2DistortXSpeed) % 1; + sh2DistortUvs.y += ((time + seed) * _Shape2DistortYSpeed) % 1; + half distortAmnt2 = (SAMPLE_TEXTURE2D(_Shape2DistortTex, sampler_Shape2DistortTex, sh2DistortUvs).r - 0.5) * 0.2 * _Shape2DistortAmount; + shape2Uv.x += distortAmnt2; + shape2Uv.y += distortAmnt2; + #endif + #if SHAPE2ROTATE_ON + shape2Uv = RotateUvs(shape2Uv, _Shape2RotationOffset + ((_Shape2RotationSpeed * time) % 6.28318530718), _Shape2Tex_ST); + #endif + + shape2 = SampleTextureWithScroll(_Shape2Tex, sampler_Shape2Tex, shape2Uv, _Shape2XSpeed, _Shape2YSpeed, time); + #if SHAPE2SHAPECOLOR_ON + shape2.a = shape2.r; + shape2.rgb = _Shape2Color.rgb; + #else + shape2 *= _Shape2Color; + #endif + #if SHAPE2CONTRAST_ON + #if SHAPE2SHAPECOLOR_ON + shape2.a = max(0, (shape2.a - 0.5) * _Shape2Contrast + 0.5 + _Shape2Brightness); + #else + shape2.rgb = max(0, (shape2.rgb - half3(0.5, 0.5, 0.5)) * _Shape2Contrast + half3(0.5, 0.5, 0.5) + _Shape2Brightness); + #endif + #endif + #endif + + half4 shape3 = 1.0; + #if SHAPE3_ON + shape3Uv = TRANSFORM_TEX(shape3Uv, _Shape3Tex); + + #if OFFSETSTREAM_ON + shape3Uv.x += i.offsetCustomData.x * _OffsetSh3; + shape3Uv.y += i.offsetCustomData.y * _OffsetSh3; + #endif + #if SHAPETEXOFFSET_ON + shape3Uv += seed * _RandomSh3Mult; + #endif + #if SHAPE3DISTORT_ON + #if POLARUVDISTORT_ON + half2 sh3DistortUvs = TRANSFORM_TEX(d.texcoord0.xy, _Shape3DistortTex); + #else + half2 sh3DistortUvs = d.extraV2F3.xy; + #endif + sh3DistortUvs.x += ((time + seed) * _Shape3DistortXSpeed) % 1; + sh3DistortUvs.y += ((time + seed) * _Shape3DistortYSpeed) % 1; + half distortAmnt3 = (SAMPLE_TEXTURE2D(_Shape3DistortTex, sampler_Shape3DistortTex, sh3DistortUvs).r - 0.5) * 0.3 * _Shape3DistortAmount; + shape3Uv.x += distortAmnt3; + shape3Uv.y += distortAmnt3; + #endif + #if SHAPE3ROTATE_ON + shape3Uv = RotateUvs(shape3Uv, _Shape3RotationOffset + ((_Shape3RotationSpeed * time) % 6.28318530718), _Shape3Tex_ST); + #endif + shape3 = SampleTextureWithScroll(_Shape3Tex, sampler_Shape3Tex, shape3Uv, _Shape3XSpeed, _Shape3YSpeed, time); + #if SHAPE3SHAPECOLOR_ON + shape3.a = shape3.r; + shape3.rgb = _Shape3Color.rgb; + #else + shape3 *= _Shape3Color; + #endif + #if SHAPE3CONTRAST_ON + #if SHAPE3SHAPECOLOR_ON + shape3.a = max(0, (shape3.a - 0.5) * _Shape3Contrast + 0.5 + _Shape3Brightness); + #else + shape3.rgb = max(0, (shape3.rgb - half3(0.5, 0.5, 0.5)) * _Shape3Contrast + half3(0.5, 0.5, 0.5) + _Shape3Brightness); + #endif + #endif + #endif + + half4 col = shape1; + //Mix all shapes pre: change weights if custom vertex effect active + #if SHAPEWEIGHTS_ON + half shapeWeightOffset; + #if SHAPE2_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh1BlendOffset; + _ShapeColorWeight = max(0, _ShapeColorWeight + shapeWeightOffset); + _ShapeAlphaWeight = max(0, _ShapeAlphaWeight + shapeWeightOffset); + shapeWeightOffset = i.offsetCustomData.z * _Sh2BlendOffset; + _Shape2ColorWeight = max(0, _Shape2ColorWeight + shapeWeightOffset); + _Shape2AlphaWeight = max(0, _Shape2AlphaWeight + shapeWeightOffset); + #endif + #if SHAPE3_ON + shapeWeightOffset = i.offsetCustomData.z * _Sh3BlendOffset; + _Shape3ColorWeight = max(0, _Shape3ColorWeight + shapeWeightOffset); + _Shape3AlphaWeight = max(0, _Shape3AlphaWeight + shapeWeightOffset); + #endif + #endif + + //Mix all shapes + #if SHAPE2_ON + #if !SPLITRGBA_ON + _ShapeAlphaWeight = _ShapeColorWeight; + _Shape2AlphaWeight = _Shape2ColorWeight; + #endif + #if SHAPE3_ON //Shape3 On + #if !SPLITRGBA_ON + _Shape3AlphaWeight = _Shape3ColorWeight; + #endif + #if SHAPEADD_ON + col.rgb = ((shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight)) + (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(max(shape3.a * _Shape3AlphaWeight, max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight))); + #else + col.rgb = ((shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight)) * (shape3.rgb * _Shape3ColorWeight); + col.a = saturate(((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)) * (shape3.a * _Shape3AlphaWeight)); + #endif + #else //Shape3 Off + #if SHAPEADD_ON + col.rgb = (shape1.rgb * _ShapeColorWeight) + (shape2.rgb * _Shape2ColorWeight); + col.a = saturate(max(shape1.a * _ShapeAlphaWeight, shape2.a * _Shape2AlphaWeight)); + #else + col.rgb = (shape1.rgb * _ShapeColorWeight) * (shape2.rgb * _Shape2ColorWeight); + col.a = saturate((shape1.a * _ShapeAlphaWeight) * (shape2.a * _Shape2AlphaWeight)); + #endif + #endif + #endif + + #if SHAPE1MASK_ON + col = lerp(col, shape1, pow(SAMPLE_TEXTURE2D(_Shape1MaskTex, sampler_Shape1MaskTex, TRANSFORM_TEX(i.uvSeed.xy, _Shape1MaskTex)).r, _Shape1MaskPow)); + #endif + + #if PREMULTIPLYCOLOR_ON + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + col.a = min(luminance, col.a); + #endif + + col.rgb *= _Color.rgb * d.vertexColor.rgb; + #if PREMULTIPLYALPHA_ON + col.rgb *= col.a; + #endif + + #if !PREMULTIPLYCOLOR_ON && (COLORRAMP_ON || ALPHAFADE_ON || COLORGRADING_ON || FADE_ON || (ADDITIVECONFIG_ON && (GLOW_ON || DEPTHGLOW_ON))) + half luminance = 0; + luminance = 0.3 * col.r + 0.59 * col.g + 0.11 * col.b; + luminance *= col.a; + #endif + + #if (FADE_ON || ALPHAFADE_ON) && ALPHAFADEINPUTSTREAM_ON + col.a *= d.vertexColor.a; + d.vertexColor.a = d.texcoord0.w; + #endif + + #if FADE_ON + half preFadeAlpha = col.a; + _FadeAmount = saturate(_FadeAmount + (1 - d.vertexColor.a)); + _FadeTransition = max(0.01, _FadeTransition * EaseOutQuint(saturate(_FadeAmount))); + half2 fadeUv; + fadeUv = d.texcoord0.xy + seed; + fadeUv.x += (time * _FadeScrollXSpeed) % 1; + fadeUv.y += (time * _FadeScrollYSpeed) % 1; + half2 tiledUvFade1 = TRANSFORM_TEX(fadeUv, _FadeTex); + #if ADDITIVECONFIG_ON && !PREMULTIPLYCOLOR_ON + preFadeAlpha *= luminance; + #endif + _FadeAmount = saturate(pow(_FadeAmount, _FadePower)); + #if FADEBURN_ON + half2 tiledUvFade2 = TRANSFORM_TEX(fadeUv, _FadeBurnTex); + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + half fadeNaturalEdge = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fadeNaturalEdge; + half fadeBurn = saturate(smoothstep(0.0 , _FadeTransition + _FadeBurnWidth, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + fadeBurn = fadeNaturalEdge - fadeBurn; + _FadeBurnColor.rgb *= _FadeBurnGlow; + col.rgb += fadeBurn * SAMPLE_TEXTURE2D(_FadeBurnTex, sampler_FadeBurnTex, tiledUvFade2).rgb * _FadeBurnColor.rgb * preFadeAlpha; + #else + half fadeSample = SAMPLE_TEXTURE2D(_FadeTex, sampler_FadeTex, tiledUvFade1).r; + float fade = saturate(smoothstep(0.0 , _FadeTransition, RemapFloat(1.0 - _FadeAmount, 0.0, 1.0, -1.0, 1.0) + fadeSample)); + col.a *= fade; + #endif + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _FadeAmount; + #endif + #endif + + #if ALPHAFADE_ON + half alphaFadeLuminance; + _AlphaFadeAmount = saturate(_AlphaFadeAmount + (1 - d.vertexColor.a)); + _AlphaFadeAmount = saturate(pow(_AlphaFadeAmount, _AlphaFadePow)); + _AlphaFadeSmooth = max(0.01, _AlphaFadeSmooth * EaseOutQuint(saturate(_AlphaFadeAmount))); + #if ALPHAFADEUSESHAPE1_ON + alphaFadeLuminance = shape1.r; + #else + alphaFadeLuminance = luminance; + #endif + alphaFadeLuminance = saturate(alphaFadeLuminance - 0.001); + #if ALPHAFADEUSEREDCHANNEL_ON + col.a *= col.r; + #endif + col.a = saturate(col.a); + float alphaFade = saturate(smoothstep(0.0 , _AlphaFadeSmooth, RemapFloat(1.0 - _AlphaFadeAmount, 0.0, 1.0, -1.0, 1.0) + alphaFadeLuminance)); + col.a *= alphaFade; + #if ALPHAFADETRANSPARENCYTOO_ON + col.a *= 1 - _AlphaFadeAmount; + #endif + #endif + + #if BACKFACETINT_ON + col.rgb = lerp(col.rgb * _BackFaceTint, col.rgb * _FrontFaceTint, step(0, dot(d.worldSpaceNormal, d.worldSpaceViewDir))); + #endif + + //#if LIGHTANDSHADOW_ON + //half NdL = saturate(dot(d.worldSpaceNormal, -_All1VfxLightDir)); + //col.rgb += _LightColor * _LightAmount * NdL; + //NdL = max(_ShadowAmount, NdL); + //NdL = smoothstep(_ShadowStepMin, _ShadowStepMax, NdL); + //col.rgb *= NdL; + //#endif + + #if COLORGRADING_ON + col.rgb *= lerp(lerp(_ColorGradingDark, _ColorGradingMiddle, luminance/_ColorGradingMidPoint), + lerp(_ColorGradingMiddle, _ColorGradingLight, (luminance - _ColorGradingMidPoint)/(1.0 - _ColorGradingMidPoint)), step(_ColorGradingMidPoint, luminance)); + #endif + + #if COLORRAMP_ON + half colorRampLuminance = saturate(luminance + _ColorRampLuminosity); + #if COLORRAMPGRAD_ON + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTexGradient, sampler_ColorRampTexGradient, half2(colorRampLuminance, 0)); + #else + half4 colorRampRes = SAMPLE_TEXTURE2D(_ColorRampTex, sampler_ColorRampTex, half2(colorRampLuminance, 0)); + #endif + col.rgb = lerp(col.rgb, colorRampRes.rgb, _ColorRampBlend); + col.a = lerp(col.a, saturate(col.a * colorRampRes.a), _ColorRampBlend); + #endif + + #if POSTERIZE_ON && !POSTERIZEOUTLINE_ON + col.rgb = floor(col.rgb / (1.0 / _PosterizeNumColors)) * (1.0 / _PosterizeNumColors); + #endif + + #if DEPTHGLOW_ON + half sceneDepthDiff = GetLinearEyeDepth(d.screenUV) - d.screenPos.w; + #endif + + #if RIM_ON + half NdV = 1 - abs(dot(d.worldSpaceNormal, d.worldSpaceViewDir)); + half rimFactor = saturate(_RimBias + _RimScale * pow(NdV, _RimPower)); + half4 rimCol = _RimColor * rimFactor; + rimCol.rgb *= _RimIntensity; + col.rgb = lerp(col.rgb * (rimCol.rgb + half3(1,1,1)), col.rgb + rimCol.rgb, _RimAddAmount); + col.a = saturate(col.a * (1 - rimFactor * _RimErodesAlpha)); + #endif + + #if DEPTHGLOW_ON + half depthGlowMask = saturate(_DepthGlowDist * pow((1 - sceneDepthDiff), _DepthGlowPow)); + col.rgb = lerp(col.rgb, _DepthGlowGlobal * col.rgb, depthGlowMask); + half depthGlowMult = 1; + #if ADDITIVECONFIG_ON + depthGlowMult = luminance; + #endif + col.rgb += _DepthGlowColor.rgb * _DepthGlow * depthGlowMask * col.a * depthGlowMult; + #endif + + #if GLOW_ON + half glowMask = 1; + #if GLOWTEX_ON + glowMask = SAMPLE_TEXTURE2D(_GlowTex, sampler_GlowTex, TRANSFORM_TEX(d.texcoord0.xy, _GlowTex)); + #endif + col.rgb *= _GlowGlobal * glowMask; + half glowMult = 1; + #if ADDITIVECONFIG_ON + glowMult = luminance; + #endif + + col.rgb += _GlowColor.rgb * _Glow * glowMask * col.a * glowMult; + #endif + + #if HSV_ON + half3 resultHsv = half3(col.rgb); + half cosHsv = _HsvBright * _HsvSaturation * cos(_HsvShift * 3.14159265 / 180); + half sinHsv = _HsvBright * _HsvSaturation * sin(_HsvShift * 3.14159265 / 180); + resultHsv.x = (.299 * _HsvBright + .701 * cosHsv + .168 * sinHsv) * col.x + + (.587 * _HsvBright - .587 * cosHsv + .330 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv - .497 * sinHsv) * col.z; + resultHsv.y = (.299 * _HsvBright - .299 * cosHsv - .328 * sinHsv) *col.x + + (.587 * _HsvBright + .413 * cosHsv + .035 * sinHsv) * col.y + + (.114 * _HsvBright - .114 * cosHsv + .292 * sinHsv) * col.z; + resultHsv.z = (.299 * _HsvBright - .3 * cosHsv + 1.25 * sinHsv) * col.x + + (.587 * _HsvBright - .588 * cosHsv - 1.05 * sinHsv) * col.y + + (.114 * _HsvBright + .886 * cosHsv - .203 * sinHsv) * col.z; + col.rgb = resultHsv; + #endif + + #if CAMDISTFADE_ON + col.a *= 1 - saturate(smoothstep(_CamDistFadeStepMin, _CamDistFadeStepMax, camDistance)); + col.a *= smoothstep(0.0, _CamDistProximityFade, camDistance); + #endif + + #if MASK_ON + half2 maskUv = d.texcoord0.xy; + #if POLARUV_ON + maskUv = prePolarUvs; + #endif + half4 maskSample = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, TRANSFORM_TEX(maskUv, _MaskTex)); + half mask = pow(min(maskSample.r, maskSample.a), _MaskPow); + col.a *= mask; + #endif + + #if ALPHASMOOTHSTEP_ON + col.a = smoothstep(_AlphaStepMin, _AlphaStepMax, col.a); + #endif + + half4 debugColor = col; + #if SHAPEDEBUG_ON + debugColor = GetDebugColor(col, shape1, shape2, shape3); + #endif + + clip(debugColor.a - _AlphaCutoffValue - 0.01); + + //#if FOG_ON + //UNITY_APPLY_FOG(i.fogCoord, col); + //#endif + + //Don't use a starting i.color.a lower than 1 unless using vertex stream dissolve when using a FADE effect + #if !FADE_ON && !ALPHAFADE_ON + col.a *= _Alpha * d.vertexColor.a; + #endif + #if FADE_ON || ALPHAFADE_ON + col.a *= _Alpha; + #endif + #if ADDITIVECONFIG_ON + col.rgb *= col.a; + #endif + + + #if SHAPEDEBUG_ON + o.Albedo = debugColor.rgb; + o.Alpha = debugColor.a; + #else + o.Albedo = col.rgb; + o.Alpha = col.a; + #endif + } + + + + + + void ChainSurfaceFunction(inout Surface l, inout ShaderData d) + { + Ext_SurfaceFunction0(l, d); + // Ext_SurfaceFunction1(l, d); + // Ext_SurfaceFunction2(l, d); + // Ext_SurfaceFunction3(l, d); + // Ext_SurfaceFunction4(l, d); + // Ext_SurfaceFunction5(l, d); + // Ext_SurfaceFunction6(l, d); + // Ext_SurfaceFunction7(l, d); + // Ext_SurfaceFunction8(l, d); + // Ext_SurfaceFunction9(l, d); + // Ext_SurfaceFunction10(l, d); + // Ext_SurfaceFunction11(l, d); + // Ext_SurfaceFunction12(l, d); + // Ext_SurfaceFunction13(l, d); + // Ext_SurfaceFunction14(l, d); + // Ext_SurfaceFunction15(l, d); + // Ext_SurfaceFunction16(l, d); + // Ext_SurfaceFunction17(l, d); + // Ext_SurfaceFunction18(l, d); + // Ext_SurfaceFunction19(l, d); + // Ext_SurfaceFunction20(l, d); + // Ext_SurfaceFunction21(l, d); + // Ext_SurfaceFunction22(l, d); + // Ext_SurfaceFunction23(l, d); + // Ext_SurfaceFunction24(l, d); + // Ext_SurfaceFunction25(l, d); + // Ext_SurfaceFunction26(l, d); + // Ext_SurfaceFunction27(l, d); + // Ext_SurfaceFunction28(l, d); + // Ext_SurfaceFunction29(l, d); + } + +#if !_DECALSHADER + + void ChainModifyVertex(inout VertexData v, inout VertexToPixel v2p, float4 time) + { + ExtraV2F d; + + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + // due to motion vectors in HDRP, we need to use the last + // time in certain spots. So if you are going to use _Time to adjust vertices, + // you need to use this time or motion vectors will break. + d.time = time; + + Ext_ModifyVertex0(v, d); + // Ext_ModifyVertex1(v, d); + // Ext_ModifyVertex2(v, d); + // Ext_ModifyVertex3(v, d); + // Ext_ModifyVertex4(v, d); + // Ext_ModifyVertex5(v, d); + // Ext_ModifyVertex6(v, d); + // Ext_ModifyVertex7(v, d); + // Ext_ModifyVertex8(v, d); + // Ext_ModifyVertex9(v, d); + // Ext_ModifyVertex10(v, d); + // Ext_ModifyVertex11(v, d); + // Ext_ModifyVertex12(v, d); + // Ext_ModifyVertex13(v, d); + // Ext_ModifyVertex14(v, d); + // Ext_ModifyVertex15(v, d); + // Ext_ModifyVertex16(v, d); + // Ext_ModifyVertex17(v, d); + // Ext_ModifyVertex18(v, d); + // Ext_ModifyVertex19(v, d); + // Ext_ModifyVertex20(v, d); + // Ext_ModifyVertex21(v, d); + // Ext_ModifyVertex22(v, d); + // Ext_ModifyVertex23(v, d); + // Ext_ModifyVertex24(v, d); + // Ext_ModifyVertex25(v, d); + // Ext_ModifyVertex26(v, d); + // Ext_ModifyVertex27(v, d); + // Ext_ModifyVertex28(v, d); + // Ext_ModifyVertex29(v, d); + + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainModifyTessellatedVertex(inout VertexData v, inout VertexToPixel v2p) + { + ExtraV2F d; + ZERO_INITIALIZE(ExtraV2F, d); + ZERO_INITIALIZE(Blackboard, d.blackboard); + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = v2p.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = v2p.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = v2p.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = v2p.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = v2p.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = v2p.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = v2p.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = v2p.extraV2F7; + // #endif + + + // Ext_ModifyTessellatedVertex0(v, d); + // Ext_ModifyTessellatedVertex1(v, d); + // Ext_ModifyTessellatedVertex2(v, d); + // Ext_ModifyTessellatedVertex3(v, d); + // Ext_ModifyTessellatedVertex4(v, d); + // Ext_ModifyTessellatedVertex5(v, d); + // Ext_ModifyTessellatedVertex6(v, d); + // Ext_ModifyTessellatedVertex7(v, d); + // Ext_ModifyTessellatedVertex8(v, d); + // Ext_ModifyTessellatedVertex9(v, d); + // Ext_ModifyTessellatedVertex10(v, d); + // Ext_ModifyTessellatedVertex11(v, d); + // Ext_ModifyTessellatedVertex12(v, d); + // Ext_ModifyTessellatedVertex13(v, d); + // Ext_ModifyTessellatedVertex14(v, d); + // Ext_ModifyTessellatedVertex15(v, d); + // Ext_ModifyTessellatedVertex16(v, d); + // Ext_ModifyTessellatedVertex17(v, d); + // Ext_ModifyTessellatedVertex18(v, d); + // Ext_ModifyTessellatedVertex19(v, d); + // Ext_ModifyTessellatedVertex20(v, d); + // Ext_ModifyTessellatedVertex21(v, d); + // Ext_ModifyTessellatedVertex22(v, d); + // Ext_ModifyTessellatedVertex23(v, d); + // Ext_ModifyTessellatedVertex24(v, d); + // Ext_ModifyTessellatedVertex25(v, d); + // Ext_ModifyTessellatedVertex26(v, d); + // Ext_ModifyTessellatedVertex27(v, d); + // Ext_ModifyTessellatedVertex28(v, d); + // Ext_ModifyTessellatedVertex29(v, d); + + // #if %EXTRAV2F0REQUIREKEY% + v2p.extraV2F0 = d.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + v2p.extraV2F1 = d.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + v2p.extraV2F2 = d.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + v2p.extraV2F3 = d.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // v2p.extraV2F4 = d.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // v2p.extraV2F5 = d.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // v2p.extraV2F6 = d.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // v2p.extraV2F7 = d.extraV2F7; + // #endif + } + + void ChainFinalColorForward(inout Surface l, inout ShaderData d, inout half4 color) + { + // Ext_FinalColorForward0(l, d, color); + // Ext_FinalColorForward1(l, d, color); + // Ext_FinalColorForward2(l, d, color); + // Ext_FinalColorForward3(l, d, color); + // Ext_FinalColorForward4(l, d, color); + // Ext_FinalColorForward5(l, d, color); + // Ext_FinalColorForward6(l, d, color); + // Ext_FinalColorForward7(l, d, color); + // Ext_FinalColorForward8(l, d, color); + // Ext_FinalColorForward9(l, d, color); + // Ext_FinalColorForward10(l, d, color); + // Ext_FinalColorForward11(l, d, color); + // Ext_FinalColorForward12(l, d, color); + // Ext_FinalColorForward13(l, d, color); + // Ext_FinalColorForward14(l, d, color); + // Ext_FinalColorForward15(l, d, color); + // Ext_FinalColorForward16(l, d, color); + // Ext_FinalColorForward17(l, d, color); + // Ext_FinalColorForward18(l, d, color); + // Ext_FinalColorForward19(l, d, color); + // Ext_FinalColorForward20(l, d, color); + // Ext_FinalColorForward21(l, d, color); + // Ext_FinalColorForward22(l, d, color); + // Ext_FinalColorForward23(l, d, color); + // Ext_FinalColorForward24(l, d, color); + // Ext_FinalColorForward25(l, d, color); + // Ext_FinalColorForward26(l, d, color); + // Ext_FinalColorForward27(l, d, color); + // Ext_FinalColorForward28(l, d, color); + // Ext_FinalColorForward29(l, d, color); + } + + void ChainFinalGBufferStandard(inout Surface s, inout ShaderData d, inout half4 GBuffer0, inout half4 GBuffer1, inout half4 GBuffer2, inout half4 outEmission, inout half4 outShadowMask) + { + // Ext_FinalGBufferStandard0(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard1(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard2(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard3(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard4(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard5(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard6(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard7(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard8(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard9(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard10(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard11(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard12(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard13(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard14(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard15(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard16(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard17(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard18(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard19(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard20(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard21(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard22(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard23(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard24(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard25(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard26(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard27(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard28(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + // Ext_FinalGBufferStandard29(s, d, GBuffer0, GBuffer1, GBuffer2, outEmission, outShadowMask); + } +#endif + + + + + +#if _DECALSHADER + + ShaderData CreateShaderData(SurfaceDescriptionInputs IN) + { + ShaderData d = (ShaderData)0; + d.TBNMatrix = float3x3(IN.WorldSpaceTangent, IN.WorldSpaceBiTangent, IN.WorldSpaceNormal); + d.worldSpaceNormal = IN.WorldSpaceNormal; + d.worldSpaceTangent = IN.WorldSpaceTangent; + + d.worldSpacePosition = IN.WorldSpacePosition; + d.texcoord0 = IN.uv0.xyxy; + d.screenPos = IN.ScreenPosition; + + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - d.worldSpacePosition); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(d.worldSpacePosition), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(d.worldSpacePosition, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), d.worldSpaceTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenUV = (IN.ScreenPosition.xy / max(0.01, IN.ScreenPosition.w)); + // #endif + + return d; + } +#else + + ShaderData CreateShaderData(VertexToPixel i + #if NEED_FACING + , bool facing + #endif + ) + { + ShaderData d = (ShaderData)0; + d.clipPos = i.pos; + d.worldSpacePosition = i.worldPos; + + d.worldSpaceNormal = normalize(i.worldNormal); + d.worldSpaceTangent.xyz = normalize(i.worldTangent.xyz); + + d.tangentSign = i.worldTangent.w * unity_WorldTransformParams.w; + float3 bitangent = cross(d.worldSpaceTangent.xyz, d.worldSpaceNormal) * d.tangentSign; + + d.TBNMatrix = float3x3(d.worldSpaceTangent, -bitangent, d.worldSpaceNormal); + d.worldSpaceViewDir = normalize(_WorldSpaceCameraPos - i.worldPos); + + d.tangentSpaceViewDir = mul(d.TBNMatrix, d.worldSpaceViewDir); + d.texcoord0 = i.texcoord0; + // d.texcoord1 = i.texcoord1; + // d.texcoord2 = i.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // d.texcoord3 = i.texcoord3; + // #endif + + // d.isFrontFace = facing; + // #if %VERTEXCOLORREQUIREKEY% + d.vertexColor = i.vertexColor; + // #endif + + // these rarely get used, so we back transform them. Usually will be stripped. + #if _HDRP + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(GetCameraRelativePositionWS(i.worldPos), 1)).xyz; + #else + // d.localSpacePosition = mul(GetWorldToObjectMatrix(), float4(i.worldPos, 1)).xyz; + #endif + // d.localSpaceNormal = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldNormal)); + // d.localSpaceTangent = normalize(mul((float3x3)GetWorldToObjectMatrix(), i.worldTangent.xyz)); + + // #if %SCREENPOSREQUIREKEY% + d.screenPos = i.screenPos; + d.screenUV = (i.screenPos.xy / i.screenPos.w); + // #endif + + + // #if %EXTRAV2F0REQUIREKEY% + d.extraV2F0 = i.extraV2F0; + // #endif + + // #if %EXTRAV2F1REQUIREKEY% + d.extraV2F1 = i.extraV2F1; + // #endif + + // #if %EXTRAV2F2REQUIREKEY% + d.extraV2F2 = i.extraV2F2; + // #endif + + // #if %EXTRAV2F3REQUIREKEY% + d.extraV2F3 = i.extraV2F3; + // #endif + + // #if %EXTRAV2F4REQUIREKEY% + // d.extraV2F4 = i.extraV2F4; + // #endif + + // #if %EXTRAV2F5REQUIREKEY% + // d.extraV2F5 = i.extraV2F5; + // #endif + + // #if %EXTRAV2F6REQUIREKEY% + // d.extraV2F6 = i.extraV2F6; + // #endif + + // #if %EXTRAV2F7REQUIREKEY% + // d.extraV2F7 = i.extraV2F7; + // #endif + + return d; + } + +#endif + + + #if defined(_PASSSHADOW) + float3 _LightDirection; + float3 _LightPosition; + #endif + + #if (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + + #define GetWorldToViewMatrix() _ViewMatrix + #define UNITY_MATRIX_I_V _InvViewMatrix + #define GetViewToHClipMatrix() OptimizeProjectionMatrix(_ProjMatrix) + #define UNITY_MATRIX_I_P _InvProjMatrix + #define GetWorldToHClipMatrix() _ViewProjMatrix + #define UNITY_MATRIX_I_VP _InvViewProjMatrix + #define UNITY_MATRIX_UNJITTERED_VP _NonJitteredViewProjMatrix + #define UNITY_MATRIX_PREV_VP _PrevViewProjMatrix + #define UNITY_MATRIX_PREV_I_VP _PrevInvViewProjMatrix + + void MotionVectorPositionZBias(VertexToPixel input) + { + #if UNITY_REVERSED_Z + input.pos.z -= unity_MotionVectorsParams.z * input.pos.w; + #else + input.pos.z += unity_MotionVectorsParams.z * input.pos.w; + #endif + } + + #endif + + // vertex shader + VertexToPixel Vert (VertexData v) + { + VertexToPixel o = (VertexToPixel)0; + + UNITY_SETUP_INSTANCE_ID(v); + UNITY_TRANSFER_INSTANCE_ID(v, o); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + VertexData previousMesh = v; + #endif + #if !_TESSELLATION_ON + ChainModifyVertex(v, o, _Time); + #endif + + o.texcoord0 = v.texcoord0; + // o.texcoord1 = v.texcoord1; + // o.texcoord2 = v.texcoord2; + + // #if %TEXCOORD3REQUIREKEY% + // o.texcoord3 = v.texcoord3; + // #endif + + // #if %VERTEXCOLORREQUIREKEY% + o.vertexColor = v.vertexColor; + // #endif + + // This return the camera relative position (if enable) + float3 positionWS = TransformObjectToWorld(v.vertex.xyz); + float3 normalWS = TransformObjectToWorldNormal(v.normal); + float4 tangentWS = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w); + + VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz); + o.worldPos = positionWS; + o.worldNormal = normalWS; + o.worldTangent = tangentWS; + + + // For some very odd reason, in 2021.2, we can't use Unity's defines, but have to use our own.. + #if _PASSSHADOW + #if _CASTING_PUNCTUAL_LIGHT_SHADOW + float3 lightDirectionWS = normalize(_LightPosition - o.worldPos); + #else + float3 lightDirectionWS = _LightDirection; + #endif + // Define shadow pass specific clip position for Universal + o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS)); + #if UNITY_REVERSED_Z + o.pos.z = min(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #else + o.pos.z = max(o.pos.z, UNITY_NEAR_CLIP_VALUE); + #endif + #elif _PASSMETA + o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST); + #else + o.pos = TransformWorldToHClip(o.worldPos); + #endif + + // #if %SCREENPOSREQUIREKEY% + o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x); + // #endif + + + #if _PASSFORWARD || _PASSGBUFFER + float2 uv1 = v.texcoord1.xy; + OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV); + // o.texcoord1.xy = uv1; + #if UNITY_VERSION < 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + + #if defined(DYNAMICLIGHTMAP_ON) + o.dynamicLightmapUV.xy = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; + #if UNITY_VERSION >= 60000009 + OUTPUT_SH(o.worldNormal, o.sh); + #endif + #elif (defined(PROBE_VOLUMES_L1) || defined(PROBE_VOLUMES_L2)) && UNITY_VERSION >= 60000009 + OUTPUT_SH4(vertexInput.positionWS, o.worldNormal.xyz, GetWorldSpaceNormalizeViewDir(vertexInput.positionWS), o.sh, o.probeOcclusion); + #endif + #endif + + #ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT + half fogFactor = 0; + #if defined(_FOG_FRAGMENT) + fogFactor = ComputeFogFactor(o.pos.z); + #endif + #if _BAKEDLIT + o.fogFactorAndVertexLight = half4(fogFactor, 0, 0, 0); + #else + half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal); + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); + #endif + #endif + + #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) + o.shadowCoord = GetShadowCoord(vertexInput); + #endif + + #if _URP && (_PASSMOTIONVECTOR || ((_PASSFORWARD || _PASSUNLIT) && defined(_WRITE_TRANSPARENT_MOTION_VECTOR))) + #if !defined(TESSELLATION_ON) + MotionVectorPositionZBias(o); + #endif + + o.previousPositionCS = float4(0.0, 0.0, 0.0, 1.0); + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + + if (!forceNoMotion) + { + #if defined(HAVE_VFX_MODIFICATION) + float3 previousPositionOS = currentFrameMvData.vfxParticlePositionOS; + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + const bool applyDeformation = false; + #else + const bool applyDeformation = true; + #endif + #else + const bool hasDeformation = unity_MotionVectorsParams.x == 1; // Mesh has skinned deformation + float3 previousPositionOS = hasDeformation ? previousMesh.previousPositionOS : previousMesh.vertex.xyz; + + #if defined(AUTOMATIC_TIME_BASED_MOTION_VECTORS) && defined(GRAPH_VERTEX_USES_TIME_PARAMETERS_INPUT) + const bool applyDeformation = true; + #else + const bool applyDeformation = hasDeformation; + #endif + #endif + // TODO + #if defined(FEATURES_GRAPH_VERTEX) + if (applyDeformation) + previousPositionOS = GetLastFrameDeformedPosition(previousMesh, currentFrameMvData, previousPositionOS); + else + previousPositionOS = previousMesh.positionOS; + + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + #endif + + #if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(previousMesh.vertexID, previousPositionOS); + #endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) + previousPositionOS -= previousMesh.precomputedVelocity; + #endif + o.positionCS = mul(UNITY_MATRIX_UNJITTERED_VP, float4(positionWS, 1.0f)); + + #if defined(HAVE_VFX_MODIFICATION) + #if defined(VFX_FEATURE_MOTION_VECTORS_VERTS) + #if defined(FEATURES_GRAPH_VERTEX_MOTION_VECTOR_OUTPUT) || defined(_ADD_PRECOMPUTED_VELOCITY) + #error Unexpected fast path rendering VFX motion vector while there are vertex modification afterwards. + #endif + o.previousPositionCS = VFXGetPreviousClipPosition(previousMesh, currentFrameMvData.vfxElementAttributes, o.positionCS); + #else + #if VFX_WORLD_SPACE + //previousPositionOS is already in world space + const float3 previousPositionWS = previousPositionOS; + #else + const float3 previousPositionWS = mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1.0f)).xyz; + #endif + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, float4(previousPositionWS, 1.0f)); + #endif + #else + o.previousPositionCS = mul(UNITY_MATRIX_PREV_VP, mul(UNITY_PREV_MATRIX_M, float4(previousPositionOS, 1))); + #endif + } + #endif + + return o; + } + + + + + // Using parts of com.unity.render-pipelines.universal\Editor\ShaderGraph\Includes\MotionVectorPass.hlsl + // com.unity.render-pipelines.universal\ShaderLibrary\MotionVectorsCommon.hlsl + // com.unity.render-pipelines.universal\Editor\ShaderGraph\Includes\Varyings.hlsl + + float2 CalcNdcMotionVectorFromCsPositions(float4 posCS, float4 prevPosCS) + { + // Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled + bool forceNoMotion = unity_MotionVectorsParams.y == 0.0; + if (forceNoMotion) + return float2(0.0, 0.0); + + // Non-uniform raster needs to keep the posNDC values in float to avoid additional conversions + // since uv remap functions use floats + float2 posNDC = posCS.xy * rcp(posCS.w); + float2 prevPosNDC = prevPosCS.xy * rcp(prevPosCS.w); + + float2 velocity; + #if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER) + UNITY_BRANCH if (_FOVEATED_RENDERING_NON_UNIFORM_RASTER) + { + // Convert velocity from NDC space (-1..1) to screen UV 0..1 space since FoveatedRendering remap needs that range. + float2 posUV = RemapFoveatedRenderingResolve(posNDC * 0.5 + 0.5); + float2 prevPosUV = RemapFoveatedRenderingPrevFrameLinearToNonUniform(prevPosNDC * 0.5 + 0.5); + + // Calculate forward velocity + velocity = (posUV - prevPosUV); + #if UNITY_UV_STARTS_AT_TOP + velocity.y = -velocity.y; + #endif + } + else + #endif + { + // Calculate forward velocity + velocity = (posNDC.xy - prevPosNDC.xy); + #if UNITY_UV_STARTS_AT_TOP + velocity.y = -velocity.y; + #endif + + // Convert velocity from NDC space (-1..1) to UV 0..1 space + // Note: It doesn't mean we don't have negative values, we store negative or positive offset in UV space. + // Note: ((posNDC * 0.5 + 0.5) - (prevPosNDC * 0.5 + 0.5)) = (velocity * 0.5) + velocity.xy *= 0.5; + } + + return velocity; + } + + float4 Frag( + VertexToPixel input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + float4 motionVector = float4(CalcNdcMotionVectorFromCsPositions(input.positionCS, input.previousPositionCS), 0, 0); + + return motionVector; + } + + ENDHLSL + } + } diff --git a/Assets/Scenes/CatBorg Studio/3D Pirates Lowpoly Pack/Materials/M_Imphenzia_LowPollyStyle.mat b/Assets/Scenes/CatBorg Studio/3D Pirates Lowpoly Pack/Materials/M_Imphenzia_LowPollyStyle.mat index 82bfe0119..3868d33c2 100644 --- a/Assets/Scenes/CatBorg Studio/3D Pirates Lowpoly Pack/Materials/M_Imphenzia_LowPollyStyle.mat +++ b/Assets/Scenes/CatBorg Studio/3D Pirates Lowpoly Pack/Materials/M_Imphenzia_LowPollyStyle.mat @@ -9,8 +9,8 @@ Material: m_PrefabAsset: {fileID: 0} m_Name: M_Imphenzia_LowPollyStyle m_Shader: {fileID: -6465566751694194690, guid: 940d79357fd7a4f01a49e7247aeaa4da, type: 3} - m_Parent: {fileID: 2100000, guid: 1b3f34f5008ab3a449cd0ca7ae41a30e, type: 2} - m_ModifiedSerializedProperties: 4 + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 m_ValidKeywords: [] m_InvalidKeywords: [] m_LightmapFlags: 4 @@ -32,19 +32,99 @@ Material: m_Texture: {fileID: 2800000, guid: c33cf37a22f010e4cb6a2c2279ee2896, 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: c33cf37a22f010e4cb6a2c2279ee2896, 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: 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 - _Alpha: 1 + - _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: 1 + - _Glossiness: 0 - _GlossyReflections: 1 + - _Metallic: 0 + - _OcclusionStrength: 1 - _Parallax: 0.02 + - _QueueControl: 0 + - _QueueOffset: 0 + - _ReceiveShadows: 1 - _Smoothness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 m_Colors: - Vector2_6A93A1CF: {r: 1, g: 1, b: 0, a: 0} + - _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 --- !u!114 &5522020866035113095 diff --git a/Assets/Toon Water URP/Toon Water Material 1.mat b/Assets/Toon Water URP/Toon Water Material 1.mat index cb7cdbfbc..7154a9f2e 100644 --- a/Assets/Toon Water URP/Toon Water Material 1.mat +++ b/Assets/Toon Water URP/Toon Water Material 1.mat @@ -74,9 +74,9 @@ Material: - Vector1_20DB7652: 0.158 - Vector1_24CAEF48: 1 - Vector1_301E02E2: 240 - - Vector1_31894ABB: 0.0158 + - Vector1_31894ABB: 0.005 - Vector1_3632ABA2: 0 - - Vector1_45F25267: 1.14 + - Vector1_45F25267: 5.84 - Vector1_738B39CF: 0 - Vector1_854A7D8C: 0.51 - Vector1_9C73072A: 0.88 @@ -107,10 +107,10 @@ Material: - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - - Color_1139F668: {r: 0.22241013, g: 0.80931354, b: 0.9622642, a: 0.5254902} - - Color_198818EE: {r: 0, g: 0.37919012, b: 1.498, a: 1} + - Color_1139F668: {r: 0.22241013, g: 0.9843137, b: 1, a: 0.6862745} + - Color_198818EE: {r: 0, g: 0.25882354, b: 1, a: 0.6745098} - Color_626750DD: {r: 2, g: 2, b: 2, a: 1} - - Color_77A2EDE9: {r: 31.626795, g: 31.626795, b: 31.626795, a: 1} + - Color_77A2EDE9: {r: 31.626795, g: 31.626795, b: 31.626795, a: 0.21960784} - Vector2_1E1B6943: {r: 1, g: 5, b: 0, a: 0} - Vector2_D06E76BC: {r: 0.1, g: 0.05, b: 0, a: 0} - Vector2_D26C9C89: {r: 1, g: 0, b: 0, a: 0}