参考链接-/https://catlikecoding.com/unity/tutorials/
1、SRP Batcher
shader代码:
#ifndef CUSTOM_UNLIT_PASS_INCLUDED
#define CUSTOM_UNLIT_PASS_INCLUDED
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "UnityInput.hlsl"
#define UNITY_MATRIX_M unity_ObjectToWorld
#define UNITY_MATRIX_I_M unity_WorldToObject
#define UNITY_MATRIX_V unity_MatrixV
#define UNITY_MATRIX_VP unity_MatrixVP
#define UNITY_MATRIX_P glstate_matrix_projection
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl"
CBUFFER_START(UnityPerMaterial)
float4 _BaseColor;
CBUFFER_END
float4 UnlitPassVertex (float3 positionOS : POSITION):SV_POSITION
{
return TransformObjectToHClip(positionOS);
}
float4 UnlitPassFragment(): SV_TARGET
{
return _BaseColor;
}
#endif
主要关注下: