Rasagar/Library/PackageCache/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader

268 lines
10 KiB
Plaintext
Raw Normal View History

2024-08-26 13:07:20 -07:00
Shader "Universal Render Pipeline/Nature/SpeedTree8"
{
Properties
{
_MainTex ("Base (RGB) Transparency (A)", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
[Toggle(EFFECT_HUE_VARIATION)] _HueVariationKwToggle("Hue Variation", Float) = 0
_HueVariationColor ("Hue Variation Color", Color) = (1.0,0.5,0.0,0.1)
[Toggle(EFFECT_BUMP)] _NormalMapKwToggle("Normal Mapping", Float) = 0
_BumpMap("Normal Map", 2D) = "bump" {}
_ExtraTex ("Smoothness (R), Metallic (G), AO (B)", 2D) = "(0.5, 0.0, 1.0)" {}
_Glossiness ("Smoothness", Range(0.0, 1.0)) = 0.5
_Metallic ("Metallic", Range(0.0, 1.0)) = 0.0
[Toggle(EFFECT_SUBSURFACE)] _SubsurfaceKwToggle("Subsurface", Float) = 0
_SubsurfaceTex ("Subsurface (RGB)", 2D) = "white" {}
_SubsurfaceColor ("Subsurface Color", Color) = (1,1,1,1)
_SubsurfaceIndirect ("Subsurface Indirect", Range(0.0, 1.0)) = 0.25
[Toggle(EFFECT_BILLBOARD)] _BillboardKwToggle("Billboard", Float) = 0
_BillboardShadowFade ("Billboard Shadow Fade", Range(0.0, 1.0)) = 0.5
[Enum(No,2,Yes,0)] _TwoSided ("Two Sided", Int) = 2 // enum matches cull mode
[KeywordEnum(None,Fastest,Fast,Better,Best,Palm)] _WindQuality ("Wind Quality", Range(0,5)) = 0
}
SubShader
{
Tags
{
"Queue"="AlphaTest"
"IgnoreProjector"="True"
"RenderType"="TransparentCutout"
"DisableBatching"="LODFading"
"RenderPipeline" = "UniversalPipeline"
"UniversalMaterialType" = "Lit"
}
LOD 400
Cull [_TwoSided]
Pass
{
Name "ForwardLit"
Tags { "LightMode" = "UniversalForward" }
AlphaToMask On
HLSLPROGRAM
#pragma vertex SpeedTree8Vert
#pragma fragment SpeedTree8Frag
#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 _ _LIGHT_LAYERS
#pragma multi_compile _ _FORWARD_PLUS
#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
#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 _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
#pragma multi_compile _ LOD_FADE_CROSSFADE
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
#pragma multi_compile_fragment _ _LIGHT_COOKIES
#pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
#pragma multi_compile_fog
#pragma multi_compile_fragment _ DEBUG_DISPLAY
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer assumeuniformscaling maxcount:50
#pragma shader_feature_local_vertex _WINDQUALITY_NONE _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
#pragma shader_feature_local EFFECT_BILLBOARD
#pragma shader_feature_local_fragment EFFECT_HUE_VARIATION
#pragma shader_feature_local_fragment EFFECT_SUBSURFACE
#pragma shader_feature_local_fragment EFFECT_BUMP
#pragma shader_feature_local_fragment EFFECT_EXTRA_TEX
#define ENABLE_WIND
#define EFFECT_BACKSIDE_NORMALS
#include "SpeedTree8Input.hlsl"
#include "SpeedTree8Passes.hlsl"
ENDHLSL
}
Pass
{
Name "SceneSelectionPass"
Tags{"LightMode" = "SceneSelectionPass"}
HLSLPROGRAM
#pragma vertex SpeedTree8VertDepth
#pragma fragment SpeedTree8FragDepth
#pragma multi_compile _ LOD_FADE_CROSSFADE
#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
#pragma multi_compile_instancing
#pragma instancing_options assumeuniformscaling maxcount:50
#pragma shader_feature_local_vertex _WINDQUALITY_NONE _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
#pragma shader_feature_local EFFECT_BILLBOARD
#define ENABLE_WIND
#define DEPTH_ONLY
#define SCENESELECTIONPASS
#include "SpeedTree8Input.hlsl"
#include "SpeedTree8Passes.hlsl"
ENDHLSL
}
Pass
{
Name "GBuffer"
Tags{"LightMode" = "UniversalGBuffer"}
HLSLPROGRAM
#pragma target 4.5
// Deferred Rendering Path does not support the OpenGL-based graphics API:
// Desktop OpenGL, OpenGL ES 3.0, WebGL 2.0.
#pragma exclude_renderers gles3 glcore
#pragma vertex SpeedTree8Vert
#pragma fragment SpeedTree8Frag
#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 _ _ADDITIONAL_LIGHT_SHADOWS
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
#pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
#pragma multi_compile _ LOD_FADE_CROSSFADE
#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
#pragma multi_compile_fragment _ _RENDER_PASS_ENABLED
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer assumeuniformscaling maxcount:50
#pragma shader_feature_local_vertex _WINDQUALITY_NONE _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
#pragma shader_feature_local EFFECT_BILLBOARD
#pragma shader_feature_local_fragment EFFECT_HUE_VARIATION
#pragma shader_feature_local_fragment EFFECT_SUBSURFACE
#pragma shader_feature_local_fragment EFFECT_BUMP
#pragma shader_feature_local_fragment EFFECT_EXTRA_TEX
#define ENABLE_WIND
#define EFFECT_BACKSIDE_NORMALS
#define GBUFFER
#include "SpeedTree8Input.hlsl"
#include "SpeedTree8Passes.hlsl"
ENDHLSL
}
Pass
{
Name "ShadowCaster"
Tags{"LightMode" = "ShadowCaster"}
ColorMask 0
HLSLPROGRAM
#pragma vertex SpeedTree8VertDepth
#pragma fragment SpeedTree8FragDepth
#pragma multi_compile _ LOD_FADE_CROSSFADE
#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
#pragma multi_compile_instancing
#pragma instancing_options assumeuniformscaling maxcount:50
#pragma shader_feature_local_vertex _WINDQUALITY_NONE _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALMlity and backface normal mode enum keywords)
#pragma shader_feature_local EFFECT_BILLBOARD
#define ENABLE_WIND
#define DEPTH_ONLY
#define SHADOW_CASTER
// -------------------------------------
// Universal Pipeline keywords
// This is used during shadow map generation to differentiate between directional and punctual light shadows, as they use different formulas to apply Normal Bias
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
#include "SpeedTree8Input.hlsl"
#include "SpeedTree8Passes.hlsl"
ENDHLSL
}
Pass
{
Name "DepthOnly"
Tags{"LightMode" = "DepthOnly"}
ZWrite On
ColorMask R
HLSLPROGRAM
#pragma vertex SpeedTree8VertDepth
#pragma fragment SpeedTree8FragDepth
#pragma multi_compile _ LOD_FADE_CROSSFADE
#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
#pragma multi_compile_instancing
#pragma instancing_options assumeuniformscaling maxcount:50
#pragma shader_feature_local_vertex _WINDQUALITY_NONE _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
#pragma shader_feature_local EFFECT_BILLBOARD
#define ENABLE_WIND
#define DEPTH_ONLY
#include "SpeedTree8Input.hlsl"
#include "SpeedTree8Passes.hlsl"
ENDHLSL
}
// This pass is used when drawing to a _CameraNormalsTexture texture
Pass
{
Name "DepthNormals"
Tags{"LightMode" = "DepthNormals"}
ZWrite On
HLSLPROGRAM
#pragma vertex SpeedTree8VertDepthNormal
#pragma fragment SpeedTree8FragDepthNormal
#pragma shader_feature_local_vertex _WINDQUALITY_NONE _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
#pragma shader_feature_local_fragment EFFECT_BUMP
#pragma multi_compile _ LOD_FADE_CROSSFADE
#pragma multi_compile_instancing
#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
#pragma instancing_options assumeuniformscaling maxcount:50
#define ENABLE_WIND
#define EFFECT_BACKSIDE_NORMALS
#include "SpeedTree8Input.hlsl"
#include "SpeedTree8Passes.hlsl"
ENDHLSL
}
}
FallBack "Hidden/Universal Render Pipeline/FallbackError"
CustomEditor "SpeedTree8ShaderGUI"
}