您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
143 行
4.8 KiB
143 行
4.8 KiB
Shader "Hidden/LightweightPipeline/Terrain/Standard Terrain Base"
|
|
{
|
|
Properties
|
|
{
|
|
_Color("Color", Color) = (1,1,1,1)
|
|
_MainTex("Albedo(RGB), Smoothness(A)", 2D) = "white" {}
|
|
_MetallicTex ("Metallic (R)", 2D) = "black" {}
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags { "Queue" = "Geometry-100" "RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline" "IgnoreProjector" = "True"}
|
|
LOD 200
|
|
|
|
// ------------------------------------------------------------------
|
|
// Forward pass. Shades all light in a single pass. GI + emission + Fog
|
|
Pass
|
|
{
|
|
// Lightmode matches the ShaderPassName set in LightweightPipeline.cs. SRPDefaultUnlit and passes with
|
|
// no LightMode tag are also rendered by Lightweight Pipeline
|
|
Tags{"LightMode" = "LightweightForward"}
|
|
|
|
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
|
|
#define _METALLICSPECGLOSSMAP 1
|
|
#define _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 1
|
|
|
|
// -------------------------------------
|
|
// Lightweight Pipeline keywords
|
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS
|
|
#pragma multi_compile _ _VERTEX_LIGHTS
|
|
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
|
|
#pragma multi_compile _ _SHADOWS_ENABLED
|
|
|
|
// TODO: Enabled this when we have C# keyword stripping
|
|
//#pragma multi_compile _ _LOCAL_SHADOWS_ENABLED
|
|
|
|
// -------------------------------------
|
|
// Unity defined keywords
|
|
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
|
#pragma multi_compile _ LIGHTMAP_ON
|
|
#pragma multi_compile_fog
|
|
|
|
//--------------------------------------
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
|
|
#pragma vertex LitPassVertex
|
|
#pragma fragment LitPassFragment
|
|
|
|
#include "LWRP/ShaderLibrary/Terrain/InputSurfaceTerrainBase.hlsl"
|
|
#include "LWRP/ShaderLibrary/LightweightPassLit.hlsl"
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Tags{"LightMode" = "ShadowCaster"}
|
|
|
|
ZWrite On
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard srp library
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
#pragma target 2.0
|
|
|
|
//--------------------------------------
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
#define _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 1
|
|
|
|
#pragma vertex ShadowPassVertex
|
|
#pragma fragment ShadowPassFragment
|
|
|
|
#include "LWRP/ShaderLibrary/Terrain/InputSurfaceTerrainBase.hlsl"
|
|
#include "LWRP/ShaderLibrary/LightweightPassShadow.hlsl"
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Tags{"LightMode" = "DepthOnly"}
|
|
|
|
ZWrite On
|
|
ColorMask 0
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard srp library
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
#pragma target 2.0
|
|
|
|
#pragma vertex DepthOnlyVertex
|
|
#pragma fragment DepthOnlyFragment
|
|
|
|
#define _METALLICSPECGLOSSMAP 1
|
|
#define _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 1
|
|
|
|
//--------------------------------------
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
|
|
#include "LWRP/ShaderLibrary/Terrain/InputSurfaceTerrainBase.hlsl"
|
|
#include "LWRP/ShaderLibrary/LightweightPassDepthOnly.hlsl"
|
|
ENDHLSL
|
|
}
|
|
|
|
// This pass it not used during regular rendering, only for lightmap baking.
|
|
Pass
|
|
{
|
|
Tags{"LightMode" = "Meta"}
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard srp library
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
#pragma target 2.0
|
|
|
|
#pragma vertex LightweightVertexMeta
|
|
#pragma fragment LightweightFragmentMeta
|
|
|
|
#define _METALLICSPECGLOSSMAP 1
|
|
#define _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A 1
|
|
#pragma shader_feature EDITOR_VISUALIZATION
|
|
|
|
#include "LWRP/ShaderLibrary/Terrain/InputSurfaceTerrainBase.hlsl"
|
|
#include "LWRP/ShaderLibrary/LightweightPassMetaPBR.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
}
|
|
FallBack "Hidden/InternalErrorShader"
|
|
CustomEditor "LightweightStandardGUI"
|
|
}
|