244 lines
8.8 KiB
Plaintext
244 lines
8.8 KiB
Plaintext
|
// ------------------------------------------
|
||
|
// Only directional light is supported for lit particles
|
||
|
// No shadow
|
||
|
// No distortion
|
||
|
Shader "Amazing Assets/Curved World/Particles/Simple Lit"
|
||
|
{
|
||
|
Properties
|
||
|
{
|
||
|
[CurvedWorldBendSettings] _CurvedWorldBendSettings("0|1|1", Vector) = (0, 0, 0, 0)
|
||
|
|
||
|
_BaseMap("Base Map", 2D) = "white" {}
|
||
|
_BaseColor("Base Color", Color) = (1,1,1,1)
|
||
|
|
||
|
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||
|
|
||
|
_SpecGlossMap("Specular", 2D) = "white" {}
|
||
|
_SpecColor("Specular", Color) = (1.0, 1.0, 1.0)
|
||
|
_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
|
||
|
|
||
|
_BumpScale("Scale", Float) = 1.0
|
||
|
_BumpMap("Normal Map", 2D) = "bump" {}
|
||
|
|
||
|
_EmissionColor("Color", Color) = (0,0,0)
|
||
|
_EmissionMap("Emission", 2D) = "white" {}
|
||
|
|
||
|
[HideInInspector] _SmoothnessSource("Smoothness Source", Float) = 0.0
|
||
|
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
|
||
|
_ReceiveShadows("Receive Shadows", Float) = 1.0
|
||
|
|
||
|
// -------------------------------------
|
||
|
// Particle specific
|
||
|
_SoftParticlesNearFadeDistance("Soft Particles Near Fade", Float) = 0.0
|
||
|
_SoftParticlesFarFadeDistance("Soft Particles Far Fade", Float) = 1.0
|
||
|
_CameraNearFadeDistance("Camera Near Fade", Float) = 1.0
|
||
|
_CameraFarFadeDistance("Camera Far Fade", Float) = 2.0
|
||
|
_DistortionBlend("Distortion Blend", Float) = 0.5
|
||
|
_DistortionStrength("Distortion Strength", Float) = 1.0
|
||
|
|
||
|
// -------------------------------------
|
||
|
// Hidden properties - Generic
|
||
|
[HideInInspector] _Surface("__surface", Float) = 0.0
|
||
|
[HideInInspector] _Blend("__mode", Float) = 0.0
|
||
|
[HideInInspector] _AlphaClip("__clip", Float) = 0.0
|
||
|
[HideInInspector] _BlendOp("__blendop", Float) = 0.0
|
||
|
[HideInInspector] _SrcBlend("__src", Float) = 1.0
|
||
|
[HideInInspector] _DstBlend("__dst", Float) = 0.0
|
||
|
[HideInInspector] _ZWrite("__zw", Float) = 1.0
|
||
|
[HideInInspector] _Cull("__cull", Float) = 2.0
|
||
|
|
||
|
// Particle specific
|
||
|
[HideInInspector] _ColorMode("_ColorMode", Float) = 0.0
|
||
|
[HideInInspector] _BaseColorAddSubDiff("_ColorMode", Vector) = (0,0,0,0)
|
||
|
[ToggleOff] _FlipbookBlending("__flipbookblending", Float) = 0.0
|
||
|
[HideInInspector] _SoftParticlesEnabled("__softparticlesenabled", Float) = 0.0
|
||
|
[HideInInspector] _CameraFadingEnabled("__camerafadingenabled", Float) = 0.0
|
||
|
[HideInInspector] _SoftParticleFadeParams("__softparticlefadeparams", Vector) = (0,0,0,0)
|
||
|
[HideInInspector] _CameraFadeParams("__camerafadeparams", Vector) = (0,0,0,0)
|
||
|
[HideInInspector] _DistortionEnabled("__distortionenabled", Float) = 0.0
|
||
|
[HideInInspector] _DistortionStrengthScaled("Distortion Strength Scaled", Float) = 0.1
|
||
|
|
||
|
// Editmode props
|
||
|
[HideInInspector] _QueueOffset("Queue offset", Float) = 0.0
|
||
|
|
||
|
// ObsoleteProperties
|
||
|
[HideInInspector] _FlipbookMode("flipbook", Float) = 0
|
||
|
[HideInInspector] _Glossiness("gloss", Float) = 0
|
||
|
[HideInInspector] _Mode("mode", Float) = 0
|
||
|
[HideInInspector] _Color("color", Color) = (1,1,1,1)
|
||
|
}
|
||
|
|
||
|
SubShader
|
||
|
{
|
||
|
Tags{"RenderType" = "Opaque" "IgnoreProjector" = "True" "PreviewType" = "Plane" "PerformanceChecks" = "False" "RenderPipeline" = "UniversalPipeline"}
|
||
|
|
||
|
// ------------------------------------------------------------------
|
||
|
// Forward pass.
|
||
|
Pass
|
||
|
{
|
||
|
// Lightmode matches the ShaderPassName set in UniversalRenderPipeline.cs. SRPDefaultUnlit and passes with
|
||
|
// no LightMode tag are also rendered by Universal Render Pipeline
|
||
|
Name "ForwardLit"
|
||
|
Tags {"LightMode" = "UniversalForward"}
|
||
|
|
||
|
BlendOp[_BlendOp]
|
||
|
Blend[_SrcBlend][_DstBlend]
|
||
|
ZWrite[_ZWrite]
|
||
|
Cull[_Cull]
|
||
|
|
||
|
HLSLPROGRAM
|
||
|
// Required to compile gles 2.0 with standard SRP library
|
||
|
// All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default
|
||
|
#pragma prefer_hlslcc gles
|
||
|
#pragma exclude_renderers d3d11_9x
|
||
|
#pragma target 2.0
|
||
|
|
||
|
// -------------------------------------
|
||
|
// Material Keywords
|
||
|
#pragma shader_feature _NORMALMAP
|
||
|
#pragma shader_feature _EMISSION
|
||
|
#pragma shader_feature _ _SPECGLOSSMAP _SPECULAR_COLOR
|
||
|
#pragma shader_feature _GLOSSINESS_FROM_BASE_ALPHA
|
||
|
#pragma shader_feature _RECEIVE_SHADOWS_OFF
|
||
|
|
||
|
// -------------------------------------
|
||
|
// Particle Keywords
|
||
|
#pragma shader_feature _ _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON
|
||
|
#pragma shader_feature _ALPHATEST_ON
|
||
|
#pragma shader_feature _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON
|
||
|
#pragma shader_feature _FLIPBOOKBLENDING_ON
|
||
|
#pragma shader_feature _SOFTPARTICLES_ON
|
||
|
#pragma shader_feature _FADING_ON
|
||
|
#pragma shader_feature _DISTORTION_ON
|
||
|
|
||
|
// -------------------------------------
|
||
|
// Universal Pipeline keywords
|
||
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
||
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
|
||
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||
|
#pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
|
||
|
#pragma multi_compile _ _SHADOWS_SOFT
|
||
|
|
||
|
// -------------------------------------
|
||
|
// Unity defined keywords
|
||
|
#pragma multi_compile_fog
|
||
|
|
||
|
#pragma vertex ParticlesLitVertex
|
||
|
#pragma fragment ParticlesLitFragment
|
||
|
#define BUMP_SCALE_NOT_SUPPORTED 1
|
||
|
|
||
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLitInput.hlsl"
|
||
|
|
||
|
|
||
|
#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||
|
#define CURVEDWORLD_BEND_ID_1
|
||
|
#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||
|
#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||
|
#include "../../Core/CurvedWorldTransform.cginc"
|
||
|
|
||
|
|
||
|
#include "ParticlesSimpleLitForwardPass.hlsl"
|
||
|
ENDHLSL
|
||
|
}
|
||
|
Pass
|
||
|
{
|
||
|
Name "Universal2D"
|
||
|
Tags{ "LightMode" = "Universal2D" }
|
||
|
|
||
|
Blend[_SrcBlend][_DstBlend]
|
||
|
ZWrite[_ZWrite]
|
||
|
Cull[_Cull]
|
||
|
|
||
|
HLSLPROGRAM
|
||
|
// Required to compile gles 2.0 with standard srp library
|
||
|
#pragma prefer_hlslcc gles
|
||
|
#pragma exclude_renderers d3d11_9x
|
||
|
|
||
|
#pragma vertex vert
|
||
|
#pragma fragment frag
|
||
|
#pragma shader_feature _ALPHATEST_ON
|
||
|
#pragma shader_feature _ALPHAPREMULTIPLY_ON
|
||
|
|
||
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/UnlitInput.hlsl"
|
||
|
#include "Packages/com.unity.render-pipelines.universal/Shaders/Utils/Universal2D.hlsl"
|
||
|
ENDHLSL
|
||
|
}
|
||
|
|
||
|
|
||
|
//PassName "ScenePickingPass"
|
||
|
Pass
|
||
|
{
|
||
|
Name "ScenePickingPass"
|
||
|
Tags { "LightMode" = "Picking" }
|
||
|
|
||
|
BlendOp Add
|
||
|
Blend One Zero
|
||
|
ZWrite On
|
||
|
Cull Off
|
||
|
|
||
|
CGPROGRAM
|
||
|
#include "HLSLSupport.cginc"
|
||
|
#include "UnityShaderVariables.cginc"
|
||
|
#include "UnityShaderUtilities.cginc"
|
||
|
|
||
|
|
||
|
#pragma target 3.0
|
||
|
|
||
|
#pragma shader_feature _ALPHATEST_ON
|
||
|
#pragma shader_feature _ALPHAPREMULTIPLY_ON
|
||
|
#pragma multi_compile_instancing
|
||
|
|
||
|
#pragma vertex vertEditorPass
|
||
|
#pragma fragment fragScenePickingPass
|
||
|
|
||
|
|
||
|
#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||
|
#define CURVEDWORLD_BEND_ID_1
|
||
|
#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||
|
|
||
|
|
||
|
#include "../../Core/SceneSelection.cginc"
|
||
|
ENDCG
|
||
|
} //Pass "ScenePickingPass"
|
||
|
|
||
|
//PassName "SceneSelectionPass"
|
||
|
Pass
|
||
|
{
|
||
|
Name "SceneSelectionPass"
|
||
|
Tags { "LightMode" = "SceneSelectionPass" }
|
||
|
|
||
|
BlendOp Add
|
||
|
Blend One Zero
|
||
|
ZWrite On
|
||
|
Cull Off
|
||
|
|
||
|
CGPROGRAM
|
||
|
#include "HLSLSupport.cginc"
|
||
|
#include "UnityShaderVariables.cginc"
|
||
|
#include "UnityShaderUtilities.cginc"
|
||
|
|
||
|
|
||
|
#pragma target 3.0
|
||
|
|
||
|
#pragma shader_feature _ALPHATEST_ON
|
||
|
#pragma shader_feature _ALPHAPREMULTIPLY_ON
|
||
|
#pragma multi_compile_instancing
|
||
|
|
||
|
#pragma vertex vertEditorPass
|
||
|
#pragma fragment fragSceneHighlightPass
|
||
|
|
||
|
|
||
|
#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||
|
#define CURVEDWORLD_BEND_ID_1
|
||
|
#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||
|
|
||
|
|
||
|
#include "../../Core/SceneSelection.cginc"
|
||
|
ENDCG
|
||
|
} //Pass "SceneSelectionPass"
|
||
|
}
|
||
|
|
||
|
Fallback "Universal Render Pipeline/Particles/Unlit"
|
||
|
CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.CurvedWorld_ParticlesSimpleLitShader"
|
||
|
}
|