This commit is contained in:
CortexCore
2024-05-17 16:24:41 +08:00
parent 81913ff82f
commit e2650195a5
186 changed files with 72475 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
{
"reference": "GUID:90ab0119788ed4ec6b8fe54dd44f01fa"
}

View File

@@ -0,0 +1,314 @@
//////////////////////////////////////////////////////
// MicroSplat
// Copyright (c) Jason Booth
//////////////////////////////////////////////////////
using UnityEngine;
using UnityEditor;
using System.Text;
using System.Linq;
namespace JBooth.MicroSplat
{
public class UnityURP2022RenderLoopAdapter : IRenderLoopAdapter
{
public string GetDisplayName()
{
return "URP2022";
}
public string GetShaderExtension() { return "shader"; }
public string GetRenderLoopKeyword()
{
return "_MSRENDERLOOP_UNITYURP2022";
}
public string GetVersion()
{
return "3.9";
}
MicroSplatGenerator gen;
TextAsset templateURP;
TextAsset templateInclude;
TextAsset templatePassDepthOnly;
TextAsset templatePassForward;
TextAsset templatePassMeta;
TextAsset templatePassDepthNormals;
TextAsset templatePassShadow;
TextAsset templatePassGBuffer;
TextAsset templateShared;
TextAsset templateTerrainExtra;
TextAsset templateVert;
TextAsset templateChain;
TextAsset templateShaderDesc;
TextAsset templateTess;
public void Init(string[] paths)
{
if (gen == null)
{
gen = new MicroSplatGenerator();
}
gen.Init(paths);
for (int i = 0; i < paths.Length; ++i)
{
string p = paths[i];
if (p.EndsWith("microsplat_template_urp2022_template.txt"))
{
templateURP = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_func_tess2.txt"))
{
templateTess = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_shaderdesc.txt"))
{
templateShaderDesc = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_urp2022_passterrain.txt"))
{
templateTerrainExtra = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_chain.txt"))
{
templateChain = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_urp2022_passdepthnormals.txt"))
{
templatePassDepthNormals = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_urp2022_passforward.txt"))
{
templatePassForward = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_urp2022_passdepthonly.txt"))
{
templatePassDepthOnly = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_urp2022_passmeta.txt"))
{
templatePassMeta = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_urp2022_passshadows.txt"))
{
templatePassShadow = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith ("microsplat_template_urp2022_passgbuffer.txt"))
{
templatePassGBuffer = AssetDatabase.LoadAssetAtPath<TextAsset> (p);
}
else if (p.EndsWith("microsplat_template_shared.txt"))
{
templateShared = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_urp2022_vert.txt"))
{
templateVert = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
else if (p.EndsWith("microsplat_template_urp2022_include.txt"))
{
templateInclude = AssetDatabase.LoadAssetAtPath<TextAsset>(p);
}
}
if (templateURP == null || templateInclude == null || templateShared == null || templateVert == null
|| templatePassForward == null || templateChain == null || templatePassGBuffer == null || templatePassDepthNormals == null)
{
Debug.LogError ("URP Template files not found, will not be able to compile shaders");
}
}
StringBuilder BuildTemplate(Blocks blocks, string fallbackOverride = null)
{
var template = new StringBuilder(100000);
template.Append(templateURP.text);
var passforward = new StringBuilder(templatePassForward.text);
var passShadow = new StringBuilder(templatePassShadow.text);
var passMeta = new StringBuilder(templatePassMeta.text);
var passDepthOnly = new StringBuilder(templatePassDepthOnly.text);
var passDepthNormals = new StringBuilder (templatePassDepthNormals.text);
var passGBuffer = new StringBuilder (templatePassGBuffer.text);
var vert = new StringBuilder(templateVert.text);
var urpInclude = new StringBuilder(templateInclude.text);
if (blocks.options.Contains("Unlit"))
{
passGBuffer.Length = 0;
}
if (blocks.options.Contains("Alpha \"Blend\""))
{
passDepthOnly.Length = 0;
passShadow.Length = 0;
passGBuffer.Length = 0;
passDepthNormals.Length = 0;
passforward = passforward.Replace("%FORWARDBASEBLEND%", "Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha\nCull Back\n ZTest LEqual\nZWrite Off");
blocks.defines += "\n#define _ALPHABLEND_ON 1\n#define _SURFACE_TYPE_TRANSPARENT 1\n";
passforward = passforward.Insert(0, "\nZWrite Off ColorMask RGB\n\n");
}
else
{
passforward = passforward.Replace("%FORWARDBASEBLEND%", "");
}
template = template.Replace("%PASSMETA%", passMeta.ToString());
template = template.Replace("%PASSFORWARD%", passforward.ToString());
template = template.Replace("%PASSDEPTHNORMALS%", templatePassDepthNormals.text);
template = template.Replace("%PASSDEPTHONLY%", passDepthOnly.ToString());
template = template.Replace("%PASSSHADOW%", passShadow.ToString());
template = template.Replace("%PASSGBUFFER%", passGBuffer.ToString ());
template = template.Replace("%URPINCLUDE%", urpInclude.ToString());
template = template.Replace("%VERT%", vert.ToString());
template = template.Replace("%SHADERDESC%", templateShaderDesc.text + templateChain.text);
template = template.Replace("%URPINCLUDE%", templateInclude.ToString());
StringBuilder header = new StringBuilder();
header.AppendLine("////////////////////////////////////////");
header.AppendLine("// MicroSplat");
header.AppendLine("// Copyright (c) Jason Booth");
header.AppendLine("//");
header.AppendLine("// Auto-generated shader code, don't hand edit!");
header.AppendLine("//");
header.AppendLine("// Unity Version: " + Application.unityVersion);
header.AppendLine("// MicroSplat Version: " + MicroSplatShaderGUI.MicroSplatVersion);
header.AppendLine("// Render Pipeline: URP2022");
header.AppendLine("// Platform: " + Application.platform);
header.AppendLine("////////////////////////////////////////\n\n");
template = template.Insert(0, header);
string tags = SurfaceShaderRenderLoopAdapter.GetTags(blocks.options);
if (tags != null)
{
tags = tags.Replace("\"RenderType\"", "\"RenderPipeline\" = \"UniversalPipeline\" \"RenderType\"");
tags = tags.Replace("Opaque", "UniversalLitShader");
}
else
{
tags = "\"RenderPipeline\"=\"UniversalPipeline\" \"RenderType\" = \"UniversalPipeline\" \"Queue\" = \"Geometry\"";
}
if (blocks.options.Contains("Alpha"))
{
tags = tags.Replace("Geometry", "Transparent");
}
template = template.Replace("%TAGS%", tags);
template = template.Replace("%TEMPLATE_SHARED%", templateShared.text);
template = SurfaceShaderRenderLoopAdapter.ReplaceOrRemove(template, "%CUSTOMEDITOR%", "CustomEditor", SurfaceShaderRenderLoopAdapter.GetOption(blocks.options, "CustomEditor"));
if (fallbackOverride != null)
{
template = template.Replace("%FALLBACK%", "Fallback \"" + fallbackOverride + "\"");
template = SurfaceShaderRenderLoopAdapter.ReplaceOrRemove(template, "%DEPENDENCY%", "Dependency \"BaseMapShader\" = ", fallbackOverride);
}
else
{
template = SurfaceShaderRenderLoopAdapter.ReplaceOrRemove(template, "%FALLBACK%", "Fallback", "");
template = SurfaceShaderRenderLoopAdapter.ReplaceOrRemove(template, "%DEPENDENCY%", "Dependency", "");
}
return template;
}
public StringBuilder WriteShader(string[] features,
MicroSplatShaderGUI.MicroSplatCompiler compiler,
MicroSplatShaderGUI.MicroSplatCompiler.AuxShader auxShader,
string name,
string baseName)
{
StringBuilder defines = new StringBuilder();
var blocks = gen.GetShaderBlocks(features, compiler, auxShader);
var shader = BuildTemplate(blocks, baseName);
defines.AppendLine(blocks.defines);
defines.AppendLine("\n #define _URP 1");
string shaderTarget = "3.5";
if (features.Contains("_TESSDISTANCE") || features.Contains("_FORCEMODEL46"))
{
shaderTarget = "4.6";
}
else if (features.Contains("_FORCEMODEL50"))
{
shaderTarget = "5.0";
}
if (features.Contains("_TESSDISTANCE"))
{
defines.AppendLine("\n #define _TESSELLATION_ON 1");
shader = shader.Replace("%TESSELLATION%", templateTess.text);
shader = shader.Replace("%PRAGMAS%", " #pragma hull Hull\n #pragma domain Domain\n #pragma vertex TessVert\n #pragma fragment Frag\n #pragma require tesshw\n");
}
else
{
shader = shader.Replace("%PRAGMAS%", " #pragma vertex Vert\n #pragma fragment Frag");
shader = shader.Replace("%TESSELLATION%", "");
}
shader = shader.Replace("%SHADERTARGET%", shaderTarget);
if (features.Contains("_USESPECULARWORKFLOW"))
{
defines.AppendLine("\n#define _USESPECULAR 1");
defines.AppendLine("#define _MATERIAL_FEATURE_SPECULAR_COLOR 1");
}
defines.AppendLine();
shader = shader.Replace("%SHADERNAME%", name);
shader = shader.Replace("%PROPERTIES%", blocks.properties);
shader = shader.Replace("%CODE%", blocks.code);
shader = shader.Replace("%DEFINES%", defines.ToString());
shader = shader.Replace("%CBUFFER%", blocks.cbuffer);
shader = shader.Replace("%SUBSHADERTAGS%", "");
shader = shader.Replace("%CUSTOMPREPASS%", "");
shader = shader.Replace("%CUSTOMCBUFFER%", "");
shader = shader.Replace("%CUSTOMINSTANCEPROPS%", "");
shader = shader.Replace("%PASSFORWARD%", "");
shader = shader.Replace("%PASSGBUFFER%", "");
shader = shader.Replace("%PASSSHADOW%", "");
shader = shader.Replace("%PASSDEPTH%", "");
shader = shader.Replace("%PASSMETA%", "");
shader = shader.Replace("%PASSDEPTH%", "");
if (features.Contains("_MICROTERRAIN"))
{
shader = shader.Replace("%CUSTOMTERRAINPASS%", templateTerrainExtra.text);
}
else
{
shader = shader.Replace("%CUSTOMTERRAINPASS%", "");
}
string codeNoComments = blocks.code.StripComments();
shader = SurfaceShaderRenderLoopAdapter.Strip(codeNoComments, shader);
// standard pipeline stuff
shader = shader.Replace("fixed", "half");
shader = shader.Replace("unity_ObjectToWorld", "GetObjectToWorldMatrix()");
shader = shader.Replace("unity_WorldToObject", "GetWorldToObjectMatrix()");
shader = shader.Replace("UNITY_MATRIX_M", "GetObjectToWorldMatrix()");
shader = shader.Replace("UNITY_MATRIX_I_M", "GetWorldToObjectMatrix()");
shader = shader.Replace("UNITY_MATRIX_VP", "GetWorldToHClipMatrix()");
shader = shader.Replace("UNITY_MATRIX_V", "GetWorldToViewMatrix()");
shader = shader.Replace("UNITY_MATRIX_P", "GetViewToHClipMatrix()");
return shader;
}
}
}

View File

@@ -0,0 +1,81 @@
 #undef WorldNormalVector
#define WorldNormalVector(data, normal) mul(normal, float3x3(d.worldSpaceTangent, cross(d.worldSpaceTangent, d.worldSpaceNormal), d.worldSpaceNormal))
#define UnityObjectToWorldNormal(normal) mul(GetObjectToWorldMatrix(), normal)
#define _WorldSpaceLightPos0 _MainLightPosition
#define UNITY_DECLARE_TEX2D(name) TEXTURE2D(name); SAMPLER(sampler##name);
#define UNITY_DECLARE_TEX2D_NOSAMPLER(name) TEXTURE2D(name);
#define UNITY_DECLARE_TEX2DARRAY(name) TEXTURE2D_ARRAY(name); SAMPLER(sampler##name);
#define UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(name) TEXTURE2D_ARRAY(name);
#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) SAMPLE_TEXTURE2D_ARRAY(tex, sampler##tex, coord.xy, coord.z)
#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) SAMPLE_TEXTURE2D_ARRAY_LOD(tex, sampler##tex, coord.xy, coord.z, lod)
#define UNITY_SAMPLE_TEX2D(tex, coord) SAMPLE_TEXTURE2D(tex, sampler##tex, coord)
#define UNITY_SAMPLE_TEX2D_SAMPLER(tex, samp, coord) SAMPLE_TEXTURE2D(tex, sampler##samp, coord)
#if defined(UNITY_COMPILER_HLSL)
#define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0;
#else
#define UNITY_INITIALIZE_OUTPUT(type,name)
#endif
#define sampler2D_float sampler2D
#define sampler2D_half sampler2D
// data across stages, stripped like the above.
struct VertexToPixel
{
float4 pos : SV_POSITION;
float3 worldPos : TEXCOORD0;
float3 worldNormal : TEXCOORD1;
float4 worldTangent : TEXCOORD2;
%V2FUV0% float4 texcoord0 : TEXCCOORD3;
#if !_MICROTERRAIN || _TERRAINBLENDABLESHADER
%V2FUV1% float4 texcoord1 : TEXCCOORD4;
%V2FUV2% float4 texcoord2 : TEXCCOORD5;
#endif
%V2FUV3% float4 texcoord3 : TEXCCOORD6;
%SCREENPOS% float4 screenPos : TEXCOORD7;
%V2FVERTEXCOLOR% float4 vertexColor : COLOR;
%EXTRAV2F0% float4 extraV2F0 : TEXCOORD13;
%EXTRAV2F1% float4 extraV2F1 : TEXCOORD14;
%EXTRAV2F2% float4 extraV2F2 : TEXCOORD15;
%EXTRAV2F3% float4 extraV2F3 : TEXCOORD16;
%EXTRAV2F4% float4 extraV2F4 : TEXCOORD17;
%EXTRAV2F5% float4 extraV2F5 : TEXCOORD18;
%EXTRAV2F6% float4 extraV2F6 : TEXCOORD19;
%EXTRAV2F7% float4 extraV2F7 : TEXCOORD20;
#if defined(LIGHTMAP_ON)
float2 lightmapUV : TEXCOORD8;
#endif
#if defined(DYNAMICLIGHTMAP_ON)
float2 dynamicLightmapUV : TEXCOORD9;
#endif
#if !defined(LIGHTMAP_ON)
float3 sh : TEXCOORD10;
#endif
float4 fogFactorAndVertexLight : TEXCOORD11;
float4 shadowCoord : TEXCOORD12;
#if UNITY_ANY_INSTANCING_ENABLED
uint instanceID : CUSTOM_INSTANCE_ID;
#endif
#if (defined(UNITY_STEREO_MULTIVIEW_ENABLED)) || (defined(UNITY_STEREO_INSTANCING_ENABLED) && (defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE)))
uint stereoTargetEyeIndexAsBlendIdx0 : BLENDINDICES0;
#endif
#if (defined(UNITY_STEREO_INSTANCING_ENABLED))
uint stereoTargetEyeIndexAsRTArrayIdx : SV_RenderTargetArrayIndex;
#endif
#if defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
#endif
};

View File

@@ -0,0 +1,139 @@
Pass
{
Name "DepthNormals"
Tags
{
"LightMode" = "DepthNormals"
}
// Render State
Cull Back
Blend One Zero
ZTest LEqual
ZWrite On
%PASSDEPTH%
HLSLPROGRAM
%PRAGMAS%
#pragma target %SHADERTARGET%
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma multi_compile_fog
#pragma multi_compile_instancing
#pragma multi_compile _ DOTS_INSTANCING_ON
#pragma multi_compile_local _ _ALPHATEST_ON
#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
#define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
#define _PASSDEPTH 1
#define _PASSDEPTHNORMALS 1
%DEFINES%
// this has to be here or specular color will be ignored. Not in SG code
#if _SIMPLELIT
#define _SPECULAR_COLOR
#endif
// Includes
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl"
%URPINCLUDE%
%TEMPLATE_SHARED%
CBUFFER_START(UnityPerMaterial)
%CBUFFER%
CBUFFER_END
%CUSTOMCBUFFER%
%CUSTOMINSTANCEPROPS%
%CODE%
%SHADERDESC%
%VERT%
%TESSELLATION%
// fragment shader
void Frag (VertexToPixel IN
, out half4 outNormalWS : SV_Target0
#ifdef _WRITE_RENDERING_LAYERS
, out float4 outRenderingLayers : SV_Target1
#endif
#ifdef _DEPTHOFFSET_ON
, out float outputDepth : SV_Depth
#endif
#if NEED_FACING
, bool facing : SV_IsFrontFace
#endif
)
{
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
ShaderData d = CreateShaderData(IN);
Surface l = (Surface)0;
#ifdef _DEPTHOFFSET_ON
l.outputDepth = outputDepth;
#endif
l.Albedo = half3(0.5, 0.5, 0.5);
l.Normal = float3(0,0,1);
l.Occlusion = 1;
l.Alpha = 1;
ChainSurfaceFunction(l, d);
#ifdef _DEPTHOFFSET_ON
outputDepth = l.outputDepth;
#endif
#if defined(_GBUFFER_NORMALS_OCT)
float3 normalWS = d.worldSpaceNormal;
float2 octNormalWS = PackNormalOctQuadEncode(normalWS); // values between [-1, +1], must use fp32 on some platforms
float2 remappedOctNormalWS = saturate(octNormalWS * 0.5 + 0.5); // values between [ 0, 1]
half3 packedNormalWS = PackFloat2To888(remappedOctNormalWS); // values between [ 0, 1]
outNormalWS = half4(packedNormalWS, 0.0);
#else
float3 wsn = l.Normal;
#if !_WORLDSPACENORMAL
wsn = TangentToWorldSpace(d, l.Normal);
#endif
outNormalWS = half4(NormalizeNormalPerPixel(wsn), 0.0);
#endif
#ifdef _WRITE_RENDERING_LAYERS
uint renderingLayers = GetMeshRenderingLayer();
outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0);
#endif
}
ENDHLSL
}

View File

@@ -0,0 +1,103 @@

Pass
{
Name "DepthOnly"
Tags
{
"LightMode" = "DepthOnly"
}
// Render State
Blend One Zero, One Zero
Cull Back
ZTest LEqual
ZWrite On
ColorMask 0
%PASSDEPTH%
HLSLPROGRAM
%PRAGMAS%
#define SHADERPASS SHADERPASS_DEPTHNORMALSONLY
#define _PASSDEPTH 1
#define _PASSDEPTHNORMALS 1
#pragma target %SHADERTARGET%
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma multi_compile_instancing
#pragma multi_compile _ DOTS_INSTANCING_ON
#pragma multi_compile_local _ _ALPHATEST_ON
%DEFINES%
// Includes
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
#include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl"
%URPINCLUDE%
%TEMPLATE_SHARED%
CBUFFER_START(UnityPerMaterial)
%CBUFFER%
CBUFFER_END
%CUSTOMCBUFFER%
%CUSTOMINSTANCEPROPS%
%CODE%
%SHADERDESC%
%VERT%
%TESSELLATION%
// fragment shader
fixed4 Frag (VertexToPixel IN
#ifdef _DEPTHOFFSET_ON
, out float outputDepth : SV_Depth
#endif
) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
ShaderData d = CreateShaderData(IN);
Surface l = (Surface)0;
#ifdef _DEPTHOFFSET_ON
l.outputDepth = outputDepth;
#endif
l.Albedo = half3(0.5, 0.5, 0.5);
l.Normal = float3(0,0,1);
l.Occlusion = 1;
l.Alpha = 1;
ChainSurfaceFunction(l, d);
#ifdef _DEPTHOFFSET_ON
outputDepth = l.outputDepth;
#endif
return 0;
}
ENDHLSL
}

View File

@@ -0,0 +1,263 @@

Pass
{
Name "Universal Forward"
Tags
{
"LightMode" = "UniversalForward"
}
Cull Back
Blend One Zero
ZTest LEqual
ZWrite On
%FORWARDBASEBLEND%
%PASSFORWARD%
HLSLPROGRAM
%PRAGMAS%
#pragma target %SHADERTARGET%
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma multi_compile_fog
#pragma multi_compile_instancing
#pragma multi_compile _ DOTS_INSTANCING_ON
#pragma multi_compile_local _ _ALPHATEST_ON
#pragma instancing_options renderinglayer
// Keywords
#pragma multi_compile _ _SCREEN_SPACE_OCCLUSION
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#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 _ _REFLECTION_PROBE_BLENDING
#pragma multi_compile _ _REFLECTION_PROBE_BOX_PROJECTION
#pragma multi_compile _ _SHADOWS_SOFT
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
#pragma multi_compile _ SHADOWS_SHADOWMASK
#pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
#pragma multi_compile _ _LIGHT_LAYERS
#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ _LIGHT_COOKIES
#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
#pragma multi_compile _ _FORWARD_PLUS
// GraphKeywords: <None>
#define SHADER_PASS SHADERPASS_FORWARD
#define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
#define _FOG_FRAGMENT 1
#define _PASSFORWARD 1
#if _SIMPLELIT
#define _SPECULAR_COLOR
#endif
%DEFINES%
// this has to be here or specular color will be ignored. Not in SG code
#if _SIMPLELIT
#define _SPECULAR_COLOR
#endif
// Includes
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#if VERSION_GREATER_EQUAL(12, 0)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
#endif
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
%URPINCLUDE%
%TEMPLATE_SHARED%
CBUFFER_START(UnityPerMaterial)
%CBUFFER%
CBUFFER_END
%CUSTOMCBUFFER%
%CUSTOMINSTANCEPROPS%
%CODE%
%SHADERDESC%
%VERT%
%TESSELLATION%
#if _UNLIT
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl"
#endif
// fragment shader
void Frag (VertexToPixel IN
, out half4 outColor : SV_Target0
#ifdef _WRITE_RENDERING_LAYERS
, out float4 outRenderingLayers : SV_Target1
#endif
#ifdef _DEPTHOFFSET_ON
, out float outputDepth : SV_Depth
#endif
#if NEED_FACING
, bool facing : SV_IsFrontFace
#endif
)
{
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
#if defined(LOD_FADE_CROSSFADE)
LODFadeCrossFade(IN.pos);
#endif
ShaderData d = CreateShaderData(IN);
Surface l = (Surface)0;
#ifdef _DEPTHOFFSET_ON
l.outputDepth = outputDepth;
#endif
l.Albedo = half3(0.5, 0.5, 0.5);
l.Normal = float3(0,0,1);
l.Occlusion = 1;
l.Alpha = 1;
ChainSurfaceFunction(l, d);
#ifdef _DEPTHOFFSET_ON
outputDepth = l.outputDepth;
#endif
#if defined(_USESPECULAR) || _SIMPLELIT
float3 specular = l.Specular;
float metallic = 0;
#else
float3 specular = 0;
float metallic = l.Metallic;
#endif
InputData inputData = (InputData)0;
inputData.positionWS = IN.worldPos;
inputData.normalWS = mul(l.Normal, d.TBNMatrix);
inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir);
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
inputData.shadowCoord = IN.shadowCoord;
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
inputData.shadowCoord = TransformWorldToShadowCoord(IN.worldPos);
#else
inputData.shadowCoord = float4(0, 0, 0, 0);
#endif
#if _BAKEDLIT
inputData.fogCoord = IN.fogFactorAndVertexLight.x;
#elif VERSION_GREATER_EQUAL(12, 0)
inputData.fogCoord = InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x);
#else
inputData.fogCoord = IN.fogFactorAndVertexLight.x;
#endif
inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw;
#if defined(DYNAMICLIGHTMAP_ON)
inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS);
#else
inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS);
#endif
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos);
#if !_BAKEDLIT && defined(LIGHTMAP_ON)
inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV);
#endif
#if defined(DEBUG_DISPLAY)
#if defined(DYNAMICLIGHTMAP_ON)
inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy;
#endif
#if defined(LIGHTMAP_ON)
inputData.staticLightmapUV = IN.lightmapUV;
#else
inputData.vertexSH = IN.sh;
#endif
#endif
SurfaceData surface = (SurfaceData)0;
surface.albedo = l.Albedo;
surface.metallic = saturate(metallic);
surface.specular = specular;
surface.smoothness = saturate(l.Smoothness),
surface.occlusion = l.Occlusion,
surface.emission = l.Emission,
surface.alpha = saturate(l.Alpha);
surface.clearCoatMask = 0;
surface.clearCoatSmoothness = 1;
half4 color = half4(l.Albedo, l.Alpha);
#ifdef _DBUFFER
#if _BAKEDLIT
ApplyDecalToBaseColorAndNormal(IN.pos, color, inputData.normalWS);
#else
ApplyDecalToSurfaceData(IN.pos, surface, inputData);
#endif
#endif
#if !_UNLIT
#if _SIMPLELIT
color = UniversalFragmentBlinnPhong(
inputData,
surface);
#elif _BAKEDLIT
color = UniversalFragmentBakedLit(inputData, color.rgb, color.a, l.Normal);
#else
color = UniversalFragmentPBR(inputData, surface);
#endif
color.rgb = MixFog(color.rgb, inputData.fogCoord);
#else
#ifdef _DBUFFER
ApplyDecalToSurfaceData(IN.pos, surface, inputData);
#endif
color = UniversalFragmentUnlit(inputData, l.Albedo, l.Alpha);
#endif
ChainFinalColorForward(l, d, color);
outColor = color;
#ifdef _WRITE_RENDERING_LAYERS
uint renderingLayers = GetMeshRenderingLayer();
outRenderingLayers = float4(EncodeMeshRenderingLayer(renderingLayers), 0, 0, 0);
#endif
}
ENDHLSL
}

View File

@@ -0,0 +1,197 @@

Pass
{
Name "GBuffer"
Tags
{
"LightMode" = "UniversalGBuffer"
}
Blend One Zero
ZTest LEqual
ZWrite On
%PASSGBUFFER%
HLSLPROGRAM
%PRAGMAS%
#pragma target %SHADERTARGET%
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma multi_compile_instancing
#pragma multi_compile_fog
#pragma multi_compile _ DOTS_INSTANCING_ON
#pragma multi_compile_local _ _ALPHATEST_ON
#pragma instancing_options renderinglayer
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
#pragma multi_compile _ _REFLECTION_PROBE_BLENDING
#pragma multi_compile _ _REFLECTION_PROBE_BOX_PROJECTION
#pragma multi_compile _ _SHADOWS_SOFT
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
#pragma multi_compile _ _MIXED_LIGHTING_SUBTRACTIVE
#pragma multi_compile _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
#pragma multi_compile _ _LIGHT_LAYERS
#pragma multi_compile _ _RENDER_PASS_ENABLED
#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _ SHADOWS_SHADOWMASK
#pragma multi_compile_fragment _ _WRITE_RENDERING_LAYERS
#define _FOG_FRAGMENT 1
%DEFINES%
#define VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
#define SHADERPASS SHADERPASS_GBUFFER
#define _PASSGBUFFER 1
// Includes
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#if VERSION_GREATER_EQUAL(12, 0)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
#endif
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
%URPINCLUDE%
%TEMPLATE_SHARED%
CBUFFER_START(UnityPerMaterial)
%CBUFFER%
CBUFFER_END
%CUSTOMCBUFFER%
%CUSTOMINSTANCEPROPS%
%CODE%
%SHADERDESC%
%VERT%
%TESSELLATION%
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityGBuffer.hlsl"
// fragment shader
FragmentOutput Frag (VertexToPixel IN
#ifdef _DEPTHOFFSET_ON
, out float outputDepth : SV_Depth
#endif
)
{
UNITY_SETUP_INSTANCE_ID(IN);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
ShaderData d = CreateShaderData(IN);
Surface l = (Surface)0;
#ifdef _DEPTHOFFSET_ON
l.outputDepth = outputDepth;
#endif
l.Albedo = half3(0.5, 0.5, 0.5);
l.Normal = float3(0,0,1);
l.Occlusion = 1;
l.Alpha = 1;
ChainSurfaceFunction(l, d);
#ifdef _DEPTHOFFSET_ON
outputDepth = l.outputDepth;
#endif
#if defined(_USESPECULAR) || _SIMPLELIT
float3 specular = l.Specular;
float metallic = 0;
#else
float3 specular = 0;
float metallic = l.Metallic;
#endif
InputData inputData = (InputData)0;
inputData.positionWS = IN.worldPos;
inputData.normalWS = mul(l.Normal, d.TBNMatrix);
inputData.viewDirectionWS = SafeNormalize(d.worldSpaceViewDir);
#if defined(MAIN_LIGHT_CALCULATE_SHADOWS)
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
#else
inputData.shadowCoord = float4(0, 0, 0, 0);
#endif
InitializeInputDataFog(float4(IN.worldPos, 1.0), IN.fogFactorAndVertexLight.x);
inputData.vertexLighting = IN.fogFactorAndVertexLight.yzw;
#if defined(DYNAMICLIGHTMAP_ON)
inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.dynamicLightmapUV.xy, IN.sh, inputData.normalWS);
#else
inputData.bakedGI = SAMPLE_GI(IN.lightmapUV, IN.sh, inputData.normalWS);
#endif
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(IN.pos);
#if defined(LIGHTMAP_ON)
inputData.shadowMask = SAMPLE_SHADOWMASK(IN.lightmapUV);
#endif
#if defined(DEBUG_DISPLAY)
#if defined(DYNAMICLIGHTMAP_ON)
inputData.dynamicLightmapUV = IN.dynamicLightmapUV.xy;
#endif
#if defined(LIGHTMAP_ON)
inputData.staticLightmapUV = IN.lightmapUV;
#else
inputData.vertexSH = IN.sh;
#endif
#endif
#ifdef _DBUFFER
ApplyDecal(IN.pos,
l.Albedo,
specular,
inputData.normalWS,
metallic,
l.Occlusion,
l.Smoothness);
#endif
BRDFData brdfData;
InitializeBRDFData(l.Albedo, metallic, specular, l.Smoothness, l.Alpha, brdfData);
Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);
MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI, inputData.shadowMask);
half3 color = GlobalIllumination(brdfData, inputData.bakedGI, l.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS);
return BRDFDataToGbuffer(brdfData, inputData, l.Smoothness, l.Emission + color, l.Occlusion);
}
ENDHLSL
}

View File

@@ -0,0 +1,91 @@

Pass
{
Name "Meta"
Tags
{
"LightMode" = "Meta"
}
// Render State
Cull Off
%PASSMETA%
HLSLPROGRAM
%PRAGMAS%
#pragma target %SHADERTARGET%
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma multi_compile_local _ _ALPHATEST_ON
#define SHADERPASS SHADERPASS_META
#define _PASSMETA 1
%DEFINES%
// Includes
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
#include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl"
%URPINCLUDE%
%TEMPLATE_SHARED%
CBUFFER_START(UnityPerMaterial)
%CBUFFER%
CBUFFER_END
%CUSTOMCBUFFER%
%CUSTOMINSTANCEPROPS%
%CODE%
%SHADERDESC%
%VERT%
%TESSELLATION%
// fragment shader
fixed4 Frag (VertexToPixel IN) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(IN);
ShaderData d = CreateShaderData(IN);
Surface l = (Surface)0;
l.Albedo = half3(0.5, 0.5, 0.5);
l.Normal = float3(0,0,1);
l.Occlusion = 1;
l.Alpha = 1;
ChainSurfaceFunction(l, d);
MetaInput metaInput = (MetaInput)0;
metaInput.Albedo = l.Albedo;
metaInput.Emission = l.Emission;
return MetaFragment(metaInput);
}
ENDHLSL
}

View File

@@ -0,0 +1,104 @@

Pass
{
Name "ShadowCaster"
Tags
{
"LightMode" = "ShadowCaster"
}
// Render State
Blend One Zero, One Zero
Cull Back
ZTest LEqual
ZWrite On
// ColorMask: <None>
%PASSSHADOW%
HLSLPROGRAM
%PRAGMAS%
#pragma target %SHADERTARGET%
#pragma prefer_hlslcc gles
#pragma exclude_renderers d3d11_9x
#pragma multi_compile_instancing
#pragma multi_compile_local _ _ALPHATEST_ON
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
#define _NORMAL_DROPOFF_TS 1
#define ATTRIBUTES_NEED_NORMAL
#define ATTRIBUTES_NEED_TANGENT
#define SHADERPASS_SHADOWCASTER
#define _PASSSHADOW 1
%DEFINES%
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureStack.hlsl"
#include "Packages/com.unity.shadergraph/ShaderGraphLibrary/ShaderVariablesFunctions.hlsl"
%URPINCLUDE%
%TEMPLATE_SHARED%
CBUFFER_START(UnityPerMaterial)
%CBUFFER%
CBUFFER_END
%CUSTOMCBUFFER%
%CUSTOMINSTANCEPROPS%
%CODE%
%SHADERDESC%
%VERT%
%TESSELLATION%
// fragment shader
fixed4 Frag (VertexToPixel IN
#ifdef _DEPTHOFFSET_ON
, out float outputDepth : SV_Depth
#endif
) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(IN);
ShaderData d = CreateShaderData(IN);
Surface l = (Surface)0;
#ifdef _DEPTHOFFSET_ON
l.outputDepth = outputDepth;
#endif
l.Albedo = half3(0.5, 0.5, 0.5);
l.Normal = float3(0,0,1);
l.Occlusion = 1;
l.Alpha = 1;
ChainSurfaceFunction(l, d);
#ifdef _DEPTHOFFSET_ON
outputDepth = l.outputDepth;
#endif
return 0;
}
ENDHLSL
}

View File

@@ -0,0 +1,21 @@
Pass
{
Name "SceneSelectionPass"
Tags { "LightMode" = "SceneSelectionPass" }
HLSLPROGRAM
#pragma target 2.0
#pragma vertex DepthOnlyVertex
#pragma fragment DepthOnlyFragment
#pragma multi_compile_instancing
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap
#define SCENESELECTIONPASS
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLitPasses.hlsl"
ENDHLSL
}
UsePass "Hidden/Nature/Terrain/Utilities/PICKING"

View File

@@ -0,0 +1,28 @@
Shader "%SHADERNAME%"
{
Properties
{
[HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
[HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
[HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
%PROPERTIES%
}
SubShader
{
%TAGS%
%SUBSHADERTAGS%
%PASSFORWARD%
%PASSGBUFFER%
%PASSSHADOW%
%PASSDEPTHONLY%
%PASSMETA%
%PASSDEPTHNORMALS%
%CUSTOMPREPASS%
%CUSTOMTERRAINPASS%
}
%DEPENDENCY%
%FALLBACK%
%CUSTOMEDITOR%
}

View File

@@ -0,0 +1,108 @@

#if _PASSSHADOW
float3 _LightDirection;
float3 _LightPosition;
#endif
// vertex shader
VertexToPixel Vert (VertexData v)
{
VertexToPixel o = (VertexToPixel)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
#if !_TESSELLATION_ON
ChainModifyVertex(v, o);
#endif
%V2FUV0% o.texcoord0 = v.texcoord0;
#if !_MICROTERRAIN || _TERRAINBLENDABLESHADER
%V2FUV1% o.texcoord1 = v.texcoord1;
%V2FUV2% o.texcoord2 = v.texcoord2;
#endif
%V2FUV3% o.texcoord3 = v.texcoord3;
%V2FVERTEXCOLOR% o.vertexColor = v.vertexColor;
VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz);
o.worldPos = TransformObjectToWorld(v.vertex.xyz);
o.worldNormal = TransformObjectToWorldNormal(v.normal);
#if !_MICROTERRAIN || _TERRAINBLENDABLESHADER
float2 uv1 = v.texcoord1.xy;
float2 uv2 = v.texcoord2.xy;
o.worldTangent = float4(TransformObjectToWorldDir(v.tangent.xyz), v.tangent.w);
#else
float2 uv1 = v.texcoord0.xy;
float2 uv2 = uv1;
#endif
// MS Only
ApplyTerrainTangent(o);
#if _PASSSHADOW
#if _CASTING_PUNCTUAL_LIGHT_SHADOW
float3 lightDirectionWS = normalize(_LightPosition - o.worldPos);
#else
float3 lightDirectionWS = _LightDirection;
#endif
// Define shadow pass specific clip position for Universal
o.pos = TransformWorldToHClip(ApplyShadowBias(o.worldPos, o.worldNormal, lightDirectionWS));
#if UNITY_REVERSED_Z
o.pos.z = min(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE);
#else
o.pos.z = max(o.pos.z, o.pos.w * UNITY_NEAR_CLIP_VALUE);
#endif
#elif _PASSMETA
#if _MICROTERRAIN
o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), v.texcoord0.xy, v.texcoord0.xy, unity_LightmapST, unity_DynamicLightmapST);
#else
o.pos = MetaVertexPosition(float4(v.vertex.xyz, 0), uv1, uv2, unity_LightmapST, unity_DynamicLightmapST);
#endif
#else
o.pos = TransformWorldToHClip(o.worldPos);
#endif
%SCREENPOS% o.screenPos = ComputeScreenPos(o.pos, _ProjectionParams.x);
#if _PASSFORWARD || _PASSGBUFFER
#if _MICROTERRAIN
OUTPUT_LIGHTMAP_UV(v.texcoord0.xy, unity_LightmapST, o.lightmapUV);
#else
OUTPUT_LIGHTMAP_UV(uv1, unity_LightmapST, o.lightmapUV);
#endif
OUTPUT_SH(o.worldNormal, o.sh);
#if defined(DYNAMICLIGHTMAP_ON)
o.dynamicLightmapUV.xy = uv2 * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
#endif
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
half fogFactor = 0;
#if defined(_FOG_FRAGMENT)
fogFactor = ComputeFogFactor(o.pos.z);
#endif
#if _BAKEDLIT
half3 vertexLight = VertexLighting(o.worldPos, o.worldNormal);
o.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
#else
o.fogFactorAndVertexLight = half4(fogFactor, 0,0,0);
#endif
#endif
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
o.shadowCoord = GetShadowCoord(vertexInput);
#endif
return o;
}

View File

@@ -0,0 +1,3 @@
{
"reference": "GUID:4bdfb2239705790718731d0b4d54062a"
}

View File

@@ -0,0 +1,29 @@
{
"name": "com.jbooth.microsplat.urp2022",
"displayName": "MicroSplat-CoreURP2022",
"version": "3.9.0",
"author": {
"name": "Jason Booth",
"email": "slipster216@gmail.com",
"url": "http://jdbtechservices.com/"
},
"unity": "2022.2",
"samples": [
{
"displayName": "URP2022 Example",
"description": "Example of URP2022",
"path": "Samples~/URP2022"
}
],
"dependencies": {
"com.jbooth.microsplat.core": "3.9.0"
},
"description": "The URP2022 module for MicroSplat allows MicroSplat to compile it's shaders for URP 14.x",
"keywords": [
"MicroSplat",
"Terrain",
"Shader",
"URP"
],
"documentationUrl": "https://docs.google.com/document/d/1i29Tp5WcsFcIHCVgWV4rSnjgpw1kyENaVSSkHhgu0ro/edit?usp=sharing"
}