initial commit

This commit is contained in:
Jo 2025-01-07 02:06:59 +01:00
parent 6715289efe
commit 788c3389af
37645 changed files with 2526849 additions and 80 deletions

View file

@ -0,0 +1,11 @@
using UnityEngine.Rendering;
namespace UnityEditor.Rendering.Universal
{
[GenerateHLSL]
public enum DecalMeshDepthBiasType
{
DepthBias = 0,
ViewBias = 1
}
}

View file

@ -0,0 +1,14 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef DECALMESHBIASTYPEENUM_CS_HLSL
#define DECALMESHBIASTYPEENUM_CS_HLSL
//
// UnityEditor.Rendering.Universal.DecalMeshDepthBiasType: static fields
//
#define DECALMESHDEPTHBIASTYPE_DEPTH_BIAS (0)
#define DECALMESHDEPTHBIASTYPE_VIEW_BIAS (1)
#endif

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6483447b285419e4b89f8a853712e1ab
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7b0974d577112814b864532434d162a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,53 @@
#ifndef SG_DEPTH_NORMALS_PASS_INCLUDED
#define SG_DEPTH_NORMALS_PASS_INCLUDED
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/EncodeNormalsTexture.hlsl"
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold);
#endif
#if defined(_GBUFFER_NORMALS_OCT)
float3 normalWS = normalize(unpacked.normalWS);
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]
return half4(packedNormalWS, 0.0);
#else
// Retrieve the normal from the bump map or mesh normal
#if defined(_NORMALMAP)
#if _NORMAL_DROPOFF_TS
// IMPORTANT! If we ever support Flip on double sided materials ensure bitangent and tangent are NOT flipped.
float crossSign = (unpacked.tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
float3 bitangent = crossSign * cross(unpacked.normalWS.xyz, unpacked.tangentWS.xyz);
float3 normalWS = TransformTangentToWorld(surfaceDescription.NormalTS, half3x3(unpacked.tangentWS.xyz, bitangent, unpacked.normalWS.xyz));
#elif _NORMAL_DROPOFF_OS
float3 normalWS = TransformObjectToWorldNormal(surfaceDescription.NormalOS);
#elif _NORMAL_DROPOFF_WS
float3 normalWS = surfaceDescription.NormalWS;
#endif
#else
float3 normalWS = unpacked.normalWS;
#endif
return half4(EncodeWSNormalForNormalsTex(NormalizeNormalPerPixel(normalWS)), 0.0);
#endif
}
#endif

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9ebb19659794b47c59986fcc45692a0d
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,27 @@
#ifndef SG_DEPTH_ONLY_PASS_INCLUDED
#define SG_DEPTH_ONLY_PASS_INCLUDED
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold);
#endif
return 0;
}
#endif

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8f266648f26372548b2ae696d6db739e
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,34 @@
#ifndef SG_LIT_META_INCLUDED
#define SG_LIT_META_INCLUDED
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold);
#endif
MetaInput metaInput = (MetaInput)0;
metaInput.Albedo = surfaceDescription.BaseColor;
metaInput.Emission = surfaceDescription.Emission;
#ifdef EDITOR_VISUALIZATION
metaInput.VizUV = unpacked.texCoord1.xy;
metaInput.LightCoord = unpacked.texCoord2;
#endif
return UnityMetaFragment(metaInput);
}
#endif

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9b897418a23a04642a054cf9daa3bf54
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,28 @@
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
half alpha = surfaceDescription.Alpha;
clip(alpha - surfaceDescription.AlphaClipThreshold);
#elif _SURFACE_TYPE_TRANSPARENT
half alpha = surfaceDescription.Alpha;
#else
half alpha = 1;
#endif
half4 color = half4(surfaceDescription.BaseColor, alpha);
return color;
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3cb98c83fcab8434296397682201b369
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,126 @@
void InitializeInputData(Varyings input, SurfaceDescription surfaceDescription, out InputData inputData)
{
inputData = (InputData)0;
inputData.positionWS = input.positionWS;
#ifdef _NORMALMAP
// IMPORTANT! If we ever support Flip on double sided materials ensure bitangent and tangent are NOT flipped.
float crossSign = (input.tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
float3 bitangent = crossSign * cross(input.normalWS.xyz, input.tangentWS.xyz);
inputData.tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
#if _NORMAL_DROPOFF_TS
inputData.normalWS = TransformTangentToWorld(surfaceDescription.NormalTS, inputData.tangentToWorld);
#elif _NORMAL_DROPOFF_OS
inputData.normalWS = TransformObjectToWorldNormal(surfaceDescription.NormalOS);
#elif _NORMAL_DROPOFF_WS
inputData.normalWS = surfaceDescription.NormalWS;
#endif
#else
inputData.normalWS = input.normalWS;
#endif
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
inputData.viewDirectionWS = SafeNormalize(input.viewDirectionWS);
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
inputData.shadowCoord = input.shadowCoord;
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
#else
inputData.shadowCoord = float4(0, 0, 0, 0);
#endif
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactorAndVertexLight.x);
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
#if defined(DYNAMICLIGHTMAP_ON)
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, input.sh, inputData.normalWS);
#else
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.sh, inputData.normalWS);
#endif
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
#if defined(DEBUG_DISPLAY)
#if defined(DYNAMICLIGHTMAP_ON)
inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
#endif
#if defined(LIGHTMAP_ON)
inputData.staticLightmapUV = input.staticLightmapUV;
#else
inputData.vertexSH = input.sh;
#endif
#endif
}
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
half alpha = surfaceDescription.Alpha;
clip(alpha - surfaceDescription.AlphaClipThreshold);
#elif _SURFACE_TYPE_TRANSPARENT
half alpha = surfaceDescription.Alpha;
#else
half alpha = 1;
#endif
InputData inputData;
InitializeInputData(unpacked, surfaceDescription, inputData);
// TODO: Mip debug modes would require this, open question how to do this on ShaderGraph.
//SETUP_DEBUG_TEXTURE_DATA(inputData, unpacked.texCoord1.xy, _MainTex);
#ifdef _SPECULAR_SETUP
float3 specular = surfaceDescription.Specular;
float metallic = 1;
#else
float3 specular = 0;
float metallic = surfaceDescription.Metallic;
#endif
half3 normalTS = half3(0, 0, 0);
#if defined(_NORMALMAP) && defined(_NORMAL_DROPOFF_TS)
normalTS = surfaceDescription.NormalTS;
#endif
SurfaceData surface;
surface.albedo = surfaceDescription.BaseColor;
surface.metallic = saturate(metallic);
surface.specular = specular;
surface.smoothness = saturate(surfaceDescription.Smoothness),
surface.occlusion = surfaceDescription.Occlusion,
surface.emission = surfaceDescription.Emission,
surface.alpha = saturate(alpha);
surface.normalTS = normalTS;
surface.clearCoatMask = 0;
surface.clearCoatSmoothness = 1;
#ifdef _CLEARCOAT
surface.clearCoatMask = saturate(surfaceDescription.CoatMask);
surface.clearCoatSmoothness = saturate(surfaceDescription.CoatSmoothness);
#endif
#ifdef _DBUFFER
ApplyDecalToSurfaceData(unpacked.positionCS, surface, inputData);
#endif
half4 color = UniversalFragmentPBR(inputData, surface);
color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, inputData.fogCoord);
color = Volumetrics(color, inputData.positionWS);
return color;
}

View file

@ -0,0 +1,128 @@
void InitializeInputData(Varyings input, SurfaceDescription surfaceDescription, out InputData inputData)
{
inputData = (InputData)0;
inputData.positionWS = input.positionWS;
#ifdef _NORMALMAP
// IMPORTANT! If we ever support Flip on double sided materials ensure bitangent and tangent are NOT flipped.
float crossSign = (input.tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
float3 bitangent = crossSign * cross(input.normalWS.xyz, input.tangentWS.xyz);
inputData.tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
#if _NORMAL_DROPOFF_TS
inputData.normalWS = TransformTangentToWorld(surfaceDescription.NormalTS, inputData.tangentToWorld);
#elif _NORMAL_DROPOFF_OS
inputData.normalWS = TransformObjectToWorldNormal(surfaceDescription.NormalOS);
#elif _NORMAL_DROPOFF_WS
inputData.normalWS = surfaceDescription.NormalWS;
#endif
#else
inputData.normalWS = input.normalWS;
#endif
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
inputData.viewDirectionWS = SafeNormalize(input.viewDirectionWS);
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
inputData.shadowCoord = input.shadowCoord;
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
#else
inputData.shadowCoord = float4(0, 0, 0, 0);
#endif
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactorAndVertexLight.x);
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
#if defined(DYNAMICLIGHTMAP_ON)
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, input.sh, inputData.normalWS);
#else
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.sh, inputData.normalWS);
#endif
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
#if defined(DEBUG_DISPLAY)
#if defined(DYNAMICLIGHTMAP_ON)
inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
#endif
#if defined(LIGHTMAP_ON)
inputData.staticLightmapUV = input.staticLightmapUV;
#else
inputData.vertexSH = input.sh;
#endif
#endif
}
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(unpacked);
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
#if _ALPHATEST_ON
half alpha = surfaceDescription.Alpha;
clip(alpha - surfaceDescription.AlphaClipThreshold);
#elif _SURFACE_TYPE_TRANSPARENT
half alpha = surfaceDescription.Alpha;
#else
half alpha = 1;
#endif
InputData inputData;
InitializeInputData(unpacked, surfaceDescription, inputData);
// TODO: Mip debug modes would require this, open question how to do this on ShaderGraph.
//SETUP_DEBUG_TEXTURE_DATA(inputData, unpacked.texCoord1.xy, _MainTex);
#ifdef _SPECULAR_SETUP
float3 specular = surfaceDescription.Specular;
float metallic = 1;
#else
float3 specular = 0;
float metallic = surfaceDescription.Metallic;
#endif
half3 normalTS = half3(0, 0, 0);
#if defined(_NORMALMAP) && defined(_NORMAL_DROPOFF_TS)
normalTS = surfaceDescription.NormalTS;
#endif
SurfaceData surface;
surface.albedo = surfaceDescription.BaseColor;
surface.metallic = saturate(metallic);
surface.specular = specular;
surface.smoothness = saturate(surfaceDescription.Smoothness),
surface.occlusion = surfaceDescription.Occlusion,
surface.emission = surfaceDescription.Emission,
surface.alpha = saturate(alpha);
surface.normalTS = normalTS;
surface.clearCoatMask = 0;
surface.clearCoatSmoothness = 1;
#ifdef _CLEARCOAT
surface.clearCoatMask = saturate(surfaceDescription.CoatMask);
surface.clearCoatSmoothness = saturate(surfaceDescription.CoatSmoothness);
#endif
#ifdef _DBUFFER
ApplyDecalToSurfaceData(unpacked.positionCS, surface, inputData);
#endif
half4 color = UniversalFragmentPBR(inputData, surface);
color.rgb = MixFog(color.rgb, -inputData.viewDirectionWS, inputData.fogCoord);
color = Volumetrics(color, inputData.positionWS);
return color;
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a4964e37efb972e4287d896d84f181d4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2774e65a956f7428a9ba09fe1098e1eb
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,114 @@
void InitializeInputData(Varyings input, SurfaceDescription surfaceDescription, out InputData inputData)
{
inputData = (InputData)0;
inputData.positionWS = input.positionWS;
inputData.positionCS = input.positionCS;
#ifdef _NORMALMAP
// IMPORTANT! If we ever support Flip on double sided materials ensure bitangent and tangent are NOT flipped.
float crossSign = (input.tangentWS.w > 0.0 ? 1.0 : -1.0) * GetOddNegativeScale();
float3 bitangent = crossSign * cross(input.normalWS.xyz, input.tangentWS.xyz);
inputData.tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWS.xyz);
#if _NORMAL_DROPOFF_TS
inputData.normalWS = TransformTangentToWorld(surfaceDescription.NormalTS, inputData.tangentToWorld);
#elif _NORMAL_DROPOFF_OS
inputData.normalWS = TransformObjectToWorldNormal(surfaceDescription.NormalOS);
#elif _NORMAL_DROPOFF_WS
inputData.normalWS = surfaceDescription.NormalWS;
#endif
#else
inputData.normalWS = input.normalWS;
#endif
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
inputData.viewDirectionWS = SafeNormalize(input.viewDirectionWS);
#if defined(MAIN_LIGHT_CALCULATE_SHADOWS)
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
#else
inputData.shadowCoord = float4(0, 0, 0, 0);
#endif
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactorAndVertexLight.x);
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
#if defined(DYNAMICLIGHTMAP_ON)
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, input.sh, inputData.normalWS);
#else
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.sh, inputData.normalWS);
#endif
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
#if defined(DEBUG_DISPLAY)
#if defined(DYNAMICLIGHTMAP_ON)
inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
#endif
#if defined(LIGHTMAP_ON)
inputData.staticLightmapUV = input.staticLightmapUV;
#else
inputData.vertexSH = input.sh;
#endif
#endif
}
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
FragmentOutput frag(PackedVaryings packedInput)
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
half alpha = surfaceDescription.Alpha;
clip(alpha - surfaceDescription.AlphaClipThreshold);
#elif _SURFACE_TYPE_TRANSPARENT
half alpha = surfaceDescription.Alpha;
#else
half alpha = 1;
#endif
InputData inputData;
InitializeInputData(unpacked, surfaceDescription, inputData);
// TODO: Mip debug modes would require this, open question how to do this on ShaderGraph.
//SETUP_DEBUG_TEXTURE_DATA(inputData, unpacked.uv, _MainTex);
#ifdef _SPECULAR_SETUP
float3 specular = surfaceDescription.Specular;
float metallic = 1;
#else
float3 specular = 0;
float metallic = surfaceDescription.Metallic;
#endif
#ifdef _DBUFFER
ApplyDecal(unpacked.positionCS,
surfaceDescription.BaseColor,
specular,
inputData.normalWS,
metallic,
surfaceDescription.Occlusion,
surfaceDescription.Smoothness);
#endif
// in LitForwardPass GlobalIllumination (and temporarily LightingPhysicallyBased) are called inside UniversalFragmentPBR
// in Deferred rendering we store the sum of these values (and of emission as well) in the GBuffer
BRDFData brdfData;
InitializeBRDFData(surfaceDescription.BaseColor, metallic, specular, surfaceDescription.Smoothness, 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, surfaceDescription.Occlusion, inputData.positionWS, inputData.normalWS, inputData.viewDirectionWS);
return BRDFDataToGbuffer(brdfData, inputData, surfaceDescription.Smoothness, surfaceDescription.Emission + color, surfaceDescription.Occlusion);
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f562fc45f8fc5434a96065e20892eff9
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,40 @@
#ifndef SG_SELECTION_PICKING_PASS_INCLUDED
#define SG_SELECTION_PICKING_PASS_INCLUDED
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
// This isn't defined in the sprite passes. It looks like the built-in legacy shader will use this as it's default constant
float alphaClipThreshold = 0.01f;
#if ALPHA_CLIP_THRESHOLD
alphaClipThreshold = surfaceDescription.AlphaClipThreshold;
#endif
clip(surfaceDescription.Alpha - alphaClipThreshold);
#endif
half4 outColor = 0;
#ifdef SCENESELECTIONPASS
// We use depth prepass for scene selection in the editor, this code allow to output the outline correctly
outColor = half4(_ObjectId, _PassValue, 1.0, 1.0);
#elif defined(SCENEPICKINGPASS)
outColor = _SelectionID;
#endif
return outColor;
}
#endif

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3d28e6c5572c3d8479d70ecfdc954692
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,26 @@
#ifndef UNIVERSAL_SHADERPASS_INCLUDED
#define UNIVERSAL_SHADERPASS_INCLUDED
#define SHADERPASS_FORWARD (0)
#define SHADERPASS_GBUFFER (1)
#define SHADERPASS_DEPTHONLY (2)
#define SHADERPASS_SHADOWCASTER (3)
#define SHADERPASS_META (4)
#define SHADERPASS_2D (5)
#define SHADERPASS_UNLIT (6)
#define SHADERPASS_SPRITELIT (7)
#define SHADERPASS_SPRITENORMAL (8)
#define SHADERPASS_SPRITEFORWARD (9)
#define SHADERPASS_SPRITEUNLIT (10)
#define SHADERPASS_DEPTHNORMALSONLY (11)
#define SHADERPASS_DBUFFER_PROJECTOR (12)
#define SHADERPASS_DBUFFER_MESH (13)
#define SHADERPASS_FORWARD_EMISSIVE_PROJECTOR (14)
#define SHADERPASS_FORWARD_EMISSIVE_MESH (15)
#define SHADERPASS_FORWARD_PREVIEW (16)
#define SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR (17)
#define SHADERPASS_DECAL_SCREEN_SPACE_MESH (18)
#define SHADERPASS_DECAL_GBUFFER_PROJECTOR (19)
#define SHADERPASS_DECAL_GBUFFER_MESH (20)
#define SHADERPASS_DEPTHNORMALS (21)
#endif

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ba78d2682f9fed14fb0827a24fb5a1f0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,326 @@
#if (SHADERPASS != SHADERPASS_DEPTHONLY) && (SHADERPASS != SHADERPASS_DBUFFER_PROJECTOR) && (SHADERPASS != SHADERPASS_DBUFFER_MESH) && (SHADERPASS != SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) && (SHADERPASS != SHADERPASS_FORWARD_EMISSIVE_MESH) && (SHADERPASS != SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) && (SHADERPASS != SHADERPASS_DECAL_SCREEN_SPACE_MESH) && (SHADERPASS != SHADERPASS_DECAL_GBUFFER_PROJECTOR) && (SHADERPASS != SHADERPASS_DECAL_GBUFFER_MESH)
#error SHADERPASS_is_not_correctly_define
#endif
#if !defined(SHADERPASS)
#error SHADERPASS_is_not_define
#endif
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
#define DECAL_PROJECTOR
#endif
#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
#define DECAL_MESH
#endif
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH)
#define DECAL_DBUFFER
#endif
#if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH)
#define DECAL_SCREEN_SPACE
#endif
#if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
#define DECAL_GBUFFER
#endif
#if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH)
#define DECAL_FORWARD_EMISSIVE
#endif
#if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER))
#define DECAL_RECONSTRUCT_NORMAL
#elif defined(DECAL_ANGLE_FADE)
#define DECAL_LOAD_NORMAL
#endif
#if defined(DECAL_LOAD_NORMAL)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
#endif
#if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
#endif
#ifdef DECAL_MESH
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl"
#endif
#ifdef DECAL_RECONSTRUCT_NORMAL
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl"
#endif
void MeshDecalsPositionZBias(inout Varyings input)
{
#if UNITY_REVERSED_Z
input.positionCS.z -= _DecalMeshDepthBias;
#else
input.positionCS.z += _DecalMeshDepthBias;
#endif
}
void InitializeInputData(Varyings input, float3 positionWS, half3 normalWS, half3 viewDirectionWS, out InputData inputData)
{
inputData = (InputData)0;
inputData.positionWS = positionWS;
inputData.normalWS = normalWS;
inputData.viewDirectionWS = viewDirectionWS;
#if defined(VARYINGS_NEED_SHADOW_COORD) && defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
inputData.shadowCoord = input.shadowCoord;
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
inputData.shadowCoord = TransformWorldToShadowCoord(positionWS);
#else
inputData.shadowCoord = float4(0, 0, 0, 0);
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
inputData.fogCoord = half(input.fogFactorAndVertexLight.x);
inputData.vertexLighting = half3(input.fogFactorAndVertexLight.yzw);
#endif
#if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON)
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS);
#elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV)
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS);
#endif
#if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV)
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
#endif
#if defined(DEBUG_DISPLAY)
#if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON)
inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
#endif
#if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV) && defined(LIGHTMAP_ON)
inputData.staticLightmapUV = input.staticLightmapUV;
#elif defined(VARYINGS_NEED_SH)
inputData.vertexSH = input.sh;
#endif
#endif
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
}
void GetSurface(DecalSurfaceData decalSurfaceData, inout SurfaceData surfaceData)
{
surfaceData.albedo = decalSurfaceData.baseColor.rgb;
surfaceData.metallic = saturate(decalSurfaceData.metallic);
surfaceData.specular = 0;
surfaceData.smoothness = saturate(decalSurfaceData.smoothness);
surfaceData.occlusion = decalSurfaceData.occlusion;
surfaceData.emission = decalSurfaceData.emissive;
surfaceData.alpha = saturate(decalSurfaceData.baseColor.w);
surfaceData.clearCoatMask = 0;
surfaceData.clearCoatSmoothness = 1;
}
PackedVaryings Vert(Attributes inputMesh)
{
Varyings output = (Varyings)0;
#ifdef DECAL_MESH
if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_VIEW_BIAS) // TODO: Check performance of branch
{
float3 viewDirectionOS = GetObjectSpaceNormalizeViewDir(inputMesh.positionOS);
inputMesh.positionOS += viewDirectionOS * (_DecalMeshViewBias);
}
output = BuildVaryings(inputMesh);
if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_DEPTH_BIAS) // TODO: Check performance of branch
{
MeshDecalsPositionZBias(output);
}
#else
output = BuildVaryings(inputMesh);
#endif
#if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV)
OUTPUT_LIGHTMAP_UV(inputMesh.uv1, unity_LightmapST, output.staticLightmapUV);
#endif
#if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON)
output.dynamicLightmapUV.xy = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
#endif
#if defined(VARYINGS_NEED_SH) && !defined(LIGHTMAP_ON)
output.sh = float3(SampleSHVertex(half3(output.normalWS)));
#endif
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
void Frag(PackedVaryings packedInput,
#if defined(DECAL_DBUFFER)
OUTPUT_DBUFFER(outDBuffer)
#elif defined(DECAL_SCREEN_SPACE)
out half4 outColor : SV_Target0
#elif defined(DECAL_GBUFFER)
out FragmentOutput fragmentOutput
#elif defined(DECAL_FORWARD_EMISSIVE)
out half4 outEmissive : SV_Target0
#elif defined(SCENEPICKINGPASS)
out float4 outColor : SV_Target0
#else
#error SHADERPASS_is_not_correctly_define
#endif
)
{
#ifdef SCENEPICKINGPASS
outColor = _SelectionID;
#else
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
UNITY_SETUP_INSTANCE_ID(packedInput);
Varyings input = UnpackVaryings(packedInput);
half angleFadeFactor = 1.0;
#if defined(DECAL_PROJECTOR)
#if UNITY_REVERSED_Z
float depth = LoadSceneDepth(input.positionCS.xy);
#else
// Adjust z to match NDC for OpenGL
float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(input.positionCS.xy));
#endif
#endif
#if defined(DECAL_RECONSTRUCT_NORMAL)
#if defined(_DECAL_NORMAL_BLEND_HIGH)
half3 normalWS = half3(ReconstructNormalTap9(input.positionCS.xy));
#elif defined(_DECAL_NORMAL_BLEND_MEDIUM)
half3 normalWS = half3(ReconstructNormalTap5(input.positionCS.xy));
#else
half3 normalWS = half3(ReconstructNormalDerivative(input.positionCS.xy));
#endif
#elif defined(DECAL_LOAD_NORMAL)
half3 normalWS = half3(LoadSceneNormals(input.positionCS.xy));
#endif
float2 positionSS = input.positionCS.xy * _ScreenSize.zw;
#ifdef DECAL_PROJECTOR
float3 positionWS = ComputeWorldSpacePosition(positionSS, depth, UNITY_MATRIX_I_VP);
#ifdef VARYINGS_NEED_POSITION_WS
input.positionWS = positionWS;
#endif
// Transform from relative world space to decal space (DS) to clip the decal
float3 positionDS = TransformWorldToObject(positionWS);
positionDS = positionDS * float3(1.0, -1.0, 1.0);
// call clip as early as possible
float clipValue = 0.5 - Max3(abs(positionDS).x, abs(positionDS).y, abs(positionDS).z);
clip(clipValue);
float2 texCoord = positionDS.xz + float2(0.5, 0.5);
#ifdef VARYINGS_NEED_TEXCOORD0
input.texCoord0.xy = texCoord;
#endif
#ifdef VARYINGS_NEED_TEXCOORD1
input.texCoord1.xy = texCoord;
#endif
#ifdef VARYINGS_NEED_TEXCOORD2
input.texCoord2.xy = texCoord;
#endif
#ifdef VARYINGS_NEED_TEXCOORD3
input.texCoord3.xy = texCoord;
#endif
#ifdef DECAL_ANGLE_FADE
// Check if this decal projector require angle fading
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
half2 angleFade = half2(normalToWorld[1][3], normalToWorld[2][3]);
if (angleFade.y < 0.0f) // if angle fade is enabled
{
half3 decalNormal = half3(normalToWorld[0].z, normalToWorld[1].z, normalToWorld[2].z);
half dotAngle = dot(normalWS, decalNormal);
// See equation in DecalCreateDrawCallSystem.cs - simplified to a madd mul add here
angleFadeFactor = saturate(angleFade.x + angleFade.y * (dotAngle * (dotAngle - 2.0)));
}
#endif
#else // Decal mesh
float3 positionWS = input.positionWS.xyz;
#endif
#ifdef VARYINGS_NEED_VIEWDIRECTION_WS
half3 viewDirectionWS = half3(input.viewDirectionWS);
#else
// Unused
half3 viewDirectionWS = half3(1.0, 1.0, 1.0); // Avoid the division by 0
#endif
DecalSurfaceData surfaceData;
GetSurfaceData(input, viewDirectionWS, (uint2)positionSS, angleFadeFactor, surfaceData);
#if defined(DECAL_DBUFFER)
ENCODE_INTO_DBUFFER(surfaceData, outDBuffer);
#elif defined(DECAL_SCREEN_SPACE)
// Blend normal with background
#ifdef DECAL_RECONSTRUCT_NORMAL
surfaceData.normalWS.xyz = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w));
#endif
InputData inputData;
InitializeInputData(input, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData);
SurfaceData surface = (SurfaceData)0;
GetSurface(surfaceData, surface);
half4 color = UniversalFragmentPBR(inputData, surface);
color.rgb = MixFog(color.rgb, inputData.fogCoord);
outColor = color;
#elif defined(DECAL_GBUFFER)
InputData inputData;
InitializeInputData(input, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData);
SurfaceData surface = (SurfaceData)0;
GetSurface(surfaceData, surface);
BRDFData brdfData;
InitializeBRDFData(surface.albedo, surface.metallic, 0, surface.smoothness, surface.alpha, brdfData);
// Skip GI if there is no abledo
#ifdef _MATERIAL_AFFECTS_ALBEDO
// GI needs blended normal
#ifdef DECAL_RECONSTRUCT_NORMAL
half3 normalGI = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w));
#endif
Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);
MixRealtimeAndBakedGI(mainLight, normalGI, inputData.bakedGI, inputData.shadowMask);
half3 color = GlobalIllumination(brdfData, inputData.bakedGI, surface.occlusion, normalGI, inputData.viewDirectionWS);
#else
half3 color = 0;
#endif
// We can not use usual GBuffer functions (etc. BRDFDataToGbuffer) as we use alpha for blending
half3 packedNormalWS = PackNormal(surfaceData.normalWS.xyz);
fragmentOutput.GBuffer0 = half4(surfaceData.baseColor.rgb, surfaceData.baseColor.a);
fragmentOutput.GBuffer1 = 0;
fragmentOutput.GBuffer2 = half4(packedNormalWS, surfaceData.normalWS.a);
fragmentOutput.GBuffer3 = half4(surfaceData.emissive + color, surfaceData.baseColor.a);
#if OUTPUT_SHADOWMASK
fragmentOutput.GBuffer4 = inputData.shadowMask; // will have unity_ProbesOcclusion value if subtractive lighting is used (baked)
#endif
#elif defined(DECAL_FORWARD_EMISSIVE)
// Emissive need to be pre-exposed
outEmissive.rgb = surfaceData.emissive;// *GetCurrentExposureMultiplier();
outEmissive.a = surfaceData.baseColor.a;
#else
#endif
#endif
}

View file

@ -0,0 +1,326 @@
#if (SHADERPASS != SHADERPASS_DEPTHONLY) && (SHADERPASS != SHADERPASS_DBUFFER_PROJECTOR) && (SHADERPASS != SHADERPASS_DBUFFER_MESH) && (SHADERPASS != SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) && (SHADERPASS != SHADERPASS_FORWARD_EMISSIVE_MESH) && (SHADERPASS != SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) && (SHADERPASS != SHADERPASS_DECAL_SCREEN_SPACE_MESH) && (SHADERPASS != SHADERPASS_DECAL_GBUFFER_PROJECTOR) && (SHADERPASS != SHADERPASS_DECAL_GBUFFER_MESH)
#error SHADERPASS_is_not_correctly_define
#endif
#if !defined(SHADERPASS)
#error SHADERPASS_is_not_define
#endif
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR)
#define DECAL_PROJECTOR
#endif
#if (SHADERPASS == SHADERPASS_DBUFFER_MESH) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
#define DECAL_MESH
#endif
#if (SHADERPASS == SHADERPASS_DBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DBUFFER_MESH)
#define DECAL_DBUFFER
#endif
#if (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_SCREEN_SPACE_MESH)
#define DECAL_SCREEN_SPACE
#endif
#if (SHADERPASS == SHADERPASS_DECAL_GBUFFER_PROJECTOR) || (SHADERPASS == SHADERPASS_DECAL_GBUFFER_MESH)
#define DECAL_GBUFFER
#endif
#if (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_PROJECTOR) || (SHADERPASS == SHADERPASS_FORWARD_EMISSIVE_MESH)
#define DECAL_FORWARD_EMISSIVE
#endif
#if ((!defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_ALBEDO)) || (defined(_MATERIAL_AFFECTS_NORMAL) && defined(_MATERIAL_AFFECTS_NORMAL_BLEND))) && (defined(DECAL_SCREEN_SPACE) || defined(DECAL_GBUFFER))
#define DECAL_RECONSTRUCT_NORMAL
#elif defined(DECAL_ANGLE_FADE)
#define DECAL_LOAD_NORMAL
#endif
#if defined(DECAL_LOAD_NORMAL)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
#endif
#if defined(DECAL_PROJECTOR) || defined(DECAL_RECONSTRUCT_NORMAL)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
#endif
#ifdef DECAL_MESH
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/DecalMeshBiasTypeEnum.cs.hlsl"
#endif
#ifdef DECAL_RECONSTRUCT_NORMAL
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl"
#endif
void MeshDecalsPositionZBias(inout Varyings input)
{
#if UNITY_REVERSED_Z
input.positionCS.z -= _DecalMeshDepthBias;
#else
input.positionCS.z += _DecalMeshDepthBias;
#endif
}
void InitializeInputData(Varyings input, float3 positionWS, half3 normalWS, half3 viewDirectionWS, out InputData inputData)
{
inputData = (InputData)0;
inputData.positionWS = positionWS;
inputData.normalWS = normalWS;
inputData.viewDirectionWS = viewDirectionWS;
#if defined(VARYINGS_NEED_SHADOW_COORD) && defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
inputData.shadowCoord = input.shadowCoord;
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
inputData.shadowCoord = TransformWorldToShadowCoord(positionWS);
#else
inputData.shadowCoord = float4(0, 0, 0, 0);
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
inputData.fogCoord = half(input.fogFactorAndVertexLight.x);
inputData.vertexLighting = half3(input.fogFactorAndVertexLight.yzw);
#endif
#if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON)
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV.xy, half3(input.sh), normalWS);
#elif defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV)
inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, half3(input.sh), normalWS);
#endif
#if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV)
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
#endif
#if defined(DEBUG_DISPLAY)
#if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON)
inputData.dynamicLightmapUV = input.dynamicLightmapUV.xy;
#endif
#if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV && LIGHTMAP_ON)
inputData.staticLightmapUV = input.staticLightmapUV;
#elif defined(VARYINGS_NEED_SH)
inputData.vertexSH = input.sh;
#endif
#endif
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
}
void GetSurface(DecalSurfaceData decalSurfaceData, inout SurfaceData surfaceData)
{
surfaceData.albedo = decalSurfaceData.baseColor.rgb;
surfaceData.metallic = saturate(decalSurfaceData.metallic);
surfaceData.specular = 0;
surfaceData.smoothness = saturate(decalSurfaceData.smoothness);
surfaceData.occlusion = decalSurfaceData.occlusion;
surfaceData.emission = decalSurfaceData.emissive;
surfaceData.alpha = saturate(decalSurfaceData.baseColor.w);
surfaceData.clearCoatMask = 0;
surfaceData.clearCoatSmoothness = 1;
}
PackedVaryings Vert(Attributes inputMesh)
{
Varyings output = (Varyings)0;
#ifdef DECAL_MESH
if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_VIEW_BIAS) // TODO: Check performance of branch
{
float3 viewDirectionOS = GetObjectSpaceNormalizeViewDir(inputMesh.positionOS);
inputMesh.positionOS += viewDirectionOS * (_DecalMeshViewBias);
}
output = BuildVaryings(inputMesh);
if (_DecalMeshBiasType == DECALMESHDEPTHBIASTYPE_DEPTH_BIAS) // TODO: Check performance of branch
{
MeshDecalsPositionZBias(output);
}
#else
output = BuildVaryings(inputMesh);
#endif
#if defined(VARYINGS_NEED_STATIC_LIGHTMAP_UV)
OUTPUT_LIGHTMAP_UV(inputMesh.uv1, unity_LightmapST, output.staticLightmapUV);
#endif
#if defined(VARYINGS_NEED_DYNAMIC_LIGHTMAP_UV) && defined(DYNAMICLIGHTMAP_ON)
output.dynamicLightmapUV.xy = inputMesh.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
#endif
#if defined(VARYINGS_NEED_SH) && !defined(LIGHTMAP_ON)
output.sh = float3(SampleSHVertex(half3(output.normalWS)));
#endif
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
void Frag(PackedVaryings packedInput,
#if defined(DECAL_DBUFFER)
OUTPUT_DBUFFER(outDBuffer)
#elif defined(DECAL_SCREEN_SPACE)
out half4 outColor : SV_Target0
#elif defined(DECAL_GBUFFER)
out FragmentOutput fragmentOutput
#elif defined(DECAL_FORWARD_EMISSIVE)
out half4 outEmissive : SV_Target0
#elif defined(SCENEPICKINGPASS)
out float4 outColor : SV_Target0
#else
#error SHADERPASS_is_not_correctly_define
#endif
)
{
#ifdef SCENEPICKINGPASS
outColor = _SelectionID;
#else
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
UNITY_SETUP_INSTANCE_ID(packedInput);
Varyings input = UnpackVaryings(packedInput);
half angleFadeFactor = 1.0;
#if defined(DECAL_PROJECTOR)
#if UNITY_REVERSED_Z
float depth = LoadSceneDepth(input.positionCS.xy);
#else
// Adjust z to match NDC for OpenGL
float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(input.positionCS.xy));
#endif
#endif
#if defined(DECAL_RECONSTRUCT_NORMAL)
#if defined(_DECAL_NORMAL_BLEND_HIGH)
half3 normalWS = half3(ReconstructNormalTap9(input.positionCS.xy));
#elif defined(_DECAL_NORMAL_BLEND_MEDIUM)
half3 normalWS = half3(ReconstructNormalTap5(input.positionCS.xy));
#else
half3 normalWS = half3(ReconstructNormalDerivative(input.positionCS.xy));
#endif
#elif defined(DECAL_LOAD_NORMAL)
half3 normalWS = half3(LoadSceneNormals(input.positionCS.xy));
#endif
float2 positionSS = input.positionCS.xy * _ScreenSize.zw;
#ifdef DECAL_PROJECTOR
float3 positionWS = ComputeWorldSpacePosition(positionSS, depth, UNITY_MATRIX_I_VP);
#ifdef VARYINGS_NEED_POSITION_WS
input.positionWS = positionWS;
#endif
// Transform from relative world space to decal space (DS) to clip the decal
float3 positionDS = TransformWorldToObject(positionWS);
positionDS = positionDS * float3(1.0, -1.0, 1.0);
// call clip as early as possible
float clipValue = 0.5 - Max3(abs(positionDS).x, abs(positionDS).y, abs(positionDS).z);
clip(clipValue);
float2 texCoord = positionDS.xz + float2(0.5, 0.5);
#ifdef VARYINGS_NEED_TEXCOORD0
input.texCoord0.xy = texCoord;
#endif
#ifdef VARYINGS_NEED_TEXCOORD1
input.texCoord1.xy = texCoord;
#endif
#ifdef VARYINGS_NEED_TEXCOORD2
input.texCoord2.xy = texCoord;
#endif
#ifdef VARYINGS_NEED_TEXCOORD3
input.texCoord3.xy = texCoord;
#endif
#ifdef DECAL_ANGLE_FADE
// Check if this decal projector require angle fading
half4x4 normalToWorld = UNITY_ACCESS_INSTANCED_PROP(Decal, _NormalToWorld);
half2 angleFade = half2(normalToWorld[1][3], normalToWorld[2][3]);
if (angleFade.y < 0.0f) // if angle fade is enabled
{
half3 decalNormal = half3(normalToWorld[0].z, normalToWorld[1].z, normalToWorld[2].z);
half dotAngle = dot(normalWS, decalNormal);
// See equation in DecalCreateDrawCallSystem.cs - simplified to a madd mul add here
angleFadeFactor = saturate(angleFade.x + angleFade.y * (dotAngle * (dotAngle - 2.0)));
}
#endif
#else // Decal mesh
float3 positionWS = input.positionWS.xyz;
#endif
#ifdef VARYINGS_NEED_VIEWDIRECTION_WS
half3 viewDirectionWS = half3(input.viewDirectionWS);
#else
// Unused
half3 viewDirectionWS = half3(1.0, 1.0, 1.0); // Avoid the division by 0
#endif
DecalSurfaceData surfaceData;
GetSurfaceData(input, viewDirectionWS, (uint2)positionSS, angleFadeFactor, surfaceData);
#if defined(DECAL_DBUFFER)
ENCODE_INTO_DBUFFER(surfaceData, outDBuffer);
#elif defined(DECAL_SCREEN_SPACE)
// Blend normal with background
#ifdef DECAL_RECONSTRUCT_NORMAL
surfaceData.normalWS.xyz = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w));
#endif
InputData inputData;
InitializeInputData(input, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData);
SurfaceData surface = (SurfaceData)0;
GetSurface(surfaceData, surface);
half4 color = UniversalFragmentPBR(inputData, surface);
color.rgb = MixFog(color.rgb, inputData.fogCoord);
outColor = color;
#elif defined(DECAL_GBUFFER)
InputData inputData;
InitializeInputData(input, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData);
SurfaceData surface = (SurfaceData)0;
GetSurface(surfaceData, surface);
BRDFData brdfData;
InitializeBRDFData(surface.albedo, surface.metallic, 0, surface.smoothness, surface.alpha, brdfData);
// Skip GI if there is no abledo
#ifdef _MATERIAL_AFFECTS_ALBEDO
// GI needs blended normal
#ifdef DECAL_RECONSTRUCT_NORMAL
half3 normalGI = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w));
#endif
Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask);
MixRealtimeAndBakedGI(mainLight, normalGI, inputData.bakedGI, inputData.shadowMask);
half3 color = GlobalIllumination(brdfData, inputData.bakedGI, surface.occlusion, normalGI, inputData.viewDirectionWS);
#else
half3 color = 0;
#endif
// We can not use usual GBuffer functions (etc. BRDFDataToGbuffer) as we use alpha for blending
half3 packedNormalWS = PackNormal(surfaceData.normalWS.xyz);
fragmentOutput.GBuffer0 = half4(surfaceData.baseColor.rgb, surfaceData.baseColor.a);
fragmentOutput.GBuffer1 = 0;
fragmentOutput.GBuffer2 = half4(packedNormalWS, surfaceData.normalWS.a);
fragmentOutput.GBuffer3 = half4(surfaceData.emissive + color, surfaceData.baseColor.a);
#if OUTPUT_SHADOWMASK
fragmentOutput.GBuffer4 = inputData.shadowMask; // will have unity_ProbesOcclusion value if subtractive lighting is used (baked)
#endif
#elif defined(DECAL_FORWARD_EMISSIVE)
// Emissive need to be pre-exposed
outEmissive.rgb = surfaceData.emissive;// *GetCurrentExposureMultiplier();
outEmissive.a = surfaceData.baseColor.a;
#else
#endif
#endif
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bfb1cbc23684000429f5a4632f7012b4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 131f64991fbd3cb4286f7fbc05dcf29e
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,3 @@
UNITY_INSTANCING_BUFFER_START(Decal)
UNITY_DEFINE_INSTANCED_PROP(half4x4, _NormalToWorld)
UNITY_INSTANCING_BUFFER_END(Decal)

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: aa80e1eae2080d849a7ab1ccfbd6953c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,26 @@
#ifndef SG_SHADOW_PASS_INCLUDED
#define SG_SHADOW_PASS_INCLUDED
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = (PackedVaryings)0;
packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
clip(surfaceDescription.Alpha - surfaceDescription.AlphaClipThreshold);
#endif
return 0;
}
#endif

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3beb91c1958c67d47bb580c465e22f29
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,62 @@
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Unlit.hlsl"
void InitializeInputData(Varyings input, out InputData inputData)
{
inputData = (InputData)0;
// InputData is only used for DebugDisplay purposes in Unlit, so these are not initialized.
#if defined(DEBUG_DISPLAY)
inputData.positionWS = input.positionWS;
inputData.normalWS = input.normalWS;
inputData.viewDirectionWS = input.viewDirectionWS;
#else
inputData.positionWS = half3(0, 0, 0);
inputData.normalWS = half3(0, 0, 1);
inputData.viewDirectionWS = half3(0, 0, 1);
#endif
inputData.shadowCoord = 0;
inputData.fogCoord = 0;
inputData.vertexLighting = half3(0, 0, 0);
inputData.bakedGI = half3(0, 0, 0);
inputData.normalizedScreenSpaceUV = 0;
inputData.shadowMask = half4(1, 1, 1, 1);
}
PackedVaryings vert(Attributes input)
{
Varyings output = (Varyings)0;
output = BuildVaryings(input);
PackedVaryings packedOutput = PackVaryings(output);
return packedOutput;
}
half4 frag(PackedVaryings packedInput) : SV_TARGET
{
Varyings unpacked = UnpackVaryings(packedInput);
UNITY_SETUP_INSTANCE_ID(unpacked);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(unpacked);
SurfaceDescription surfaceDescription = BuildSurfaceDescription(unpacked);
#if _ALPHATEST_ON
half alpha = surfaceDescription.Alpha;
clip(alpha - surfaceDescription.AlphaClipThreshold);
#elif _SURFACE_TYPE_TRANSPARENT
half alpha = surfaceDescription.Alpha;
#else
half alpha = 1;
#endif
#if defined(_DBUFFER)
ApplyDecalToBaseColor(unpacked.positionCS, surfaceDescription.BaseColor);
#endif
InputData inputData;
InitializeInputData(unpacked, inputData);
// TODO: Mip debug modes would require this, open question how to do this on ShaderGraph.
//SETUP_DEBUG_TEXTURE_DATA(inputData, input.texCoord1, _MainTex);
half4 finalColor = UniversalFragmentUnlit(inputData, surfaceDescription.BaseColor, alpha);
return finalColor;
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 07da8e9cacb587246ade02755c273666
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,212 @@
#if (SHADERPASS == SHADERPASS_SHADOWCASTER)
// Shadow Casting Light geometric parameters. These variables are used when applying the shadow Normal Bias and are set by UnityEngine.Rendering.Universal.ShadowUtils.SetupShadowCasterConstantBuffer in com.unity.render-pipelines.universal/Runtime/ShadowUtils.cs
// For Directional lights, _LightDirection is used when applying shadow Normal Bias.
// For Spot lights and Point lights, _LightPosition is used to compute the actual light direction because it is different at each shadow caster geometry vertex.
#ifndef HAVE_VFX_MODIFICATION
float3 _LightDirection;
#else
//_LightDirection is already defined in com.unity.render-pipelines.universal\Runtime\VFXGraph\Shaders\VFXCommon.hlsl
#endif
float3 _LightPosition;
#endif
#if defined(FEATURES_GRAPH_VERTEX)
#if defined(HAVE_VFX_MODIFICATION)
VertexDescription BuildVertexDescription(Attributes input, AttributesElement element)
{
GraphProperties properties;
ZERO_INITIALIZE(GraphProperties, properties);
// Fetch the vertex graph properties for the particle instance.
GetElementVertexProperties(element, properties);
// Evaluate Vertex Graph
VertexDescriptionInputs vertexDescriptionInputs = BuildVertexDescriptionInputs(input);
VertexDescription vertexDescription = VertexDescriptionFunction(vertexDescriptionInputs, properties);
return vertexDescription;
}
#else
VertexDescription BuildVertexDescription(Attributes input)
{
// Evaluate Vertex Graph
VertexDescriptionInputs vertexDescriptionInputs = BuildVertexDescriptionInputs(input);
VertexDescription vertexDescription = VertexDescriptionFunction(vertexDescriptionInputs);
return vertexDescription;
}
#endif
#endif
Varyings BuildVaryings(Attributes input)
{
Varyings output = (Varyings)0;
#if defined(HAVE_VFX_MODIFICATION)
AttributesElement element;
ZERO_INITIALIZE(AttributesElement, element);
if (!GetMeshAndElementIndex(input, element))
return output; // Culled index.
if (!GetInterpolatorAndElementData(output, element))
return output; // Dead particle.
SetupVFXMatrices(element, output);
#endif
UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
#if defined(FEATURES_GRAPH_VERTEX)
#if defined(HAVE_VFX_MODIFICATION)
VertexDescription vertexDescription = BuildVertexDescription(input, element);
#else
VertexDescription vertexDescription = BuildVertexDescription(input);
#endif
#if defined(CUSTOMINTERPOLATOR_VARYPASSTHROUGH_FUNC)
CustomInterpolatorPassThroughFunc(output, vertexDescription);
#endif
// Assign modified vertex attributes
input.positionOS = vertexDescription.Position;
#if defined(VARYINGS_NEED_NORMAL_WS)
input.normalOS = vertexDescription.Normal;
#endif //FEATURES_GRAPH_NORMAL
#if defined(VARYINGS_NEED_TANGENT_WS)
input.tangentOS.xyz = vertexDescription.Tangent.xyz;
#endif //FEATURES GRAPH TANGENT
#endif //FEATURES_GRAPH_VERTEX
// TODO: Avoid path via VertexPositionInputs (Universal)
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
// Returns the camera relative position (if enabled)
float3 positionWS = TransformObjectToWorld(input.positionOS);
#ifdef ATTRIBUTES_NEED_NORMAL
float3 normalWS = TransformObjectToWorldNormal(input.normalOS);
#else
// Required to compile ApplyVertexModification that doesn't use normal.
float3 normalWS = float3(0.0, 0.0, 0.0);
#endif
#ifdef ATTRIBUTES_NEED_TANGENT
float4 tangentWS = float4(TransformObjectToWorldDir(input.tangentOS.xyz), input.tangentOS.w);
#endif
// TODO: Change to inline ifdef
// Do vertex modification in camera relative space (if enabled)
#if defined(HAVE_VERTEX_MODIFICATION)
ApplyVertexModification(input, normalWS, positionWS, _TimeParameters.xyz);
#endif
#ifdef VARYINGS_NEED_POSITION_WS
output.positionWS = positionWS;
#endif
#ifdef VARYINGS_NEED_NORMAL_WS
output.normalWS = normalWS; // normalized in TransformObjectToWorldNormal()
#endif
#ifdef VARYINGS_NEED_TANGENT_WS
output.tangentWS = tangentWS; // normalized in TransformObjectToWorldDir()
#endif
#if (SHADERPASS == SHADERPASS_SHADOWCASTER)
// Define shadow pass specific clip position for Universal
#if _CASTING_PUNCTUAL_LIGHT_SHADOW
float3 lightDirectionWS = normalize(_LightPosition - positionWS);
#else
float3 lightDirectionWS = _LightDirection;
#endif
//output.positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS));
output.positionCS = ApplySLZShadowBias(positionWS, normalWS, lightDirectionWS);
#if UNITY_REVERSED_Z
output.positionCS.z = min(output.positionCS.z, UNITY_NEAR_CLIP_VALUE);
#else
output.positionCS.z = max(output.positionCS.z, UNITY_NEAR_CLIP_VALUE);
#endif
#elif (SHADERPASS == SHADERPASS_META)
output.positionCS = UnityMetaVertexPosition(input.positionOS, input.uv1, input.uv2, unity_LightmapST, unity_DynamicLightmapST);
#else
output.positionCS = TransformWorldToHClip(positionWS);
#endif
#if defined(VARYINGS_NEED_TEXCOORD0) || defined(VARYINGS_DS_NEED_TEXCOORD0)
output.texCoord0 = input.uv0;
#endif
#ifdef EDITOR_VISUALIZATION
float2 VizUV = 0;
float4 LightCoord = 0;
UnityEditorVizData(input.positionOS, input.uv0, input.uv1, input.uv2, VizUV, LightCoord);
#endif
#if defined(VARYINGS_NEED_TEXCOORD1) || defined(VARYINGS_DS_NEED_TEXCOORD1)
#ifdef EDITOR_VISUALIZATION
output.texCoord1 = float4(VizUV, 0, 0);
#else
output.texCoord1 = input.uv1;
#endif
#endif
#if defined(VARYINGS_NEED_TEXCOORD2) || defined(VARYINGS_DS_NEED_TEXCOORD2)
#ifdef EDITOR_VISUALIZATION
output.texCoord2 = LightCoord;
#else
output.texCoord2 = input.uv2;
#endif
#endif
#if defined(VARYINGS_NEED_TEXCOORD3) || defined(VARYINGS_DS_NEED_TEXCOORD3)
output.texCoord3 = input.uv3;
#endif
#if defined(VARYINGS_NEED_COLOR) || defined(VARYINGS_DS_NEED_COLOR)
output.color = input.color;
#endif
#ifdef VARYINGS_NEED_VIEWDIRECTION_WS
// Need the unnormalized direction here as otherwise interpolation is incorrect.
// It is normalized after interpolation in the fragment shader.
output.viewDirectionWS = GetWorldSpaceViewDir(positionWS);
#endif
#ifdef VARYINGS_NEED_SCREENPOSITION
output.screenPosition = vertexInput.positionNDC;
#endif
#if (SHADERPASS == SHADERPASS_FORWARD) || (SHADERPASS == SHADERPASS_GBUFFER)
OUTPUT_LIGHTMAP_UV(input.uv1, unity_LightmapST, output.staticLightmapUV);
#if defined(DYNAMICLIGHTMAP_ON)
output.dynamicLightmapUV.xy = input.uv2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
#endif
OUTPUT_SH(normalWS, output.sh);
#endif
#ifdef VARYINGS_NEED_FOG_AND_VERTEX_LIGHT
half fogFactor = 0;
#if !defined(_FOG_FRAGMENT)
fogFactor = ComputeFogFactor(output.positionCS.z);
#endif
half3 vertexLight = VertexLighting(positionWS, normalWS);
output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
#endif
#if defined(VARYINGS_NEED_SHADOW_COORD) && defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
output.shadowCoord = GetShadowCoord(vertexInput);
#endif
return output;
}
SurfaceDescription BuildSurfaceDescription(Varyings varyings)
{
SurfaceDescriptionInputs surfaceDescriptionInputs = BuildSurfaceDescriptionInputs(varyings);
#if defined(HAVE_VFX_MODIFICATION)
GraphProperties properties;
ZERO_INITIALIZE(GraphProperties, properties);
GetElementPixelProperties(surfaceDescriptionInputs, properties);
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs, properties);
#else
SurfaceDescription surfaceDescription = SurfaceDescriptionFunction(surfaceDescriptionInputs);
#endif
return surfaceDescription;
}

View file

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2085a40153652db43a116297c1924476
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: