您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
150 行
5.1 KiB
150 行
5.1 KiB
Shader "LightweightPipeline/PBR/Packed Dialectric"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex("Albedo", 2D) = "white" {} // RGB albedo, A roughness
|
|
|
|
_BumpMap("Normal Map", 2D) = "bump" {} // RGB normal, A AO
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
// Lightweight Pipeline tag is required. If Lightweight pipeline is not set in the graphics settings
|
|
// this Subshader will fail. One can add a subshader below or fallback to Standard built-in to make this
|
|
// material work with both Lightweight Pipeline and Builtin Unity Pipeline
|
|
Tags{"RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline" "IgnoreProjector" = "True"}
|
|
LOD 300
|
|
|
|
// ------------------------------------------------------------------
|
|
// 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
|
|
Name "StandardLit"
|
|
Tags{"LightMode" = "LightweightForward"}
|
|
|
|
//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 _OCCLUSIONMAP
|
|
|
|
// -------------------------------------
|
|
// Lightweight 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
|
|
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
|
|
|
|
// -------------------------------------
|
|
// 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 "InputSurfacePackedDialectric.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/LitForwardPass.hlsl"
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Name "ShadowCaster"
|
|
Tags{"LightMode" = "ShadowCaster"}
|
|
|
|
ZWrite On
|
|
Cull Off
|
|
|
|
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
|
|
|
|
#pragma vertex ShadowPassVertex
|
|
#pragma fragment ShadowPassFragment
|
|
|
|
#include "InputSurfacePackedDialectric.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/ShadowCasterPass.hlsl"
|
|
ENDHLSL
|
|
}
|
|
|
|
Pass
|
|
{
|
|
Name "DepthOnly"
|
|
Tags{"LightMode" = "DepthOnly"}
|
|
|
|
ZWrite On
|
|
ColorMask 0
|
|
Cull[_Cull]
|
|
|
|
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
|
|
|
|
//--------------------------------------
|
|
// GPU Instancing
|
|
#pragma multi_compile_instancing
|
|
|
|
#include "InputSurfacePackedDialectric.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/DepthOnlyPass.hlsl"
|
|
ENDHLSL
|
|
}
|
|
|
|
// This pass it not used during regular rendering, only for lightmap baking.
|
|
Pass
|
|
{
|
|
Name "Meta"
|
|
Tags{"LightMode" = "Meta"}
|
|
|
|
Cull Off
|
|
|
|
HLSLPROGRAM
|
|
// Required to compile gles 2.0 with standard srp library
|
|
#pragma prefer_hlslcc gles
|
|
#pragma exclude_renderers d3d11_9x
|
|
|
|
#pragma vertex LightweightVertexMeta
|
|
#pragma fragment LightweightFragmentMeta
|
|
|
|
#pragma shader_feature _METALLICSPECGLOSSMAP
|
|
#pragma shader_feature EDITOR_VISUALIZATION
|
|
|
|
#include "InputSurfacePackedDialectric.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.lightweight/Shaders/LitMetaPass.hlsl"
|
|
|
|
ENDHLSL
|
|
}
|
|
|
|
}
|
|
FallBack "Hidden/InternalErrorShader"
|
|
}
|