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,35 @@
#define SHADERPASS SHADERPASS_RAYTRACE
#include "UnityRaytracingMeshUtils.cginc"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#pragma raytracing BakeHit
struct RayPayload
{
float4 color;
float3 dir;
};
struct AttributeData
{
float2 barycentrics;
};
struct Vertex
{
float2 texcoord;
float3 normal;
};
//https://coty.tips/raytracing-in-unity/
[shader("closesthit")]
void MyClosestHit(inout RayPayload payload, AttributeData attributes : SV_IntersectionAttributes) {
payload.color = float4(0,0,0,1); //Intializing
payload.dir = float3(1,0,0);
}

View file

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

View file

@ -0,0 +1,59 @@
#define SHADERPASS SHADERPASS_DEPTHNORMALS
#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/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/EncodeNormalsTexture.hlsl"
struct appdata
{
float4 vertex : POSITION;
half3 normal : NORMAL;
// half4 tangent : TANGENT;
//float3 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
//float2 uv : TEXCOORD0;
half3 normalWS : NORMAL;
//half3 tangentWS : TANGENT;
//half3 bitangentWS : BITANGENT;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
CBUFFER_START(UnityPerMaterial)
float4 _BaseMap_ST;
CBUFFER_END
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
//o.uv = mad(v.uv.xy, _BaseMap_ST.xy, _BaseMap_ST.zw);
o.vertex = TransformObjectToHClip(v.vertex.xyz);
//VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.normalWS = TransformObjectToWorldNormal(v.normal);
//o.tangentWS = ntb.tangentWS;
//o.bitangentWS = ntb.bitangentWS;
return o;
}
/* Just set object normals for now, reading normal map in depth-normals prepass is expensive*/
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half3 normals = NormalizeNormalPerPixel(i.normalWS);
normals = EncodeWSNormalForNormalsTex(normals);
return half4(normals, 0.0);
}

View file

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

View file

@ -0,0 +1,40 @@
#define SHADERPASS SHADERPASS_DEPTHONLY
#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/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = TransformObjectToHClip(v.vertex.xyz);
return o;
}
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
return 0;
}

View file

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

View file

@ -0,0 +1,438 @@
#define SHADERPASS SHADERPASS_FORWARD
#define _NORMAL_DROPOFF_TS 1
#define _EMISSION
#define _NORMALMAP 1
#if defined(SHADER_API_MOBILE)
#define _ADDITIONAL_LIGHTS_VERTEX
#else
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
#pragma shader_feature_fragment _ADDITIONAL_LIGHTS
#pragma shader_feature_fragment _ADDITIONAL_LIGHT_SHADOWS
#pragma shader_feature_fragment _SHADOWS_SOFT
#pragma shader_feature_fragment _REFLECTION_PROBE_BLENDING
//#pragma shader_feature_fragment _REFLECTION_PROBE_BOX_PROJECTION
// We don't need a keyword for this! the w component of the probe position already branches box vs non-box, & so little cost on pc it doesn't matter
#define _REFLECTION_PROBE_BOX_PROJECTION
#if defined(LITMAS_FEATURE_SSR)
#pragma shader_feature_local_fragment _ _SSR_ON
#endif
#endif
#if defined(LITMAS_FEATURE_TP)
#pragma multi_compile_local_fragment _ _EXPENSIVE_TP
#if defined(_EXPENSIVE_TP)
#define SLZ_SAMPLE_TP_MAIN(tex, sampl, uv) SAMPLE_TEXTURE2D_GRAD(tex, sampl, uv, ddxMain, ddyMain)
#define SLZ_SAMPLE_TP_DETAIL(tex, sampl, uv) SAMPLE_TEXTURE2D_GRAD(tex, sampl, uv, ddxDetail, ddyDetail)
#else
#define SLZ_SAMPLE_TP_MAIN(tex, sampl, uv) SAMPLE_TEXTURE2D(tex, sampl, uv)
#define SLZ_SAMPLE_TP_DETAIL(tex, sampl, uv) SAMPLE_TEXTURE2D(tex, sampl, uv)
#endif
#endif
#pragma multi_compile_fragment _ _LIGHT_COOKIES
#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
#pragma multi_compile_fog
#pragma skip_variants FOG_LINEAR FOG_EXP
//#pragma multi_compile_fragment _ DEBUG_DISPLAY
#pragma multi_compile_fragment _ _DETAILS_ON
//#pragma multi_compile_fragment _ _EMISSION_ON
#if defined(LITMAS_FEATURE_LIGHTMAPPING)
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
#pragma multi_compile _ SHADOWS_SHADOWMASK
#endif
#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"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZLighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl"
#if !defined(SHADER_API_MOBILE) && defined(LITMAS_FEATURE_SSR)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZLightingSSR.hlsl"
#endif
#if defined(LITMAS_FEATURE_TP)
#include "Include/Triplanar.hlsl"
#endif
#if defined(LITMAS_FEATURE_IMPACTS)
#include "LitMASInclude/PosespaceImpacts.hlsl"
#endif
struct VertIn
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float4 uv0 : TEXCOORD0;
float4 uv1 : TEXCOORD1;
float4 uv2 : TEXCOORD2;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertOut
{
float4 vertex : SV_POSITION;
float4 uv0XY_bitZ_fog: TEXCOORD0;
#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
float4 uv1 : TEXCOORD1;
#endif
half4 SHVertLights : TEXCOORD2;
half4 normXYZ_tanX : TEXCOORD3;
#if defined(LITMAS_FEATURE_TS_NORMALS)
half4 tanYZ_bitXY : TEXCOORD4;
#endif
float3 wPos : TEXCOORD5;
#if defined(LITMAS_FEATURE_IMPACTS)
float3 unskinnedObjPos : TEXCOORD6;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
TEXTURE2D(_BumpMap);
TEXTURE2D(_MetallicGlossMap);
TEXTURE2D(_EmissionMap);
TEXTURE2D(_DetailMap);
SAMPLER(sampler_DetailMap);
#if defined(LITMAS_FEATURE_WHITEBOARD)
TEXTURE2D(_PenMap);
#endif
CBUFFER_START(UnityPerMaterial)
float4 _BaseMap_ST;
float4 _DetailMap_ST;
half4 _BaseColor;
half _Details;
half _Normals;
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
#if defined(LITMAS_FEATURE_TP)
half _DetailsuseLocalUVs;
half _RotateUVs;
half _UVScaler;
#endif
#if defined(LITMAS_FEATURE_SSR)
half _SSRSmoothPow;
#endif
#if defined(LITMAS_FEATURE_WHITEBOARD)
float4 _PenMap_ST;
half _PenMono;
half4 _PenMonoColor;
#endif
#if defined(LITMAS_FEATURE_IMPACTS)
float4x4 EllipsoidPosArray[HitArrayCount];
int _NumberOfHits;
float4 _HitColor;
#endif
CBUFFER_END
half3 OverlayBlendDetail(half source, half3 destination)
{
half3 switch0 = round(destination); // if destination >= 0.5 then 1, else 0 assuming 0-1 input
half3 blendGreater = mad(mad(2.0, destination, -2.0), 1.0 - source, 1.0); // (2.0 * destination - 2.0) * ( 1.0 - source) + 1.0
half3 blendLesser = (2.0 * source) * destination;
return mad(switch0, blendGreater, mad(-switch0, blendLesser, blendLesser)); // switch0 * blendGreater + (1 - switch0) * blendLesser
//return half3(destination.r > 0.5 ? blendGreater.r : blendLesser.r,
// destination.g > 0.5 ? blendGreater.g : blendLesser.g,
// destination.b > 0.5 ? blendGreater.b : blendLesser.b
// );
}
VertOut vert(VertIn v)
{
VertOut o = (VertOut)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.wPos = TransformObjectToWorld(v.vertex.xyz);
o.vertex = TransformWorldToHClip(o.wPos);
o.uv0XY_bitZ_fog.xy = v.uv0.xy;
#if defined(LIGHTMAP_ON) || defined(DIRLIGHTMAP_COMBINED)
OUTPUT_LIGHTMAP_UV(v.uv1.xy, unity_LightmapST, o.uv1.xy);
#endif
#ifdef DYNAMICLIGHTMAP_ON
OUTPUT_LIGHTMAP_UV(v.uv2.xy, unity_DynamicLightmapST, o.uv1.zw);
#endif
// Calculate tangent to world basis vectors
#if defined(LITMAS_FEATURE_TS_NORMALS)
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.normXYZ_tanX = half4(ntb.normalWS, ntb.tangentWS.x);
o.tanYZ_bitXY = half4(ntb.tangentWS.yz, ntb.bitangentWS.xy);
o.uv0XY_bitZ_fog.z = ntb.bitangentWS.z;
#else
o.normXYZ_tanX = half4(TransformObjectToWorldNormal(v.normal, false), 0);
o.uv0XY_bitZ_fog.z = v.tangent.w; //Avoid optimization that would remove the tangent from the vertex input (causes issues)
#endif
// Exp2 fog
half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
o.uv0XY_bitZ_fog.w = unity_FogParams.x * clipZ_0Far;
o.SHVertLights = 0;
// Calculate vertex lights and L2 probe lighting on quest
o.SHVertLights.xyz = VertexLighting(o.wPos, o.normXYZ_tanX.xyz);
#if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) && defined(SHADER_API_MOBILE)
o.SHVertLights.xyz += SampleSHVertex(o.normXYZ_tanX.xyz);
#endif
#if defined(LITMAS_FEATURE_IMPACTS)
o.unskinnedObjPos = v.uv2;
#endif
return o;
}
half4 frag(VertOut i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Read Input Data---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
#if defined(LITMAS_FEATURE_TP) /*-Triplanar------------------------------------------------------------------------------*/
float2 uvTP;
half3x3 TStoWsTP;
half2 scale = 1.0/_UVScaler;
#if defined(_EXPENSIVE_TP)
tpDerivatives tpDD;
GetDirectionalDerivatives(i.wPos, tpDD);
half2 ddxTP, ddyTP;
GetTPUVExpensive(uvTP, ddxTP, ddyTP, TStoWsTP, i.wPos, normalize(i.normXYZ_tanX.xyz), tpDD);
ddxTP = _RotateUVs ? half2(-ddxTP.y, ddxTP.x) : ddxTP;
ddyTP = _RotateUVs ? half2(-ddyTP.y, ddyTP.x) : ddyTP;
half2 ddxMain = ddxTP * scale;
half2 ddyMain = ddyTP * scale;
#else
GetTPUVCheap(uvTP, TStoWsTP, i.wPos, normalize(i.normXYZ_tanX.xyz));
#endif
uvTP = _RotateUVs ? float2(-uvTP.y, uvTP.x) : uvTP;
float2 uv_main = mad(uvTP, scale, _BaseMap_ST.zw);
half4 albedo = SLZ_SAMPLE_TP_MAIN(_BaseMap, sampler_BaseMap, uv_main) * _BaseColor;
half3 mas = SLZ_SAMPLE_TP_MAIN(_MetallicGlossMap, sampler_BaseMap, uv_main).rgb;
#else /*-Non-Triplanar---------------------------------------------------------------------------------------------------*/
float2 uv_main = mad(float2(i.uv0XY_bitZ_fog.xy), _BaseMap_ST.xy, _BaseMap_ST.zw);
float2 uv_detail = mad(float2(i.uv0XY_bitZ_fog.xy), _DetailMap_ST.xy, _DetailMap_ST.zw);
half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv_main) * _BaseColor;
half3 mas = SAMPLE_TEXTURE2D(_MetallicGlossMap, sampler_BaseMap, uv_main).rgb;
#endif
#if defined(LITMAS_FEATURE_WHITEBOARD) /*-Whiteboard---------------------------------------------------------------------*/
float2 uv_pen = mad(float2(i.uv0XY_bitZ_fog.xy), _PenMap_ST.xy, _PenMap_ST.zw);
half4 penMap = SAMPLE_TEXTURE2D(_PenMap, sampler_BaseMap, uv_pen);
penMap = _PenMono > 0.5 ? penMap.rrrr : penMap;
penMap.rgb = _PenMono > 0.5 ? penMap.rgb * _PenMonoColor.rgb : penMap.rgb;
albedo.rgb = penMap.rgb + albedo.rgb * (1.0h - penMap.a);
#endif
half metallic = mas.r;
half ao = mas.g;
half smoothness = mas.b;
#if defined(LITMAS_FEATURE_IMPACTS)
half2 impactUV = GetClosestImpactUV(i.unskinnedObjPos, EllipsoidPosArray, HitArrayCount);
half4 impactMASI = SampleHitTexture(impactUV);
impactMASI.a = impactUV.x > 0.999 ? 0 : impactMASI.a;
albedo = lerp(_HitColor, albedo, impactMASI.a);
metallic = lerp(impactMASI.r, metallic, impactMASI.a);
smoothness = lerp(impactMASI.b, smoothness, impactMASI.a);
ao = min(ao, max(impactMASI.a, impactMASI.g));
#endif
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Sample Normal Map-------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
half3 normalTS = half3(0, 0, 1);
half geoSmooth = 1;
half4 normalMap = half4(0, 0, 1, 0);
#if defined(LITMAS_FEATURE_TS_NORMALS) /*-Tangent Space Normals----------------------------------------------------------*/
normalMap = SAMPLE_TEXTURE2D(_BumpMap, sampler_BaseMap, uv_main);
normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
geoSmooth = _Normals ? normalMap.b : 1.0;
smoothness = saturate(smoothness + geoSmooth - 1.0);
#elif defined(LITMAS_FEATURE_TP) /*-Triplanar Psuedo tangent space normals-----------------------------------------------*/
normalMap = SLZ_SAMPLE_TP_MAIN(_BumpMap, sampler_BaseMap, uv_main);
normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
normalTS = _RotateUVs ? half3(normalTS.y, -normalTS.x, normalTS.z) : normalTS;
geoSmooth = _Normals ? normalMap.b : 1.0;
smoothness = saturate(smoothness + geoSmooth - 1.0);
#endif
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Read Detail Map---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
#if defined(_DETAILS_ON)
#if defined(LITMAS_FEATURE_TP) /*-Triplanar--------------------------------------------------------------------------*/
float2 uv_detail = mad(uvTP, _DetailMap_ST.xx, _DetailMap_ST.zw);
uv_detail = _DetailsuseLocalUVs ? mad(float2(i.uv0XY_bitZ_fog.xy), _DetailMap_ST.xy, _DetailMap_ST.zw) : uv_detail;
#if defined(_EXPENSIVE_TP)
half2 ddxDetail = ddx(uv_detail);
half2 ddyDetail = ddy(uv_detail);
ddxDetail = _DetailsuseLocalUVs ? ddxDetail : ddxTP * _DetailMap_ST.xx;
ddyDetail = _DetailsuseLocalUVs ? ddyDetail : ddyTP * _DetailMap_ST.xx;
#endif
half4 detailMap = SLZ_SAMPLE_TP_DETAIL(_DetailMap, sampler_DetailMap, uv_detail);
half3 detailTS = half3(2.0 * detailMap.ag - 1.0, 1.0);
detailTS = _RotateUVs && !(_DetailsuseLocalUVs) ? half3(detailTS.y, -detailTS.x, detailTS.z) : detailTS;
normalTS = BlendNormal(normalTS, detailTS);
#elif defined(LITMAS_FEATURE_TS_NORMALS) /*-Tangent Space Normals----------------------------------------------------*/
half4 detailMap = SAMPLE_TEXTURE2D(_DetailMap, sampler_DetailMap, uv_detail);
half3 detailTS = half3(2.0 * detailMap.ag - 1.0, 1.0);
normalTS = BlendNormal(normalTS, detailTS);
#else /*-Default-----------------------------------------------------------------------------------------------------*/
half4 detailMap = SAMPLE_TEXTURE2D(_DetailMap, sampler_DetailMap, uv_detail);
#endif
smoothness = saturate(2.0 * detailMap.b * smoothness);
albedo.rgb = OverlayBlendDetail(detailMap.r, albedo.rgb);
#endif
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Transform Normals To Worldspace-----------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
#if defined(LITMAS_FEATURE_TS_NORMALS) /*-Tangent Space Normals----------------------------------------------------------*/
half3 normalWS = i.normXYZ_tanX.xyz;
half3x3 TStoWS = half3x3(
i.normXYZ_tanX.w, i.tanYZ_bitXY.z, normalWS.x,
i.tanYZ_bitXY.x, i.tanYZ_bitXY.w, normalWS.y,
i.tanYZ_bitXY.y, i.uv0XY_bitZ_fog.z, normalWS.z
);
normalWS = mul(TStoWS, normalTS);
normalWS = normalize(normalWS);
#elif defined(LITMAS_FEATURE_TP) /*-Triplanar----------------------------------------------------------------------------*/
half3 normalWS = mul(TStoWsTP, normalTS);
normalWS = normalize(normalWS);
#else /*-Default---------------------------------------------------------------------------------------------------------*/
half3 normalWS = i.normXYZ_tanX.xyz;
#endif
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Lighting Calculations---------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
#if !defined(SHADER_API_MOBILE) && !defined(LITMAS_FEATURE_TP) // Specular antialiasing based on normal derivatives. Only on PC to avoid cost of derivatives on Quest
smoothness = min(smoothness, SLZGeometricSpecularAA(normalWS));
#endif
#if defined(LIGHTMAP_ON)
SLZFragData fragData = SLZGetFragData(i.vertex, i.wPos, normalWS, i.uv1.xy, i.uv1.zw, i.SHVertLights.xyz);
#else
SLZFragData fragData = SLZGetFragData(i.vertex, i.wPos, normalWS, float2(0, 0), float2(0, 0), i.SHVertLights.xyz);
#endif
half4 emission = half4(0,0,0,0);
#if defined(LITMAS_FEATURE_EMISSION) /*-Emission-------------------------------------------------------------------------*/
UNITY_BRANCH if (_Emission)
{
emission = SAMPLE_TEXTURE2D(_EmissionMap, sampler_BaseMap, uv_main) * _EmissionColor;
emission.rgb *= lerp(albedo.rgb, half3(1, 1, 1), emission.a);
emission.rgb *= pow(abs(fragData.NoV), _EmissionFalloff);
}
#endif
#if defined(LITMAS_FEATURE_SSR) && defined(_SSR_ON) && !defined(SHADER_API_MOBILE) /*-SSR--------------------------------*/
smoothness = pow(smoothness, _SSRSmoothPow);
#endif
SLZSurfData surfData = SLZGetSurfDataMetallicGloss(albedo.rgb, saturate(metallic), saturate(smoothness), ao, emission.rgb);
half4 color = half4(1, 1, 1, 1);
#if defined(LITMAS_FEATURE_SSR) && defined(_SSR_ON) && !defined(SHADER_API_MOBILE) /*-SSR--------------------------------*/
half4 noiseRGBA = GetScreenNoiseRGBA(fragData.screenUV);
color.rgb = SLZPBRFragmentSSR(fragData, surfData, i.normXYZ_tanX.xyz, noiseRGBA);
#else /*-Default---------------------------------------------------------------------------------------------------------*/
color.rgb = SLZPBRFragment(fragData, surfData);
#endif
color.rgb = MixFog(color.rgb, -fragData.viewDir, i.uv0XY_bitZ_fog.w);
color = Volumetrics(color, fragData.position);
return color;
}

View file

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

View file

@ -0,0 +1,90 @@
#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/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
TEXTURE2D(_BaseMap);
TEXTURE2D(_EmissionMap);
SAMPLER(sampler_BaseMap);
CBUFFER_START(UnityPerMaterial)
float4 _BaseMap_ST;
float4 _DetailMap_ST;
half4 _BaseColor;
half _Details;
half _Normals;
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
CBUFFER_END
struct appdata
{
float4 vertex : POSITION;
float4 uv0 : TEXCOORD0;
float4 uv1 : TEXCOORD1;
float4 uv2 : TEXCOORD2;
float4 uv3 : TEXCOORD3;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
#ifdef EDITOR_VISUALIZATION
float4 VizUV : TEXCOORD2;
float4 LightCoord : TEXCOORD3;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityMetaVertexPosition(v.vertex.xyz, v.uv1.xy, v.uv2.xy);
o.uv = TRANSFORM_TEX(v.uv0.xy, _BaseMap);
#ifdef EDITOR_VISUALIZATION
float2 vizUV = 0;
float4 lightCoord = 0;
UnityEditorVizData(v.vertex.xyz, v.uv0.xy, v.uv1.xy, v.uv2.xy, vizUV, lightCoord);
o.VizUV = float4(vizUV, 0, 0);
o.LightCoord = lightCoord;
#endif
return o;
}
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
MetaInput metaInput = (MetaInput)0;
half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv) * _BaseColor;
metaInput.Albedo = albedo.rgb;
half4 emission = _EmissionColor * SAMPLE_TEXTURE2D(_EmissionMap, sampler_BaseMap, i.uv) * _BakedMutiplier * _Emission;
emission.rgb *= lerp(albedo.rgb, half3(1, 1, 1), emission.a);
metaInput.Emission = emission.rgb;
#ifdef EDITOR_VISUALIZATION
metaInput.VizUV = i.VizUV.xy;
metaInput.LightCoord = i.LightCoord;
#endif
return MetaFragment(metaInput);
}

View file

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

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4cd62495f14133740a379210d5183fb0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
m_Name: AudioLinkBakedRT
m_EditorClassIdentifier:
outputInclude: {fileID: 10900000, guid: 497a7e9f509af43459766d9be2d894a3, type: 3}
baseInclude: {fileID: 10900000, guid: ce3db88ac7e6cc545a92a754b24343f2, type: 3}
injectableIncludes:
- {fileID: 10900000, guid: 86d5c622b75cede49857fef3a19dae5a, type: 3}
- {fileID: 10900000, guid: e37116b777e0f8448a96eff25344707d, type: 3}
- {fileID: 10900000, guid: e9c4013a5ab6b0b4f8f10326087f2fbb, type: 3}
- {fileID: 10900000, guid: 12f5100b5c37a4e4b98bf050659ec151, type: 3}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 17f22f4544f12bf4fa18fd4640efd01f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,109 @@
/*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*/
#define SHADERPASS SHADERPASS_RAYTRACE
#include "UnityRaytracingMeshUtils.cginc"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#pragma raytracing BakeHit
struct RayPayload
{
float4 color;
float3 dir;
};
struct AttributeData
{
float2 barycentrics;
};
struct Vertex
{
float2 texcoord;
float3 normal;
};
// Begin Injection UNIFORMS from Injection_Emission_BakedRT.hlsl ----------------------------------------------------------
Texture2D<float4> _BaseMap;
SamplerState sampler_BaseMap;
Texture2D<float4> _EmissionMap;
SamplerState sampler_EmissionMap;
// End Injection UNIFORMS from Injection_Emission_BakedRT.hlsl ----------------------------------------------------------
CBUFFER_START( UnityPerMaterial )
float4 _BaseMap_ST;
half4 _BaseColor;
// Begin Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
float4 _DetailMap_ST;
half _Details;
half _Normals;
// End Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_AudioLink_CBuffer.hlsl ----------------------------------------------------------
half _AudioInputBoost;
half _SmoothstepBlend;
half _AudioLinkBaseBlend;
half4 _LowsColor;
half4 _MidsColor;
half4 _HighsColor;
// End Injection MATERIAL_CBUFFER from Injection_AudioLink_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_Emission_CBuffer.hlsl ----------------------------------------------------------
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
// End Injection MATERIAL_CBUFFER from Injection_Emission_CBuffer.hlsl ----------------------------------------------------------
int _AlphaPreMult;
CBUFFER_END
//https://coty.tips/raytracing-in-unity/
[shader("closesthit")]
void MyClosestHit(inout RayPayload payload, AttributeData attributes : SV_IntersectionAttributes) {
payload.color = float4(0,0,0,1); //Intializing
payload.dir = float3(1,0,0);
// Begin Injection CLOSEST_HIT from Injection_Emission_BakedRT.hlsl ----------------------------------------------------------
uint2 launchIdx = DispatchRaysIndex();
uint primitiveIndex = PrimitiveIndex();
uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex);
Vertex v0, v1, v2;
v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0);
v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0);
v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0);
// v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal);
// v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal);
// v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal);
float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y);
Vertex vInterpolated;
vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z;
//TODO: Extract normal direction to ignore the backside of emissive objects
//vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z;
// if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ;
// else payload.color = float4(10,0,0,1) ;
float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0).rgb, 1) * _BaseColor;
float4 emission = _Emission * _EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw, 0) * _EmissionColor;
emission.rgb *= lerp(albedo.rgb, 1, emission.a);
payload.color.rgb = emission.rgb * _BakedMutiplier;
// End Injection CLOSEST_HIT from Injection_Emission_BakedRT.hlsl ----------------------------------------------------------
}

View file

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

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
m_Name: AudioLinkDepthNormals
m_EditorClassIdentifier:
outputInclude: {fileID: 10900000, guid: 0348b18f9a5ccd54a9d69e204166b730, type: 3}
baseInclude: {fileID: 10900000, guid: 227ad5177db854e49a271b6143aa789f, type: 3}
injectableIncludes:
- {fileID: 10900000, guid: 305e5c81201b17d488f864cfb70943a1, type: 3}
- {fileID: 10900000, guid: 86d5c622b75cede49857fef3a19dae5a, type: 3}
- {fileID: 10900000, guid: e37116b777e0f8448a96eff25344707d, type: 3}
- {fileID: 10900000, guid: e9c4013a5ab6b0b4f8f10326087f2fbb, type: 3}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 661900e54ff51b245bc7e41e68d7d680
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,125 @@
/*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*/
#define SHADERPASS SHADERPASS_DEPTHNORMALS
#if defined(SHADER_API_MOBILE)
#else
#endif
#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/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/EncodeNormalsTexture.hlsl"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
// Begin Injection VERTEX_IN from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
float4 tangent : TANGENT;
float2 uv0 : TEXCOORD0;
// End Injection VERTEX_IN from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float4 normalWS : NORMAL;
// Begin Injection INTERPOLATORS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
float4 tanYZ_bitXY : TEXCOORD0;
float4 uv0XY_bitZ_fog : TEXCOORD1;
// End Injection INTERPOLATORS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
// Begin Injection UNIFORMS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
TEXTURE2D(_BumpMap);
SAMPLER(sampler_BumpMap);
// End Injection UNIFORMS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
CBUFFER_START(UnityPerMaterial)
float4 _BaseMap_ST;
half4 _BaseColor;
// Begin Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
float4 _DetailMap_ST;
half _Details;
half _Normals;
// End Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_AudioLink_CBuffer.hlsl ----------------------------------------------------------
half _AudioInputBoost;
half _SmoothstepBlend;
half _AudioLinkBaseBlend;
half4 _LowsColor;
half4 _MidsColor;
half4 _HighsColor;
// End Injection MATERIAL_CBUFFER from Injection_AudioLink_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_Emission_CBuffer.hlsl ----------------------------------------------------------
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
// End Injection MATERIAL_CBUFFER from Injection_Emission_CBuffer.hlsl ----------------------------------------------------------
int _Surface;
CBUFFER_END
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = TransformObjectToHClip(v.vertex.xyz);
// Begin Injection VERTEX_NORMAL from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.normalWS = float4(ntb.normalWS, ntb.tangentWS.x);
o.tanYZ_bitXY = float4(ntb.tangentWS.yz, ntb.bitangentWS.xy);
o.uv0XY_bitZ_fog.zw = ntb.bitangentWS.zz;
o.uv0XY_bitZ_fog.xy = TRANSFORM_TEX(v.uv0, _BaseMap);
// End Injection VERTEX_NORMAL from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
return o;
}
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 normals = half4(0, 0, 0, 1);
// Begin Injection FRAG_NORMALS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
half4 normalMap = SAMPLE_TEXTURE2D(_BumpMap, sampler_BumpMap, i.uv0XY_bitZ_fog.xy);
half3 normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
half3x3 TStoWS = half3x3(
i.normalWS.w, i.tanYZ_bitXY.z, i.normalWS.x,
i.tanYZ_bitXY.x, i.tanYZ_bitXY.w, i.normalWS.y,
i.tanYZ_bitXY.y, i.uv0XY_bitZ_fog.z, i.normalWS.z
);
half3 normalWS = mul(TStoWS, normalTS);
normalWS = normalize(normalWS);
normals = half4(EncodeWSNormalForNormalsTex(normalWS),0);
// End Injection FRAG_NORMALS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
return normals;
}

View file

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

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
m_Name: AudioLinkForward
m_EditorClassIdentifier:
outputInclude: {fileID: 10900000, guid: 550972e10932c834ca8194a98141c43a, type: 3}
baseInclude: {fileID: 10900000, guid: d5426963259cc9a41b440011880b9fc2, type: 3}
injectableIncludes:
- {fileID: 10900000, guid: 16380cd34ea8abf41b69d1f248057b10, type: 3}
- {fileID: 10900000, guid: 86d5c622b75cede49857fef3a19dae5a, type: 3}
- {fileID: 10900000, guid: 907bbd94e6b625847b43bc2b6798ff00, type: 3}
- {fileID: 10900000, guid: edf866d9d0f87324485d1946e3e8565e, type: 3}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2fb2e6b65fb96bd4a987e6570a335838
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,375 @@
/*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*/
#define SHADERPASS SHADERPASS_FORWARD
#define _NORMAL_DROPOFF_TS 1
#define _EMISSION
#define _NORMALMAP 1
#if defined(SHADER_API_MOBILE)
#define _ADDITIONAL_LIGHTS_VERTEX
#else
#pragma multi_compile_fragment _ _MAIN_LIGHT_SHADOWS_CASCADE
//#define DYNAMIC_SCREEN_SPACE_OCCLUSION
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
//#define DYNAMIC_ADDITIONAL_LIGHTS
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHTS
//#define DYNAMIC_ADDITIONAL_LIGHT_SHADOWS
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
#define _SHADOWS_SOFT 1
#define _REFLECTION_PROBE_BLENDING
//#pragma shader_feature_fragment _REFLECTION_PROBE_BOX_PROJECTION
// We don't need a keyword for this! the w component of the probe position already branches box vs non-box, & so little cost on pc it doesn't matter
#define _REFLECTION_PROBE_BOX_PROJECTION
#endif
#pragma multi_compile_fragment _ _LIGHT_COOKIES
#pragma multi_compile _ SHADOWS_SHADOWMASK
#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
#pragma multi_compile_fog
#pragma skip_variants FOG_LINEAR FOG_EXP
//#pragma multi_compile_fragment _ DEBUG_DISPLAY
#pragma multi_compile_fragment _ _DETAILS_ON
//#pragma multi_compile_fragment _ _EMISSION_ON
#if defined(LITMAS_FEATURE_LIGHTMAPPING)
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
#endif
#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"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZLighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl"
// Begin Injection INCLUDES from Injection_AudioLink.hlsl ----------------------------------------------------------
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/AudioLink/Shaders/AudioLink.cginc"
// End Injection INCLUDES from Injection_AudioLink.hlsl ----------------------------------------------------------
struct VertIn
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float4 uv0 : TEXCOORD0;
float4 uv1 : TEXCOORD1;
float4 uv2 : TEXCOORD2;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertOut
{
float4 vertex : SV_POSITION;
float4 uv0XY_bitZ_fog : TEXCOORD0;
#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
float4 uv1 : TEXCOORD1;
#endif
half4 SHVertLights : TEXCOORD2;
half4 normXYZ_tanX : TEXCOORD3;
float3 wPos : TEXCOORD4;
// Begin Injection INTERPOLATORS from Injection_NormalMaps.hlsl ----------------------------------------------------------
half4 tanYZ_bitXY : TEXCOORD5;
// End Injection INTERPOLATORS from Injection_NormalMaps.hlsl ----------------------------------------------------------
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
TEXTURE2D(_BumpMap);
TEXTURE2D(_MetallicGlossMap);
TEXTURE2D(_DetailMap);
SAMPLER(sampler_DetailMap);
// Begin Injection UNIFORMS from Injection_Emission.hlsl ----------------------------------------------------------
TEXTURE2D(_EmissionMap);
// End Injection UNIFORMS from Injection_Emission.hlsl ----------------------------------------------------------
// Begin Injection UNIFORMS from Injection_AudioLink.hlsl ----------------------------------------------------------
TEXTURE2D(_AudioLinkMap);
SAMPLER(sampler_AudioLinkMap);
TEXTURE2D(_AudioLinkNoise);
SAMPLER(sampler_AudioLinkNoise);
// End Injection UNIFORMS from Injection_AudioLink.hlsl ----------------------------------------------------------
CBUFFER_START(UnityPerMaterial)
float4 _BaseMap_ST;
half4 _BaseColor;
// Begin Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
float4 _DetailMap_ST;
half _Details;
half _Normals;
// End Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_AudioLink.hlsl ----------------------------------------------------------
half _AudioInputBoost;
half _SmoothstepBlend;
half _AudioLinkBaseBlend;
half4 _LowsColor;
half4 _MidsColor;
half4 _HighsColor;
// End Injection MATERIAL_CBUFFER from Injection_AudioLink.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_Emission.hlsl ----------------------------------------------------------
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
// End Injection MATERIAL_CBUFFER from Injection_Emission.hlsl ----------------------------------------------------------
int _Surface;
CBUFFER_END
half3 OverlayBlendDetail(half source, half3 destination)
{
half3 switch0 = round(destination); // if destination >= 0.5 then 1, else 0 assuming 0-1 input
half3 blendGreater = mad(mad(2.0, destination, -2.0), 1.0 - source, 1.0); // (2.0 * destination - 2.0) * ( 1.0 - source) + 1.0
half3 blendLesser = (2.0 * source) * destination;
return mad(switch0, blendGreater, mad(-switch0, blendLesser, blendLesser)); // switch0 * blendGreater + (1 - switch0) * blendLesser
//return half3(destination.r > 0.5 ? blendGreater.r : blendLesser.r,
// destination.g > 0.5 ? blendGreater.g : blendLesser.g,
// destination.b > 0.5 ? blendGreater.b : blendLesser.b
// );
}
// Begin Injection FUNCTIONS from Injection_AudioLink.hlsl ----------------------------------------------------------
half GetALChannelIntensity(half channelValue, half channelMask)
{
half smoothstepMin = saturate(1.0 - (channelValue + _AudioInputBoost));
half smoothstepMax = smoothstepMin + _SmoothstepBlend + 0.01;
half output = smoothstep(smoothstepMin, smoothstepMax, channelMask);
return output;
}
float GetALChronotensity()
{
return (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(0, 0)) % 628319) / 100000.0;
}
float ALPanU(float u, float velocity, float time)
{
return u + frac(velocity*time);
}
// What even is this bullshit? I'm just copying this verbatim from the amplify version, this math makes no sense
half4 GetALNoise(float u, half3 viewDir, half2x3 tan2wrldXY)
{
float chrono = 0.5 * GetALChronotensity();
chrono = (0.5 * _Time[1]) + chrono;
u = ALPanU(u, 0.17, chrono);
u = sin(6.0 * u);
float2 uv1 = viewDir.xy;
float2 uv2 = mul(tan2wrldXY, viewDir);
float2 uv = lerp(uv1, uv2, u);
return SAMPLE_TEXTURE2D(_AudioLinkNoise, sampler_AudioLinkNoise, uv);
}
half4 GetALChannelValue(half2 audioLinkMask, half channelValue, half4 channelColor, half4 noiseColor)
{
half4 a = (channelColor * noiseColor);
half aNoise = (audioLinkMask.x * _AudioLinkBaseBlend);
half aMain = (audioLinkMask.y * channelValue);
return a * (aNoise + aMain);
}
// End Injection FUNCTIONS from Injection_AudioLink.hlsl ----------------------------------------------------------
VertOut vert(VertIn v)
{
VertOut o = (VertOut)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.wPos = TransformObjectToWorld(v.vertex.xyz);
o.vertex = TransformWorldToHClip(o.wPos);
o.uv0XY_bitZ_fog.xy = v.uv0.xy;
#if defined(LIGHTMAP_ON) || defined(DIRLIGHTMAP_COMBINED)
OUTPUT_LIGHTMAP_UV(v.uv1.xy, unity_LightmapST, o.uv1.xy);
#endif
#ifdef DYNAMICLIGHTMAP_ON
OUTPUT_LIGHTMAP_UV(v.uv2.xy, unity_DynamicLightmapST, o.uv1.zw);
#endif
// Exp2 fog
half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
o.uv0XY_bitZ_fog.w = unity_FogParams.x * clipZ_0Far;
// Begin Injection VERTEX_NORMALS from Injection_NormalMaps.hlsl ----------------------------------------------------------
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.normXYZ_tanX = half4(ntb.normalWS, ntb.tangentWS.x);
o.tanYZ_bitXY = half4(ntb.tangentWS.yz, ntb.bitangentWS.xy);
o.uv0XY_bitZ_fog.z = ntb.bitangentWS.z;
// End Injection VERTEX_NORMALS from Injection_NormalMaps.hlsl ----------------------------------------------------------
o.SHVertLights = 0;
// Calculate vertex lights and L2 probe lighting on quest
o.SHVertLights.xyz = VertexLighting(o.wPos, o.normXYZ_tanX.xyz);
#if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) && defined(SHADER_API_MOBILE)
o.SHVertLights.xyz += SampleSHVertex(o.normXYZ_tanX.xyz);
#endif
return o;
}
half4 frag(VertOut i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Read Input Data---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
float2 uv_main = mad(float2(i.uv0XY_bitZ_fog.xy), _BaseMap_ST.xy, _BaseMap_ST.zw);
float2 uv_detail = mad(float2(i.uv0XY_bitZ_fog.xy), _DetailMap_ST.xy, _DetailMap_ST.zw);
half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv_main);
half4 mas = SAMPLE_TEXTURE2D(_MetallicGlossMap, sampler_BaseMap, uv_main);
albedo *= _BaseColor;
half metallic = mas.r;
half ao = mas.g;
half smoothness = mas.b;
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Sample Normal Map-------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
half3 normalTS = half3(0, 0, 1);
half geoSmooth = 1;
half4 normalMap = half4(0, 0, 1, 0);
// Begin Injection NORMAL_MAP from Injection_NormalMaps.hlsl ----------------------------------------------------------
normalMap = SAMPLE_TEXTURE2D(_BumpMap, sampler_BaseMap, uv_main);
normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
geoSmooth = _Normals ? normalMap.b : 1.0;
smoothness = saturate(smoothness + geoSmooth - 1.0);
// End Injection NORMAL_MAP from Injection_NormalMaps.hlsl ----------------------------------------------------------
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Read Detail Map---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
#if defined(_DETAILS_ON)
// Begin Injection DETAIL_MAP from Injection_NormalMaps.hlsl ----------------------------------------------------------
half4 detailMap = SAMPLE_TEXTURE2D(_DetailMap, sampler_DetailMap, uv_detail);
half3 detailTS = half3(2.0 * detailMap.ag - 1.0, 1.0);
normalTS = BlendNormal(normalTS, detailTS);
// End Injection DETAIL_MAP from Injection_NormalMaps.hlsl ----------------------------------------------------------
smoothness = saturate(2.0 * detailMap.b * smoothness);
albedo.rgb = OverlayBlendDetail(detailMap.r, albedo.rgb);
#endif
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Transform Normals To Worldspace-----------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
// Begin Injection NORMAL_TRANSFORM from Injection_NormalMaps.hlsl ----------------------------------------------------------
half3 normalWS = i.normXYZ_tanX.xyz;
half3x3 TStoWS = half3x3(
i.normXYZ_tanX.w, i.tanYZ_bitXY.z, normalWS.x,
i.tanYZ_bitXY.x, i.tanYZ_bitXY.w, normalWS.y,
i.tanYZ_bitXY.y, i.uv0XY_bitZ_fog.z, normalWS.z
);
normalWS = mul(TStoWS, normalTS);
normalWS = normalize(normalWS);
// End Injection NORMAL_TRANSFORM from Injection_NormalMaps.hlsl ----------------------------------------------------------
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Lighting Calculations---------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
// Begin Injection SPEC_AA from Injection_NormalMaps.hlsl ----------------------------------------------------------
#if !defined(SHADER_API_MOBILE) && !defined(LITMAS_FEATURE_TP) // Specular antialiasing based on normal derivatives. Only on PC to avoid cost of derivatives on Quest
smoothness = min(smoothness, SLZGeometricSpecularAA(normalWS));
#endif
// End Injection SPEC_AA from Injection_NormalMaps.hlsl ----------------------------------------------------------
#if defined(LIGHTMAP_ON)
SLZFragData fragData = SLZGetFragData(i.vertex, i.wPos, normalWS, i.uv1.xy, i.uv1.zw, i.SHVertLights.xyz);
#else
SLZFragData fragData = SLZGetFragData(i.vertex, i.wPos, normalWS, float2(0, 0), float2(0, 0), i.SHVertLights.xyz);
#endif
half4 emission = half4(0,0,0,0);
// Begin Injection EMISSION from Injection_AudioLink.hlsl ----------------------------------------------------------
#if defined(PASS_META)
half4 audioLinkNoise = GetALNoise(uv_main.x, half3(1, 1, 1), (half2x3)TStoWS);
#else
half4 audioLinkNoise = GetALNoise(uv_main.x, fragData.viewDir, (half2x3)TStoWS);
#endif
half4 audioLinkMask = SAMPLE_TEXTURE2D(_AudioLinkMap, sampler_AudioLinkMap, uv_main);
half audioLows = AudioLinkData(ALPASS_AUDIOBASS).x;
audioLows = GetALChannelIntensity(audioLows, audioLinkMask.r);
emission += GetALChannelValue(audioLinkMask.ra, audioLows, _LowsColor, audioLinkNoise);
half audioMids = AudioLinkData(ALPASS_AUDIOLOWMIDS).x;
audioMids = GetALChannelIntensity(audioMids, audioLinkMask.g);
emission += GetALChannelValue(audioLinkMask.ga, audioMids, _MidsColor, audioLinkNoise);
half audioHighs = AudioLinkData(ALPASS_AUDIOHIGHMIDS).x + AudioLinkData(ALPASS_AUDIOTREBLE).x * 0.5;
audioHighs = GetALChannelIntensity(audioHighs, audioLinkMask.b);
emission += GetALChannelValue(audioLinkMask.ba, audioHighs, _HighsColor, audioLinkNoise);
// End Injection EMISSION from Injection_AudioLink.hlsl ----------------------------------------------------------
// Begin Injection EMISSION from Injection_Emission.hlsl ----------------------------------------------------------
UNITY_BRANCH if (_Emission)
{
emission += SAMPLE_TEXTURE2D(_EmissionMap, sampler_BaseMap, uv_main) * _EmissionColor;
emission.rgb *= lerp(albedo.rgb, half3(1, 1, 1), emission.a);
emission.rgb *= pow(abs(fragData.NoV), _EmissionFalloff);
}
// End Injection EMISSION from Injection_Emission.hlsl ----------------------------------------------------------
SLZSurfData surfData = SLZGetSurfDataMetallicGloss(albedo.rgb, saturate(metallic), saturate(smoothness), ao, emission.rgb, albedo.a);
half4 color = half4(1, 1, 1, 1);
color = SLZPBRFragment(fragData, surfData, _Surface);
color.rgba = MixFogSurf(color.rgba, -fragData.viewDir, i.uv0XY_bitZ_fog.w, _Surface);
color = VolumetricsSurf(color, fragData.position, _Surface);
return color;
}

View file

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

View file

@ -0,0 +1,23 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
m_Name: AudioLinkMeta
m_EditorClassIdentifier:
outputInclude: {fileID: 10900000, guid: e02f2e26775aa90479e957dd3bc406f2, type: 3}
baseInclude: {fileID: 10900000, guid: 5e4c2db9537ee1d48be13dcc77c3a6cb, type: 3}
injectableIncludes:
- {fileID: 10900000, guid: 86d5c622b75cede49857fef3a19dae5a, type: 3}
- {fileID: 10900000, guid: e2b7c752aa2e04448b488e071c5e611b, type: 3}
- {fileID: 10900000, guid: 907bbd94e6b625847b43bc2b6798ff00, type: 3}
- {fileID: 10900000, guid: e9c4013a5ab6b0b4f8f10326087f2fbb, type: 3}
- {fileID: 10900000, guid: 58f19d4f5814b4d469901eddac36063b, type: 3}
- {fileID: 10900000, guid: 2d1abdac36c30944bae37364735f980a, type: 3}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: caf66b1b1b014ee4fb65b6d94e11ee32
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,233 @@
/*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*/
#define SHADERPASS SHADERPASS_META
#define PASS_META
#if defined(SHADER_API_MOBILE)
#else
#endif
//#pragma shader_feature _ EDITOR_VISUALIZATION
#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/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
// Begin Injection INCLUDES from Injection_AudioLink.hlsl ----------------------------------------------------------
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/AudioLink/Shaders/AudioLink.cginc"
// End Injection INCLUDES from Injection_AudioLink.hlsl ----------------------------------------------------------
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
// Begin Injection UNIFORMS from Injection_Emission_Meta.hlsl ----------------------------------------------------------
TEXTURE2D(_EmissionMap);
// End Injection UNIFORMS from Injection_Emission_Meta.hlsl ----------------------------------------------------------
// Begin Injection UNIFORMS from Injection_AudioLink.hlsl ----------------------------------------------------------
TEXTURE2D(_AudioLinkMap);
SAMPLER(sampler_AudioLinkMap);
TEXTURE2D(_AudioLinkNoise);
SAMPLER(sampler_AudioLinkNoise);
// End Injection UNIFORMS from Injection_AudioLink.hlsl ----------------------------------------------------------
CBUFFER_START(UnityPerMaterial)
float4 _BaseMap_ST;
half4 _BaseColor;
// Begin Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
float4 _DetailMap_ST;
half _Details;
half _Normals;
// End Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_AudioLink.hlsl ----------------------------------------------------------
half _AudioInputBoost;
half _SmoothstepBlend;
half _AudioLinkBaseBlend;
half4 _LowsColor;
half4 _MidsColor;
half4 _HighsColor;
// End Injection MATERIAL_CBUFFER from Injection_AudioLink.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_Emission_CBuffer.hlsl ----------------------------------------------------------
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
// End Injection MATERIAL_CBUFFER from Injection_Emission_CBuffer.hlsl ----------------------------------------------------------
int _Surface;
CBUFFER_END
struct appdata
{
float4 vertex : POSITION;
float4 uv0 : TEXCOORD0;
float4 uv1 : TEXCOORD1;
float4 uv2 : TEXCOORD2;
float4 uv3 : TEXCOORD3;
// Begin Injection VERTEX_IN from Injection_ALNormMeta.hlsl ----------------------------------------------------------
half3 normal : NORMAL;
half4 tangent : TANGENT;
// End Injection VERTEX_IN from Injection_ALNormMeta.hlsl ----------------------------------------------------------
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
#ifdef EDITOR_VISUALIZATION
float4 VizUV : TEXCOORD1;
float4 LightCoord : TEXCOORD2;
#endif
// Begin Injection INTERPOLATORS from Injection_ALNormMeta.hlsl ----------------------------------------------------------
half2x3 TStoWS : TEXCOORD3;
// End Injection INTERPOLATORS from Injection_ALNormMeta.hlsl ----------------------------------------------------------
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
// Begin Injection FUNCTIONS from Injection_AudioLink.hlsl ----------------------------------------------------------
half GetALChannelIntensity(half channelValue, half channelMask)
{
half smoothstepMin = saturate(1.0 - (channelValue + _AudioInputBoost));
half smoothstepMax = smoothstepMin + _SmoothstepBlend + 0.01;
half output = smoothstep(smoothstepMin, smoothstepMax, channelMask);
return output;
}
float GetALChronotensity()
{
return (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(0, 0)) % 628319) / 100000.0;
}
float ALPanU(float u, float velocity, float time)
{
return u + frac(velocity*time);
}
// What even is this bullshit? I'm just copying this verbatim from the amplify version, this math makes no sense
half4 GetALNoise(float u, half3 viewDir, half2x3 tan2wrldXY)
{
float chrono = 0.5 * GetALChronotensity();
chrono = (0.5 * _Time[1]) + chrono;
u = ALPanU(u, 0.17, chrono);
u = sin(6.0 * u);
float2 uv1 = viewDir.xy;
float2 uv2 = mul(tan2wrldXY, viewDir);
float2 uv = lerp(uv1, uv2, u);
return SAMPLE_TEXTURE2D(_AudioLinkNoise, sampler_AudioLinkNoise, uv);
}
half4 GetALChannelValue(half2 audioLinkMask, half channelValue, half4 channelColor, half4 noiseColor)
{
half4 a = (channelColor * noiseColor);
half aNoise = (audioLinkMask.x * _AudioLinkBaseBlend);
half aMain = (audioLinkMask.y * channelValue);
return a * (aNoise + aMain);
}
// End Injection FUNCTIONS from Injection_AudioLink.hlsl ----------------------------------------------------------
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityMetaVertexPosition(v.vertex.xyz, v.uv1.xy, v.uv2.xy);
o.uv = TRANSFORM_TEX(v.uv0.xy, _BaseMap);
#ifdef EDITOR_VISUALIZATION
float2 vizUV = 0;
float4 lightCoord = 0;
UnityEditorVizData(v.vertex.xyz, v.uv0.xy, v.uv1.xy, v.uv2.xy, vizUV, lightCoord);
o.VizUV = float4(vizUV, 0, 0);
o.LightCoord = lightCoord;
#endif
// Begin Injection VERTEX_END from Injection_ALNormMeta.hlsl ----------------------------------------------------------
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.TStoWS = half2x3(ntb.normalWS.x, ntb.tangentWS.x, ntb.bitangentWS.x,
ntb.normalWS.y, ntb.tangentWS.y, ntb.bitangentWS.y
);
// End Injection VERTEX_END from Injection_ALNormMeta.hlsl ----------------------------------------------------------
return o;
}
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
MetaInput metaInput = (MetaInput)0;
float2 uv_main = i.uv;
half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv) * _BaseColor;
metaInput.Albedo = albedo.rgb;
// Begin Injection FRAG_POST_INPUTS from Injection_ALNormMeta.hlsl ----------------------------------------------------------
half2x3 TStoWS = i.TStoWS;
// End Injection FRAG_POST_INPUTS from Injection_ALNormMeta.hlsl ----------------------------------------------------------
half4 emission = half4(0, 0, 0, 0);
// Begin Injection EMISSION from Injection_AudioLink.hlsl ----------------------------------------------------------
#if defined(PASS_META)
half4 audioLinkNoise = GetALNoise(uv_main.x, half3(1, 1, 1), (half2x3)TStoWS);
#else
half4 audioLinkNoise = GetALNoise(uv_main.x, fragData.viewDir, (half2x3)TStoWS);
#endif
half4 audioLinkMask = SAMPLE_TEXTURE2D(_AudioLinkMap, sampler_AudioLinkMap, uv_main);
half audioLows = AudioLinkData(ALPASS_AUDIOBASS).x;
audioLows = GetALChannelIntensity(audioLows, audioLinkMask.r);
emission += GetALChannelValue(audioLinkMask.ra, audioLows, _LowsColor, audioLinkNoise);
half audioMids = AudioLinkData(ALPASS_AUDIOLOWMIDS).x;
audioMids = GetALChannelIntensity(audioMids, audioLinkMask.g);
emission += GetALChannelValue(audioLinkMask.ga, audioMids, _MidsColor, audioLinkNoise);
half audioHighs = AudioLinkData(ALPASS_AUDIOHIGHMIDS).x + AudioLinkData(ALPASS_AUDIOTREBLE).x * 0.5;
audioHighs = GetALChannelIntensity(audioHighs, audioLinkMask.b);
emission += GetALChannelValue(audioLinkMask.ba, audioHighs, _HighsColor, audioLinkNoise);
// End Injection EMISSION from Injection_AudioLink.hlsl ----------------------------------------------------------
// Begin Injection EMISSION from Injection_Emission_Meta.hlsl ----------------------------------------------------------
if (_Emission)
{
half4 emissionDefault = _EmissionColor * SAMPLE_TEXTURE2D(_EmissionMap, sampler_BaseMap, i.uv);
emissionDefault.rgb *= _BakedMutiplier * _Emission;
emissionDefault.rgb *= lerp(albedo.rgb, half3(1, 1, 1), emissionDefault.a);
emission += emissionDefault;
}
// End Injection EMISSION from Injection_Emission_Meta.hlsl ----------------------------------------------------------
// Begin Injection EMISSION from Injection_ALBakedEm.hlsl ----------------------------------------------------------
emission.rgb *= 8;
// End Injection EMISSION from Injection_ALBakedEm.hlsl ----------------------------------------------------------
metaInput.Emission = emission.rgb;
#ifdef EDITOR_VISUALIZATION
metaInput.VizUV = i.VizUV.xy;
metaInput.LightCoord = i.LightCoord;
#endif
return MetaFragment(metaInput);
}

View file

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

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 33b537ce8aa9a634f962b2a135a4ec70
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,49 @@
#define SHADERPASS SHADERPASS_RAYTRACE
#include "UnityRaytracingMeshUtils.cginc"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
//#!INJECT_POINT INCLUDES
#pragma raytracing BakeHit
struct RayPayload
{
float4 color;
float3 dir;
};
struct AttributeData
{
float2 barycentrics;
};
struct Vertex
{
float2 texcoord;
float3 normal;
};
//#!INJECT_POINT UNIFORMS
CBUFFER_START( UnityPerMaterial )
//#!INJECT_POINT MATERIAL_CBUFFER_EARLY
float4 _BaseMap_ST;
half4 _BaseColor;
//#!INJECT_POINT MATERIAL_CBUFFER
int _AlphaPreMult;
CBUFFER_END
//https://coty.tips/raytracing-in-unity/
[shader("closesthit")]
void MyClosestHit(inout RayPayload payload, AttributeData attributes : SV_IntersectionAttributes) {
payload.color = float4(0,0,0,1); //Intializing
payload.dir = float3(1,0,0);
//#!INJECT_POINT CLOSEST_HIT
}

View file

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

View file

@ -0,0 +1,90 @@
#define SHADERPASS SHADERPASS_DEPTHNORMALS
#if defined(SHADER_API_MOBILE)
//#!INJECT_POINT MOBILE_DEFINES
#else
//#!INJECT_POINT STANDALONE_DEFINES
#endif
//#!INJECT_POINT UNIVERSAL_DEFINES
#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/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/EncodeNormalsTexture.hlsl"
//#!INJECT_POINT INCLUDES
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
//#!INJECT_POINT VERTEX_IN
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float4 normalWS : NORMAL;
//#!INJECT_POINT INTERPOLATORS
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
//#!INJECT_POINT UNIFORMS
CBUFFER_START(UnityPerMaterial)
//#!INJECT_POINT MATERIAL_CBUFFER_EARLY
float4 _BaseMap_ST;
half4 _BaseColor;
//#!INJECT_POINT MATERIAL_CBUFFER
int _Surface;
CBUFFER_END
//#!INJECT_POINT FUNCTIONS
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
//#!INJECT_POINT VERTEX_BEGIN
//#!INJECT_POINT VERTEX_POSITION
//#!INJECT_DEFAULT
o.vertex = TransformObjectToHClip(v.vertex.xyz);
//#!INJECT_END
//#!INJECT_POINT VERTEX_NORMAL
//#!INJECT_DEFAULT
o.normalWS = float4(TransformObjectToWorldNormal(v.normal), 1);
//#!INJECT_END
//#!INJECT_POINT VERTEX_END
return o;
}
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
//#!INJECT_POINT FRAG_BEGIN
half4 normals = half4(0, 0, 0, 1);
//#!INJECT_POINT FRAG_NORMALS
//#!INJECT_DEFAULT
normals.xyz = half3(NormalizeNormalPerPixel(i.normalWS.xyz));
normals.xyz = EncodeWSNormalForNormalsTex(normals.xyz);
//#!INJECT_END
//#!INJECT_POINT FRAG_END
return normals;
}

View file

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

View file

@ -0,0 +1,277 @@
#define SHADERPASS SHADERPASS_FORWARD
#define _NORMAL_DROPOFF_TS 1
#define _EMISSION
#define _NORMALMAP 1
#if defined(SHADER_API_MOBILE)
#define _ADDITIONAL_LIGHTS_VERTEX
//#!INJECT_POINT MOBILE_DEFINES
#else
#pragma multi_compile_fragment _ _MAIN_LIGHT_SHADOWS_CASCADE
//#define DYNAMIC_SCREEN_SPACE_OCCLUSION
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
//#define DYNAMIC_ADDITIONAL_LIGHTS
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHTS
//#define DYNAMIC_ADDITIONAL_LIGHT_SHADOWS
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
#define _SHADOWS_SOFT 1
#define _REFLECTION_PROBE_BLENDING
//#pragma shader_feature_fragment _REFLECTION_PROBE_BOX_PROJECTION
// We don't need a keyword for this! the w component of the probe position already branches box vs non-box, & so little cost on pc it doesn't matter
#define _REFLECTION_PROBE_BOX_PROJECTION
//#!INJECT_POINT STANDALONE_DEFINES
#endif
#pragma multi_compile_fragment _ _LIGHT_COOKIES
#pragma multi_compile _ SHADOWS_SHADOWMASK
#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
#pragma multi_compile_fog
#pragma skip_variants FOG_LINEAR FOG_EXP
//#pragma multi_compile_fragment _ DEBUG_DISPLAY
#pragma multi_compile_fragment _ _DETAILS_ON
//#pragma multi_compile_fragment _ _EMISSION_ON
//#!INJECT_POINT UNIVERSAL_DEFINES
#if defined(LITMAS_FEATURE_LIGHTMAPPING)
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
#endif
#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"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZLighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl"
//#!INJECT_POINT INCLUDES
struct VertIn
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
//#!TEXCOORD float4 uv0 0
//#!TEXCOORD float4 uv1 0
//#!TEXCOORD float4 uv2 0
//#!INJECT_POINT VERTEX_IN
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertOut
{
float4 vertex : SV_POSITION;
//#!TEXCOORD float4 uv0XY_bitZ_fog 1
#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
//#!TEXCOORD float4 uv1 1
#endif
//#!TEXCOORD half4 SHVertLights 1
//#!TEXCOORD half4 normXYZ_tanX 1
//#!TEXCOORD float3 wPos 1
//#!INJECT_POINT INTERPOLATORS
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
TEXTURE2D(_BumpMap);
TEXTURE2D(_MetallicGlossMap);
TEXTURE2D(_DetailMap);
SAMPLER(sampler_DetailMap);
//#!INJECT_POINT UNIFORMS
CBUFFER_START(UnityPerMaterial)
//#!INJECT_POINT MATERIAL_CBUFFER_EARLY
float4 _BaseMap_ST;
half4 _BaseColor;
//#!INJECT_POINT MATERIAL_CBUFFER
int _Surface;
CBUFFER_END
half3 OverlayBlendDetail(half source, half3 destination)
{
half3 switch0 = round(destination); // if destination >= 0.5 then 1, else 0 assuming 0-1 input
half3 blendGreater = mad(mad(2.0, destination, -2.0), 1.0 - source, 1.0); // (2.0 * destination - 2.0) * ( 1.0 - source) + 1.0
half3 blendLesser = (2.0 * source) * destination;
return mad(switch0, blendGreater, mad(-switch0, blendLesser, blendLesser)); // switch0 * blendGreater + (1 - switch0) * blendLesser
//return half3(destination.r > 0.5 ? blendGreater.r : blendLesser.r,
// destination.g > 0.5 ? blendGreater.g : blendLesser.g,
// destination.b > 0.5 ? blendGreater.b : blendLesser.b
// );
}
//#!INJECT_POINT FUNCTIONS
VertOut vert(VertIn v)
{
VertOut o = (VertOut)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.wPos = TransformObjectToWorld(v.vertex.xyz);
o.vertex = TransformWorldToHClip(o.wPos);
o.uv0XY_bitZ_fog.xy = v.uv0.xy;
#if defined(LIGHTMAP_ON) || defined(DIRLIGHTMAP_COMBINED)
OUTPUT_LIGHTMAP_UV(v.uv1.xy, unity_LightmapST, o.uv1.xy);
#endif
#ifdef DYNAMICLIGHTMAP_ON
OUTPUT_LIGHTMAP_UV(v.uv2.xy, unity_DynamicLightmapST, o.uv1.zw);
#endif
// Exp2 fog
half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
o.uv0XY_bitZ_fog.w = unity_FogParams.x * clipZ_0Far;
//#!INJECT_POINT VERTEX_NORMALS
//#!INJECT_DEFAULT
o.normXYZ_tanX.xyz = v.normal;
o.normXYZ_tanX.w = 0h;
o.uv0XY_bitZ_fog.z = v.tangent.w; // avoid having the tangent optimized out to prevent issues with the depth-prepass
//#!INJECT_END
o.SHVertLights = 0;
// Calculate vertex lights and L2 probe lighting on quest
o.SHVertLights.xyz = VertexLighting(o.wPos, o.normXYZ_tanX.xyz);
#if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) && defined(SHADER_API_MOBILE)
o.SHVertLights.xyz += SampleSHVertex(o.normXYZ_tanX.xyz);
#endif
//#!INJECT_POINT VERTEX_END
return o;
}
half4 frag(VertOut i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Read Input Data---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
//#!INJECT_POINT FRAG_READ_INPUTS
//#!INJECT_DEFAULT
float2 uv_main = mad(float2(i.uv0XY_bitZ_fog.xy), _BaseMap_ST.xy, _BaseMap_ST.zw);
float2 uv_detail = mad(float2(i.uv0XY_bitZ_fog.xy), _DetailMap_ST.xy, _DetailMap_ST.zw);
half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv_main);
half4 mas = SAMPLE_TEXTURE2D(_MetallicGlossMap, sampler_BaseMap, uv_main);
//#!INJECT_END
//#!INJECT_POINT FRAG_POST_READ
//#!INJECT_POINT PBR_VALUES
//#!INJECT_DEFAULT
albedo *= _BaseColor;
half metallic = mas.r;
half ao = mas.g;
half smoothness = mas.b;
//#!INJECT_END
//#!INJECT_POINT FRAG_POST_INPUTS
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Sample Normal Map-------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
half3 normalTS = half3(0, 0, 1);
half geoSmooth = 1;
half4 normalMap = half4(0, 0, 1, 0);
//#!INJECT_POINT NORMAL_MAP
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Read Detail Map---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
#if defined(_DETAILS_ON)
//#!INJECT_POINT DETAIL_MAP
smoothness = saturate(2.0 * detailMap.b * smoothness);
albedo.rgb = OverlayBlendDetail(detailMap.r, albedo.rgb);
#endif
//#!INJECT_POINT PRE_NORMAL_TS_TO_WS
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Transform Normals To Worldspace-----------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
//#!INJECT_POINT NORMAL_TRANSFORM
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Lighting Calculations---------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
//#!INJECT_POINT SPEC_AA
//#!INJECT_DEFAULT
#if !defined(SHADER_API_MOBILE) && !defined(LITMAS_FEATURE_TP) // Specular antialiasing based on normal derivatives. Only on PC to avoid cost of derivatives on Quest
smoothness = min(smoothness, SLZGeometricSpecularAA(i.normXYZ_tanX.xyz));
#endif
//#!INJECT_END
//#!INJECT_POINT PRE_FRAGDATA
#if defined(LIGHTMAP_ON)
SLZFragData fragData = SLZGetFragData(i.vertex, i.wPos, normalWS, i.uv1.xy, i.uv1.zw, i.SHVertLights.xyz);
#else
SLZFragData fragData = SLZGetFragData(i.vertex, i.wPos, normalWS, float2(0, 0), float2(0, 0), i.SHVertLights.xyz);
#endif
half4 emission = half4(0,0,0,0);
//#!INJECT_POINT EMISSION
//#!INJECT_POINT PRE_SURFDATA
SLZSurfData surfData = SLZGetSurfDataMetallicGloss(albedo.rgb, saturate(metallic), saturate(smoothness), ao, emission.rgb, albedo.a);
half4 color = half4(1, 1, 1, 1);
//#!INJECT_POINT PRE_LIGHTING_CALC
//#!INJECT_POINT LIGHTING_CALC
//#!INJECT_DEFAULT
color = SLZPBRFragment(fragData, surfData, _Surface);
//#!INJECT_END
//#!INJECT_POINT VOLUMETRIC_FOG
//#!INJECT_DEFAULT
color.rgba = MixFogSurf(color.rgba, -fragData.viewDir, i.uv0XY_bitZ_fog.w, _Surface);
color = VolumetricsSurf(color, fragData.position, _Surface);
//#!INJECT_END
return color;
}

View file

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

View file

@ -0,0 +1,119 @@
#define SHADERPASS SHADERPASS_META
#define PASS_META
#if defined(SHADER_API_MOBILE)
//#!INJECT_POINT MOBILE_DEFINES
#else
//#!INJECT_POINT STANDALONE_DEFINES
#endif
//#pragma shader_feature _ EDITOR_VISUALIZATION
//#!INJECT_POINT UNIVERSAL_DEFINES
#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/ShaderGraphFunctions.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/MetaInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
//#!INJECT_POINT INCLUDES
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
//#!INJECT_POINT UNIFORMS
CBUFFER_START(UnityPerMaterial)
//#!INJECT_POINT MATERIAL_CBUFFER_EARLY
float4 _BaseMap_ST;
half4 _BaseColor;
//#!INJECT_POINT MATERIAL_CBUFFER
int _Surface;
CBUFFER_END
struct appdata
{
float4 vertex : POSITION;
//#!TEXCOORD float4 uv0 0
//#!TEXCOORD float4 uv1 0
//#!TEXCOORD float4 uv2 0
//#!TEXCOORD float4 uv3 0
//#!INJECT_POINT VERTEX_IN
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
//#!TEXCOORD float2 uv 1
#ifdef EDITOR_VISUALIZATION
//#!TEXCOORD float4 VizUV 1
//#!TEXCOORD float4 LightCoord 1
#endif
//#!INJECT_POINT INTERPOLATORS
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
//#!INJECT_POINT FUNCTIONS
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityMetaVertexPosition(v.vertex.xyz, v.uv1.xy, v.uv2.xy);
o.uv = TRANSFORM_TEX(v.uv0.xy, _BaseMap);
#ifdef EDITOR_VISUALIZATION
float2 vizUV = 0;
float4 lightCoord = 0;
UnityEditorVizData(v.vertex.xyz, v.uv0.xy, v.uv1.xy, v.uv2.xy, vizUV, lightCoord);
o.VizUV = float4(vizUV, 0, 0);
o.LightCoord = lightCoord;
#endif
//#!INJECT_POINT VERTEX_END
return o;
}
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
MetaInput metaInput = (MetaInput)0;
float2 uv_main = i.uv;
half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv) * _BaseColor;
metaInput.Albedo = albedo.rgb;
//#!INJECT_POINT FRAG_POST_INPUTS
half4 emission = half4(0, 0, 0, 0);
//#!INJECT_POINT EMISSION
metaInput.Emission = emission.rgb;
#ifdef EDITOR_VISUALIZATION
metaInput.VizUV = i.VizUV.xy;
metaInput.LightCoord = i.LightCoord;
#endif
return MetaFragment(metaInput);
}

View file

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

View file

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
m_Name: Dummy
m_EditorClassIdentifier:
outputInclude: {fileID: 0}
baseInclude: {fileID: 0}
injectableIncludes: []

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0dba7cec84d23974698ccfdeba37fc86
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
m_Name: HairForward
m_EditorClassIdentifier:
outputInclude: {fileID: 10900000, guid: cab23ba3fdfef5540b01c70cc8831341, type: 3}
baseInclude: {fileID: 10900000, guid: d5426963259cc9a41b440011880b9fc2, type: 3}
injectableIncludes:
- {fileID: 10900000, guid: 16380cd34ea8abf41b69d1f248057b10, type: 3}
- {fileID: 10900000, guid: 86d5c622b75cede49857fef3a19dae5a, type: 3}
- {fileID: 10900000, guid: c9f32b72f4bfe074d93a952773a7fedb, type: 3}
- {fileID: 10900000, guid: 29eeba4104ff52b40abd7219004294ce, type: 3}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 09633a38d0f34c64ba62e468911aef91
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
m_Name: ImpactsDepthNormals
m_EditorClassIdentifier:
outputInclude: {fileID: 10900000, guid: ffd03d2f28569364682ffdb41a66076f, type: 3}
baseInclude: {fileID: 10900000, guid: 227ad5177db854e49a271b6143aa789f, type: 3}
injectableIncludes:
- {fileID: 10900000, guid: 86d5c622b75cede49857fef3a19dae5a, type: 3}
- {fileID: 10900000, guid: 305e5c81201b17d488f864cfb70943a1, type: 3}
- {fileID: 10900000, guid: 37d63b61721eb5d4987f1255f95280fd, type: 3}
- {fileID: 10900000, guid: e9c4013a5ab6b0b4f8f10326087f2fbb, type: 3}
- {fileID: 10900000, guid: bae3419c672853f49a5835566fa8d1df, type: 3}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 610b3ad6714898f47b689388579781e5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,129 @@
/*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*/
#define SHADERPASS SHADERPASS_DEPTHNORMALS
#if defined(SHADER_API_MOBILE)
#else
#endif
// Begin Injection UNIVERSAL_DEFINES from Injection_SSR_CBuffer_Posespace.hlsl ----------------------------------------------------------
#define _SSRTemporalMul 0
// End Injection UNIVERSAL_DEFINES from Injection_SSR_CBuffer_Posespace.hlsl ----------------------------------------------------------
#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/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/EncodeNormalsTexture.hlsl"
// Begin Injection INCLUDES from Injection_Impacts_CBuffer.hlsl ----------------------------------------------------------
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl"
// End Injection INCLUDES from Injection_Impacts_CBuffer.hlsl ----------------------------------------------------------
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
// Begin Injection VERTEX_IN from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
float4 tangent : TANGENT;
float2 uv0 : TEXCOORD0;
// End Injection VERTEX_IN from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float4 normalWS : NORMAL;
// Begin Injection INTERPOLATORS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
float4 tanYZ_bitXY : TEXCOORD0;
float4 uv0XY_bitZ_fog : TEXCOORD1;
// End Injection INTERPOLATORS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
// Begin Injection UNIFORMS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
TEXTURE2D(_BumpMap);
SAMPLER(sampler_BumpMap);
// End Injection UNIFORMS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
CBUFFER_START(UnityPerMaterial)
// Begin Injection MATERIAL_CBUFFER_EARLY from Injection_Impacts_CBuffer.hlsl ----------------------------------------------------------
half4x4 EllipsoidPosArray[HitMatrixCount];
int _NumberOfHits;
half4 _HitColor;
// End Injection MATERIAL_CBUFFER_EARLY from Injection_Impacts_CBuffer.hlsl ----------------------------------------------------------
float4 _BaseMap_ST;
half4 _BaseColor;
// Begin Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
float4 _DetailMap_ST;
half _Details;
half _Normals;
// End Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_Emission_CBuffer.hlsl ----------------------------------------------------------
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
// End Injection MATERIAL_CBUFFER from Injection_Emission_CBuffer.hlsl ----------------------------------------------------------
int _Surface;
CBUFFER_END
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = TransformObjectToHClip(v.vertex.xyz);
// Begin Injection VERTEX_NORMAL from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.normalWS = float4(ntb.normalWS, ntb.tangentWS.x);
o.tanYZ_bitXY = float4(ntb.tangentWS.yz, ntb.bitangentWS.xy);
o.uv0XY_bitZ_fog.zw = ntb.bitangentWS.zz;
o.uv0XY_bitZ_fog.xy = TRANSFORM_TEX(v.uv0, _BaseMap);
// End Injection VERTEX_NORMAL from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
return o;
}
half4 frag(v2f i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 normals = half4(0, 0, 0, 1);
// Begin Injection FRAG_NORMALS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
half4 normalMap = SAMPLE_TEXTURE2D(_BumpMap, sampler_BumpMap, i.uv0XY_bitZ_fog.xy);
half3 normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
half3x3 TStoWS = half3x3(
i.normalWS.w, i.tanYZ_bitXY.z, i.normalWS.x,
i.tanYZ_bitXY.x, i.tanYZ_bitXY.w, i.normalWS.y,
i.tanYZ_bitXY.y, i.uv0XY_bitZ_fog.z, i.normalWS.z
);
half3 normalWS = mul(TStoWS, normalTS);
normalWS = normalize(normalWS);
normals = half4(EncodeWSNormalForNormalsTex(normalWS),0);
// End Injection FRAG_NORMALS from Injection_NormalMap_DepthNormals.hlsl ----------------------------------------------------------
return normals;
}

View file

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

View file

@ -0,0 +1,24 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd7d1f8f9838c1541abbb5c264b254f6, type: 3}
m_Name: ImpactsForward
m_EditorClassIdentifier:
outputInclude: {fileID: 10900000, guid: b47f670ca34e7624bad7cef6b3c12c7c, type: 3}
baseInclude: {fileID: 10900000, guid: d5426963259cc9a41b440011880b9fc2, type: 3}
injectableIncludes:
- {fileID: 10900000, guid: 16380cd34ea8abf41b69d1f248057b10, type: 3}
- {fileID: 10900000, guid: 86d5c622b75cede49857fef3a19dae5a, type: 3}
- {fileID: 10900000, guid: 37d63b61721eb5d4987f1255f95280fd, type: 3}
- {fileID: 10900000, guid: 4429048560c117944b437d3b58bc4c06, type: 3}
- {fileID: 10900000, guid: edf866d9d0f87324485d1946e3e8565e, type: 3}
- {fileID: 10900000, guid: 06b5d3c20722dff4785f46b9abafe74c, type: 3}
- {fileID: 10900000, guid: bae3419c672853f49a5835566fa8d1df, type: 3}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 53eecaa88ee9f65409ecb95ba89f74c7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,370 @@
/*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*
* WARNING: THIS FILE WAS CREATED WITH SHADERINJECTOR, AND SHOULD NOT BE EDITED DIRECTLY. MODIFY THE *
* BASE INCLUDE AND INJECTED FILES INSTEAD, AND REGENERATE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *
*-----------------------------------------------------------------------------------------------------*
*-----------------------------------------------------------------------------------------------------*/
#define SHADERPASS SHADERPASS_FORWARD
#define _NORMAL_DROPOFF_TS 1
#define _EMISSION
#define _NORMALMAP 1
#if defined(SHADER_API_MOBILE)
#define _ADDITIONAL_LIGHTS_VERTEX
#else
#pragma multi_compile_fragment _ _MAIN_LIGHT_SHADOWS_CASCADE
//#define DYNAMIC_SCREEN_SPACE_OCCLUSION
#pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
//#define DYNAMIC_ADDITIONAL_LIGHTS
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHTS
//#define DYNAMIC_ADDITIONAL_LIGHT_SHADOWS
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
#define _SHADOWS_SOFT 1
#define _REFLECTION_PROBE_BLENDING
//#pragma shader_feature_fragment _REFLECTION_PROBE_BOX_PROJECTION
// We don't need a keyword for this! the w component of the probe position already branches box vs non-box, & so little cost on pc it doesn't matter
#define _REFLECTION_PROBE_BOX_PROJECTION
// Begin Injection STANDALONE_DEFINES from Injection_SSR.hlsl ----------------------------------------------------------
#pragma multi_compile _ _SLZ_SSR_ENABLED
#pragma shader_feature_local _ _NO_SSR
#if defined(_SLZ_SSR_ENABLED) && !defined(_NO_SSR) && !defined(SHADER_API_MOBILE)
#define _SSR_ENABLED
#endif
// End Injection STANDALONE_DEFINES from Injection_SSR.hlsl ----------------------------------------------------------
#endif
#pragma multi_compile_fragment _ _LIGHT_COOKIES
#pragma multi_compile _ SHADOWS_SHADOWMASK
#pragma multi_compile_fragment _ _VOLUMETRICS_ENABLED
#pragma multi_compile_fog
#pragma skip_variants FOG_LINEAR FOG_EXP
//#pragma multi_compile_fragment _ DEBUG_DISPLAY
#pragma multi_compile_fragment _ _DETAILS_ON
//#pragma multi_compile_fragment _ _EMISSION_ON
// Begin Injection UNIVERSAL_DEFINES from Injection_SSR_CBuffer_Posespace.hlsl ----------------------------------------------------------
#define _SSRTemporalMul 0
// End Injection UNIVERSAL_DEFINES from Injection_SSR_CBuffer_Posespace.hlsl ----------------------------------------------------------
#if defined(LITMAS_FEATURE_LIGHTMAPPING)
#pragma multi_compile _ LIGHTMAP_ON
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
#endif
#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"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DBuffer.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPass.hlsl"
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZLighting.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZBlueNoise.hlsl"
// Begin Injection INCLUDES from Injection_Impacts_CBuffer.hlsl ----------------------------------------------------------
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl"
// End Injection INCLUDES from Injection_Impacts_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection INCLUDES from Injection_Impacts.hlsl ----------------------------------------------------------
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl"
// End Injection INCLUDES from Injection_Impacts.hlsl ----------------------------------------------------------
// Begin Injection INCLUDES from Injection_SSR.hlsl ----------------------------------------------------------
#if !defined(SHADER_API_MOBILE)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZLightingSSR.hlsl"
#endif
// End Injection INCLUDES from Injection_SSR.hlsl ----------------------------------------------------------
struct VertIn
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float4 uv0 : TEXCOORD0;
float4 uv1 : TEXCOORD1;
float4 uv2 : TEXCOORD2;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertOut
{
float4 vertex : SV_POSITION;
float4 uv0XY_bitZ_fog : TEXCOORD0;
#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
float4 uv1 : TEXCOORD1;
#endif
half4 SHVertLights : TEXCOORD2;
half4 normXYZ_tanX : TEXCOORD3;
float3 wPos : TEXCOORD4;
// Begin Injection INTERPOLATORS from Injection_SSR.hlsl ----------------------------------------------------------
float4 lastVertex : TEXCOORD5;
// End Injection INTERPOLATORS from Injection_SSR.hlsl ----------------------------------------------------------
// Begin Injection INTERPOLATORS from Injection_NormalMaps.hlsl ----------------------------------------------------------
half4 tanYZ_bitXY : TEXCOORD6;
// End Injection INTERPOLATORS from Injection_NormalMaps.hlsl ----------------------------------------------------------
// Begin Injection INTERPOLATORS from Injection_Impacts.hlsl ----------------------------------------------------------
float3 unskinnedObjPos : TEXCOORD7;
// End Injection INTERPOLATORS from Injection_Impacts.hlsl ----------------------------------------------------------
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
TEXTURE2D(_BumpMap);
TEXTURE2D(_MetallicGlossMap);
TEXTURE2D(_DetailMap);
SAMPLER(sampler_DetailMap);
// Begin Injection UNIFORMS from Injection_Emission.hlsl ----------------------------------------------------------
TEXTURE2D(_EmissionMap);
// End Injection UNIFORMS from Injection_Emission.hlsl ----------------------------------------------------------
CBUFFER_START(UnityPerMaterial)
// Begin Injection MATERIAL_CBUFFER_EARLY from Injection_Impacts_CBuffer.hlsl ----------------------------------------------------------
half4x4 EllipsoidPosArray[HitMatrixCount];
int _NumberOfHits;
half4 _HitColor;
// End Injection MATERIAL_CBUFFER_EARLY from Injection_Impacts_CBuffer.hlsl ----------------------------------------------------------
float4 _BaseMap_ST;
half4 _BaseColor;
// Begin Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
float4 _DetailMap_ST;
half _Details;
half _Normals;
// End Injection MATERIAL_CBUFFER from Injection_NormalMap_CBuffer.hlsl ----------------------------------------------------------
// Begin Injection MATERIAL_CBUFFER from Injection_Emission.hlsl ----------------------------------------------------------
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
// End Injection MATERIAL_CBUFFER from Injection_Emission.hlsl ----------------------------------------------------------
int _Surface;
CBUFFER_END
half3 OverlayBlendDetail(half source, half3 destination)
{
half3 switch0 = round(destination); // if destination >= 0.5 then 1, else 0 assuming 0-1 input
half3 blendGreater = mad(mad(2.0, destination, -2.0), 1.0 - source, 1.0); // (2.0 * destination - 2.0) * ( 1.0 - source) + 1.0
half3 blendLesser = (2.0 * source) * destination;
return mad(switch0, blendGreater, mad(-switch0, blendLesser, blendLesser)); // switch0 * blendGreater + (1 - switch0) * blendLesser
//return half3(destination.r > 0.5 ? blendGreater.r : blendLesser.r,
// destination.g > 0.5 ? blendGreater.g : blendLesser.g,
// destination.b > 0.5 ? blendGreater.b : blendLesser.b
// );
}
VertOut vert(VertIn v)
{
VertOut o = (VertOut)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.wPos = TransformObjectToWorld(v.vertex.xyz);
o.vertex = TransformWorldToHClip(o.wPos);
o.uv0XY_bitZ_fog.xy = v.uv0.xy;
#if defined(LIGHTMAP_ON) || defined(DIRLIGHTMAP_COMBINED)
OUTPUT_LIGHTMAP_UV(v.uv1.xy, unity_LightmapST, o.uv1.xy);
#endif
#ifdef DYNAMICLIGHTMAP_ON
OUTPUT_LIGHTMAP_UV(v.uv2.xy, unity_DynamicLightmapST, o.uv1.zw);
#endif
// Exp2 fog
half clipZ_0Far = UNITY_Z_0_FAR_FROM_CLIPSPACE(o.vertex.z);
o.uv0XY_bitZ_fog.w = unity_FogParams.x * clipZ_0Far;
// Begin Injection VERTEX_NORMALS from Injection_NormalMaps.hlsl ----------------------------------------------------------
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.normXYZ_tanX = half4(ntb.normalWS, ntb.tangentWS.x);
o.tanYZ_bitXY = half4(ntb.tangentWS.yz, ntb.bitangentWS.xy);
o.uv0XY_bitZ_fog.z = ntb.bitangentWS.z;
// End Injection VERTEX_NORMALS from Injection_NormalMaps.hlsl ----------------------------------------------------------
o.SHVertLights = 0;
// Calculate vertex lights and L2 probe lighting on quest
o.SHVertLights.xyz = VertexLighting(o.wPos, o.normXYZ_tanX.xyz);
#if !defined(LIGHTMAP_ON) && !defined(DYNAMICLIGHTMAP_ON) && defined(SHADER_API_MOBILE)
o.SHVertLights.xyz += SampleSHVertex(o.normXYZ_tanX.xyz);
#endif
// Begin Injection VERTEX_END from Injection_SSR.hlsl ----------------------------------------------------------
#if defined(_SSR_ENABLED)
float4 lastWPos = mul(GetPrevObjectToWorldMatrix(), v.vertex);
o.lastVertex = mul(prevVP, lastWPos);
#endif
// End Injection VERTEX_END from Injection_SSR.hlsl ----------------------------------------------------------
// Begin Injection VERTEX_END from Injection_Impacts.hlsl ----------------------------------------------------------
o.unskinnedObjPos = v.uv1.xyz;
// End Injection VERTEX_END from Injection_Impacts.hlsl ----------------------------------------------------------
return o;
}
half4 frag(VertOut i) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(i);
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Read Input Data---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
float2 uv_main = mad(float2(i.uv0XY_bitZ_fog.xy), _BaseMap_ST.xy, _BaseMap_ST.zw);
float2 uv_detail = mad(float2(i.uv0XY_bitZ_fog.xy), _DetailMap_ST.xy, _DetailMap_ST.zw);
half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv_main);
half4 mas = SAMPLE_TEXTURE2D(_MetallicGlossMap, sampler_BaseMap, uv_main);
albedo *= _BaseColor;
half metallic = mas.r;
half ao = mas.g;
half smoothness = mas.b;
// Begin Injection FRAG_POST_INPUTS from Injection_Impacts.hlsl ----------------------------------------------------------
half2 impactUV = GetClosestImpactUV(i.unskinnedObjPos, EllipsoidPosArray, _NumberOfHits);
half4 impactMASI = SampleHitTexture(impactUV);
impactMASI.a = impactUV.x > 0.999 ? 0 : impactMASI.a;
albedo = lerp(albedo, _HitColor, impactMASI.a);
metallic = lerp(metallic, impactMASI.r, impactMASI.a);
smoothness = lerp(smoothness, impactMASI.b, impactMASI.a);
ao = min(ao, max(1.0 - impactMASI.a, impactMASI.g));
// End Injection FRAG_POST_INPUTS from Injection_Impacts.hlsl ----------------------------------------------------------
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Sample Normal Map-------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
half3 normalTS = half3(0, 0, 1);
half geoSmooth = 1;
half4 normalMap = half4(0, 0, 1, 0);
// Begin Injection NORMAL_MAP from Injection_NormalMaps.hlsl ----------------------------------------------------------
normalMap = SAMPLE_TEXTURE2D(_BumpMap, sampler_BaseMap, uv_main);
normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
geoSmooth = _Normals ? normalMap.b : 1.0;
smoothness = saturate(smoothness + geoSmooth - 1.0);
// End Injection NORMAL_MAP from Injection_NormalMaps.hlsl ----------------------------------------------------------
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Read Detail Map---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
#if defined(_DETAILS_ON)
// Begin Injection DETAIL_MAP from Injection_NormalMaps.hlsl ----------------------------------------------------------
half4 detailMap = SAMPLE_TEXTURE2D(_DetailMap, sampler_DetailMap, uv_detail);
half3 detailTS = half3(2.0 * detailMap.ag - 1.0, 1.0);
normalTS = BlendNormal(normalTS, detailTS);
// End Injection DETAIL_MAP from Injection_NormalMaps.hlsl ----------------------------------------------------------
smoothness = saturate(2.0 * detailMap.b * smoothness);
albedo.rgb = OverlayBlendDetail(detailMap.r, albedo.rgb);
#endif
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Transform Normals To Worldspace-----------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
// Begin Injection NORMAL_TRANSFORM from Injection_NormalMaps.hlsl ----------------------------------------------------------
half3 normalWS = i.normXYZ_tanX.xyz;
half3x3 TStoWS = half3x3(
i.normXYZ_tanX.w, i.tanYZ_bitXY.z, normalWS.x,
i.tanYZ_bitXY.x, i.tanYZ_bitXY.w, normalWS.y,
i.tanYZ_bitXY.y, i.uv0XY_bitZ_fog.z, normalWS.z
);
normalWS = mul(TStoWS, normalTS);
normalWS = normalize(normalWS);
// End Injection NORMAL_TRANSFORM from Injection_NormalMaps.hlsl ----------------------------------------------------------
/*---------------------------------------------------------------------------------------------------------------------------*/
/*---Lighting Calculations---------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/
// Begin Injection SPEC_AA from Injection_NormalMaps.hlsl ----------------------------------------------------------
#if !defined(SHADER_API_MOBILE) && !defined(LITMAS_FEATURE_TP) // Specular antialiasing based on normal derivatives. Only on PC to avoid cost of derivatives on Quest
smoothness = min(smoothness, SLZGeometricSpecularAA(normalWS));
#endif
// End Injection SPEC_AA from Injection_NormalMaps.hlsl ----------------------------------------------------------
#if defined(LIGHTMAP_ON)
SLZFragData fragData = SLZGetFragData(i.vertex, i.wPos, normalWS, i.uv1.xy, i.uv1.zw, i.SHVertLights.xyz);
#else
SLZFragData fragData = SLZGetFragData(i.vertex, i.wPos, normalWS, float2(0, 0), float2(0, 0), i.SHVertLights.xyz);
#endif
half4 emission = half4(0,0,0,0);
// Begin Injection EMISSION from Injection_Emission.hlsl ----------------------------------------------------------
UNITY_BRANCH if (_Emission)
{
emission += SAMPLE_TEXTURE2D(_EmissionMap, sampler_BaseMap, uv_main) * _EmissionColor;
emission.rgb *= lerp(albedo.rgb, half3(1, 1, 1), emission.a);
emission.rgb *= pow(abs(fragData.NoV), _EmissionFalloff);
}
// End Injection EMISSION from Injection_Emission.hlsl ----------------------------------------------------------
SLZSurfData surfData = SLZGetSurfDataMetallicGloss(albedo.rgb, saturate(metallic), saturate(smoothness), ao, emission.rgb, albedo.a);
half4 color = half4(1, 1, 1, 1);
// Begin Injection LIGHTING_CALC from Injection_SSR.hlsl ----------------------------------------------------------
#if defined(_SSR_ENABLED)
half4 noiseRGBA = GetScreenNoiseRGBA(fragData.screenUV);
SSRExtraData ssrExtra;
ssrExtra.meshNormal = i.normXYZ_tanX.xyz;
ssrExtra.lastClipPos = i.lastVertex;
ssrExtra.temporalWeight = _SSRTemporalMul;
ssrExtra.depthDerivativeSum = 0;
ssrExtra.noise = noiseRGBA;
ssrExtra.fogFactor = i.uv0XY_bitZ_fog.w;
color = SLZPBRFragmentSSR(fragData, surfData, ssrExtra, _Surface);
color.rgb = max(0, color.rgb);
#else
color = SLZPBRFragment(fragData, surfData, _Surface);
#endif
// End Injection LIGHTING_CALC from Injection_SSR.hlsl ----------------------------------------------------------
// Begin Injection VOLUMETRIC_FOG from Injection_SSR.hlsl ----------------------------------------------------------
#if !defined(_SSR_ENABLED)
color = MixFogSurf(color, -fragData.viewDir, i.uv0XY_bitZ_fog.w, _Surface);
color = VolumetricsSurf(color, fragData.position, _Surface);
#endif
// End Injection VOLUMETRIC_FOG from Injection_SSR.hlsl ----------------------------------------------------------
return color;
}

View file

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

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a7ce65b0ba12266419c2287a13fb5e78
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,3 @@
//#!INJECT_BEGIN EMISSION 100
emission.rgb *= 8;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,20 @@
//#!INJECT_BEGIN VERTEX_IN 4
half3 normal : NORMAL;
half4 tangent : TANGENT;
//#!INJECT_END
//#!INJECT_BEGIN INTERPOLATORS 4
//#!TEXCOORD half2x3 TStoWS 1
//#!INJECT_END
//#!INJECT_BEGIN VERTEX_END 0
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.TStoWS = half2x3(ntb.normalWS.x, ntb.tangentWS.x, ntb.bitangentWS.x,
ntb.normalWS.y, ntb.tangentWS.y, ntb.bitangentWS.y
);
//#!INJECT_END
//#!INJECT_BEGIN FRAG_POST_INPUTS 0
half2x3 TStoWS = i.TStoWS;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,12 @@
//#!INJECT_BEGIN UNIVERSAL_DEFINES 1
#define _SLZ_ANISO_SPECULAR
//#!INJECT_END
//#!INJECT_BEGIN MATERIAL_CBUFFER 1
half _AnisoAspect;
//#!INJECT_END
//#!INJECT_BEGIN PRE_LIGHTING_CALC 1
SLZSurfDataAddAniso(surfData, _AnisoAspect);
SLZFragDataAddAniso(fragData, TStoWS._m00_m10_m20, TStoWS._m01_m11_m21, surfData.roughnessT, surfData.roughnessB);
//#!INJECT_END

View file

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

View file

@ -0,0 +1,82 @@
//#!INJECT_BEGIN INCLUDES 1
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/AudioLink/Shaders/AudioLink.cginc"
//#!INJECT_END
//#!INJECT_BEGIN UNIFORMS 1
TEXTURE2D(_AudioLinkMap);
SAMPLER(sampler_AudioLinkMap);
TEXTURE2D(_AudioLinkNoise);
SAMPLER(sampler_AudioLinkNoise);
//#!INJECT_END
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
half _AudioInputBoost;
half _SmoothstepBlend;
half _AudioLinkBaseBlend;
half4 _LowsColor;
half4 _MidsColor;
half4 _HighsColor;
//#!INJECT_END
//#!INJECT_BEGIN FUNCTIONS 0
half GetALChannelIntensity(half channelValue, half channelMask)
{
half smoothstepMin = saturate(1.0 - (channelValue + _AudioInputBoost));
half smoothstepMax = smoothstepMin + _SmoothstepBlend + 0.01;
half output = smoothstep(smoothstepMin, smoothstepMax, channelMask);
return output;
}
float GetALChronotensity()
{
return (AudioLinkDecodeDataAsUInt(ALPASS_CHRONOTENSITY + uint2(0, 0)) % 628319) / 100000.0;
}
float ALPanU(float u, float velocity, float time)
{
return u + frac(velocity*time);
}
// What even is this bullshit? I'm just copying this verbatim from the amplify version, this math makes no sense
half4 GetALNoise(float u, half3 viewDir, half2x3 tan2wrldXY)
{
float chrono = 0.5 * GetALChronotensity();
chrono = (0.5 * _Time[1]) + chrono;
u = ALPanU(u, 0.17, chrono);
u = sin(6.0 * u);
float2 uv1 = viewDir.xy;
float2 uv2 = mul(tan2wrldXY, viewDir);
float2 uv = lerp(uv1, uv2, u);
return SAMPLE_TEXTURE2D(_AudioLinkNoise, sampler_AudioLinkNoise, uv);
}
half4 GetALChannelValue(half2 audioLinkMask, half channelValue, half4 channelColor, half4 noiseColor)
{
half4 a = (channelColor * noiseColor);
half aNoise = (audioLinkMask.x * _AudioLinkBaseBlend);
half aMain = (audioLinkMask.y * channelValue);
return a * (aNoise + aMain);
}
//#!INJECT_END
//#!INJECT_BEGIN EMISSION 0
#if defined(PASS_META)
half4 audioLinkNoise = GetALNoise(uv_main.x, half3(1, 1, 1), (half2x3)TStoWS);
#else
half4 audioLinkNoise = GetALNoise(uv_main.x, fragData.viewDir, (half2x3)TStoWS);
#endif
half4 audioLinkMask = SAMPLE_TEXTURE2D(_AudioLinkMap, sampler_AudioLinkMap, uv_main);
half audioLows = AudioLinkData(ALPASS_AUDIOBASS).x;
audioLows = GetALChannelIntensity(audioLows, audioLinkMask.r);
emission += GetALChannelValue(audioLinkMask.ra, audioLows, _LowsColor, audioLinkNoise);
half audioMids = AudioLinkData(ALPASS_AUDIOLOWMIDS).x;
audioMids = GetALChannelIntensity(audioMids, audioLinkMask.g);
emission += GetALChannelValue(audioLinkMask.ga, audioMids, _MidsColor, audioLinkNoise);
half audioHighs = AudioLinkData(ALPASS_AUDIOHIGHMIDS).x + AudioLinkData(ALPASS_AUDIOTREBLE).x * 0.5;
audioHighs = GetALChannelIntensity(audioHighs, audioLinkMask.b);
emission += GetALChannelValue(audioLinkMask.ba, audioHighs, _HighsColor, audioLinkNoise);
//#!INJECT_END

View file

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

View file

@ -0,0 +1,8 @@
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
half _AudioInputBoost;
half _SmoothstepBlend;
half _AudioLinkBaseBlend;
half4 _LowsColor;
half4 _MidsColor;
half4 _HighsColor;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,6 @@
//#!INJECT_BEGIN FRAG_READ_INPUTS 0
float2 uv_main = mad(float2(i.uv0XY_bitZ_fog.xy), _BaseMap_ST.xy, _BaseMap_ST.zw);
float2 uv_detail = mad(float2(i.uv0XY_bitZ_fog.xy), _DetailMap_ST.xy, _DetailMap_ST.zw);
half4 albedo = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv_main) * _BaseColor;
half3 mas = SAMPLE_TEXTURE2D(_MetallicGlossMap, sampler_BaseMap, uv_main).rgb;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,19 @@
//#!INJECT_BEGIN UNIFORMS 0
TEXTURE2D(_EmissionMap);
//#!INJECT_END
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
//#!INJECT_END
//#!INJECT_BEGIN EMISSION 10
UNITY_BRANCH if (_Emission)
{
emission += SAMPLE_TEXTURE2D(_EmissionMap, sampler_BaseMap, uv_main) * _EmissionColor;
emission.rgb *= lerp(albedo.rgb, half3(1, 1, 1), emission.a);
emission.rgb *= pow(abs(fragData.NoV), _EmissionFalloff);
}
//#!INJECT_END

View file

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

View file

@ -0,0 +1,40 @@
//#!INJECT_BEGIN UNIFORMS 0
Texture2D<float4> _BaseMap;
SamplerState sampler_BaseMap;
Texture2D<float4> _EmissionMap;
SamplerState sampler_EmissionMap;
//#!INJECT_END
//#!INJECT_BEGIN CLOSEST_HIT 0
uint2 launchIdx = DispatchRaysIndex();
uint primitiveIndex = PrimitiveIndex();
uint3 triangleIndicies = UnityRayTracingFetchTriangleIndices(primitiveIndex);
Vertex v0, v1, v2;
v0.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.x, kVertexAttributeTexCoord0);
v1.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.y, kVertexAttributeTexCoord0);
v2.texcoord = UnityRayTracingFetchVertexAttribute2(triangleIndicies.z, kVertexAttributeTexCoord0);
// v0.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.x, kVertexAttributeNormal);
// v1.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.y, kVertexAttributeNormal);
// v2.normal = UnityRayTracingFetchVertexAttribute3(triangleIndicies.z, kVertexAttributeNormal);
float3 barycentrics = float3(1.0 - attributes.barycentrics.x - attributes.barycentrics.y, attributes.barycentrics.x, attributes.barycentrics.y);
Vertex vInterpolated;
vInterpolated.texcoord = v0.texcoord * barycentrics.x + v1.texcoord * barycentrics.y + v2.texcoord * barycentrics.z;
//TODO: Extract normal direction to ignore the backside of emissive objects
//vInterpolated.normal = v0.normal * barycentrics.x + v1.normal * barycentrics.y + v2.normal * barycentrics.z;
// if ( dot(vInterpolated.normal, float3(1,0,0) < 0) ) payload.color = float4(0,10,0,1) ;
// else payload.color = float4(10,0,0,1) ;
float4 albedo = float4(_BaseMap.SampleLevel(sampler_BaseMap, vInterpolated.texcoord.xy * _BaseMap_ST.xy + _BaseMap_ST.zw, 0).rgb, 1) * _BaseColor;
float4 emission = _Emission * _EmissionMap.SampleLevel(sampler_EmissionMap, vInterpolated.texcoord * _BaseMap_ST.xy + _BaseMap_ST.zw, 0) * _EmissionColor;
emission.rgb *= lerp(albedo.rgb, 1, emission.a);
payload.color.rgb = emission.rgb * _BakedMutiplier;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,6 @@
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
half _Emission;
half4 _EmissionColor;
half _EmissionFalloff;
half _BakedMutiplier;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,13 @@
//#!INJECT_BEGIN UNIFORMS 0
TEXTURE2D(_EmissionMap);
//#!INJECT_END
//#!INJECT_BEGIN EMISSION 10
if (_Emission)
{
half4 emissionDefault = _EmissionColor * SAMPLE_TEXTURE2D(_EmissionMap, sampler_BaseMap, i.uv);
emissionDefault.rgb *= _BakedMutiplier * _Emission;
emissionDefault.rgb *= lerp(albedo.rgb, half3(1, 1, 1), emissionDefault.a);
emission += emissionDefault;
}
//#!INJECT_END

View file

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

View file

@ -0,0 +1,4 @@
//#!INJECT_BEGIN PRE_LIGHTING_CALC 100
surfData.specular *= albedo.rgb/Max3(albedo.r,albedo.g,albedo.b);
//#!INJECT_END

View file

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

View file

@ -0,0 +1,22 @@
//#!INJECT_BEGIN INCLUDES 0
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl"
//#!INJECT_END
//#!INJECT_BEGIN INTERPOLATORS 6
//#!TEXCOORD float3 unskinnedObjPos 1
//#!INJECT_END
//#!INJECT_BEGIN VERTEX_END 1
o.unskinnedObjPos = v.uv1.xyz;
//#!INJECT_END
//#!INJECT_BEGIN FRAG_POST_INPUTS 0
half2 impactUV = GetClosestImpactUV(i.unskinnedObjPos, EllipsoidPosArray, _NumberOfHits);
half4 impactMASI = SampleHitTexture(impactUV);
impactMASI.a = impactUV.x > 0.999 ? 0 : impactMASI.a;
albedo = lerp(albedo, _HitColor, impactMASI.a);
metallic = lerp(metallic, impactMASI.r, impactMASI.a);
smoothness = lerp(smoothness, impactMASI.b, impactMASI.a);
ao = min(ao, max(1.0 - impactMASI.a, impactMASI.g));
//#!INJECT_END

View file

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

View file

@ -0,0 +1,10 @@
//#!INJECT_BEGIN INCLUDES 0
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/PosespaceImpacts.hlsl"
//#!INJECT_END
//#!INJECT_BEGIN MATERIAL_CBUFFER_EARLY 0
half4x4 EllipsoidPosArray[HitMatrixCount];
int _NumberOfHits;
half4 _HitColor;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,8 @@
//#!INJECT_BEGIN FUNCTIONS 0
float function1()
//#!INJECT_END
//#!INJECT_BEGIN PRE_FRAGDATA 0
ao *= i.color.a;
albedo *= i.color.rgb;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,5 @@
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
float4 _DetailMap_ST;
half _Details;
half _Normals;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,39 @@
//#!INJECT_BEGIN VERTEX_IN 0
float4 tangent : TANGENT;
//#!TEXCOORD float2 uv0 0
//#!INJECT_END
//#!INJECT_BEGIN UNIFORMS 0
TEXTURE2D(_BumpMap);
SAMPLER(sampler_BumpMap);
//#!INJECT_END
//#!INJECT_BEGIN INTERPOLATORS 4
//#!TEXCOORD float4 tanYZ_bitXY 1
//#!TEXCOORD float4 uv0XY_bitZ_fog 1
//#!INJECT_END
//#!INJECT_BEGIN VERTEX_NORMAL 0
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.normalWS = float4(ntb.normalWS, ntb.tangentWS.x);
o.tanYZ_bitXY = float4(ntb.tangentWS.yz, ntb.bitangentWS.xy);
o.uv0XY_bitZ_fog.zw = ntb.bitangentWS.zz;
o.uv0XY_bitZ_fog.xy = TRANSFORM_TEX(v.uv0, _BaseMap);
//#!INJECT_END
//#!INJECT_BEGIN FRAG_NORMALS 0
half4 normalMap = SAMPLE_TEXTURE2D(_BumpMap, sampler_BumpMap, i.uv0XY_bitZ_fog.xy);
half3 normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
half3x3 TStoWS = half3x3(
i.normalWS.w, i.tanYZ_bitXY.z, i.normalWS.x,
i.tanYZ_bitXY.x, i.tanYZ_bitXY.w, i.normalWS.y,
i.tanYZ_bitXY.y, i.uv0XY_bitZ_fog.z, i.normalWS.z
);
half3 normalWS = mul(TStoWS, normalTS);
normalWS = normalize(normalWS);
normals = half4(EncodeWSNormalForNormalsTex(normalWS),0);
//#!INJECT_END

View file

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

View file

@ -0,0 +1,42 @@
//#!INJECT_BEGIN INTERPOLATORS 4
//#!TEXCOORD half4 tanYZ_bitXY 1
//#!INJECT_END
//#!INJECT_BEGIN VERTEX_NORMALS 0
VertexNormalInputs ntb = GetVertexNormalInputs(v.normal, v.tangent);
o.normXYZ_tanX = half4(ntb.normalWS, ntb.tangentWS.x);
o.tanYZ_bitXY = half4(ntb.tangentWS.yz, ntb.bitangentWS.xy);
o.uv0XY_bitZ_fog.z = ntb.bitangentWS.z;
//#!INJECT_END
//#!INJECT_BEGIN NORMAL_MAP 0
normalMap = SAMPLE_TEXTURE2D(_BumpMap, sampler_BaseMap, uv_main);
normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
geoSmooth = _Normals ? normalMap.b : 1.0;
smoothness = saturate(smoothness + geoSmooth - 1.0);
//#!INJECT_END
//#!INJECT_BEGIN DETAIL_MAP 0
half4 detailMap = SAMPLE_TEXTURE2D(_DetailMap, sampler_DetailMap, uv_detail);
half3 detailTS = half3(2.0 * detailMap.ag - 1.0, 1.0);
normalTS = BlendNormal(normalTS, detailTS);
//#!INJECT_END
//#!INJECT_BEGIN NORMAL_TRANSFORM 0
half3 normalWS = i.normXYZ_tanX.xyz;
half3x3 TStoWS = half3x3(
i.normXYZ_tanX.w, i.tanYZ_bitXY.z, normalWS.x,
i.tanYZ_bitXY.x, i.tanYZ_bitXY.w, normalWS.y,
i.tanYZ_bitXY.y, i.uv0XY_bitZ_fog.z, normalWS.z
);
normalWS = mul(TStoWS, normalTS);
normalWS = normalize(normalWS);
//#!INJECT_END
//#!INJECT_BEGIN SPEC_AA 0
#if !defined(SHADER_API_MOBILE) && !defined(LITMAS_FEATURE_TP) // Specular antialiasing based on normal derivatives. Only on PC to avoid cost of derivatives on Quest
smoothness = min(smoothness, SLZGeometricSpecularAA(normalWS));
#endif
//#!INJECT_END

View file

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

View file

@ -0,0 +1,51 @@
//#!INJECT_BEGIN STANDALONE_DEFINES 0
#pragma multi_compile _ _SLZ_SSR_ENABLED
#pragma shader_feature_local _ _NO_SSR
#if defined(_SLZ_SSR_ENABLED) && !defined(_NO_SSR) && !defined(SHADER_API_MOBILE)
#define _SSR_ENABLED
#endif
//#!INJECT_END
//#!INJECT_BEGIN INCLUDES 0
#if !defined(SHADER_API_MOBILE)
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZLightingSSR.hlsl"
#endif
//#!INJECT_END
//#!INJECT_BEGIN INTERPOLATORS 1
//#!TEXCOORD float4 lastVertex 1
//#!INJECT_END
//#!INJECT_BEGIN VERTEX_END 0
#if defined(_SSR_ENABLED)
float4 lastWPos = mul(GetPrevObjectToWorldMatrix(), v.vertex);
o.lastVertex = mul(prevVP, lastWPos);
#endif
//#!INJECT_END
//#!INJECT_BEGIN LIGHTING_CALC 0
#if defined(_SSR_ENABLED)
half4 noiseRGBA = GetScreenNoiseRGBA(fragData.screenUV);
SSRExtraData ssrExtra;
ssrExtra.meshNormal = i.normXYZ_tanX.xyz;
ssrExtra.lastClipPos = i.lastVertex;
ssrExtra.temporalWeight = _SSRTemporalMul;
ssrExtra.depthDerivativeSum = 0;
ssrExtra.noise = noiseRGBA;
ssrExtra.fogFactor = i.uv0XY_bitZ_fog.w;
color = SLZPBRFragmentSSR(fragData, surfData, ssrExtra, _Surface);
color.rgb = max(0, color.rgb);
#else
color = SLZPBRFragment(fragData, surfData, _Surface);
#endif
//#!INJECT_END
//#!INJECT_BEGIN VOLUMETRIC_FOG 0
#if !defined(_SSR_ENABLED)
color = MixFogSurf(color, -fragData.viewDir, i.uv0XY_bitZ_fog.w, _Surface);
color = VolumetricsSurf(color, fragData.position, _Surface);
#endif
//#!INJECT_END

View file

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

View file

@ -0,0 +1,3 @@
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
float _SSRTemporalMul;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,3 @@
//#!INJECT_BEGIN UNIVERSAL_DEFINES 0
#define _SSRTemporalMul 0
//#!INJECT_END

View file

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

View file

@ -0,0 +1,98 @@
//#!INJECT_BEGIN UNIVERSAL_DEFINES 1
#pragma multi_compile_local_fragment _ _EXPENSIVE_TP
#if defined(_EXPENSIVE_TP)
#define SLZ_SAMPLE_TP_MAIN(tex, sampl, uv) SAMPLE_TEXTURE2D_GRAD(tex, sampl, uv, ddxMain, ddyMain)
#define SLZ_SAMPLE_TP_DETAIL(tex, sampl, uv) SAMPLE_TEXTURE2D_GRAD(tex, sampl, uv, ddxDetail, ddyDetail)
#else
#define SLZ_SAMPLE_TP_MAIN(tex, sampl, uv) SAMPLE_TEXTURE2D(tex, sampl, uv)
#define SLZ_SAMPLE_TP_DETAIL(tex, sampl, uv) SAMPLE_TEXTURE2D(tex, sampl, uv)
#endif
//#!INJECT_END
//#!INJECT_BEGIN INCLUDES 0
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SLZTriplanar.hlsl"
//#!INJECT_END
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
float4 _DetailMap_ST;
half _Details;
half _Normals;
half _DetailsuseLocalUVs;
half _RotateUVs;
half _UVScaler;
//#!INJECT_END
//#!INJECT_BEGIN VERTEX_NORMALS 0
o.normXYZ_tanX = half4(TransformObjectToWorldNormal(v.normal, false), 0);
o.uv0XY_bitZ_fog.z = v.tangent.w; //Avoid optimization that would remove the tangent from the vertex input (causes issues)
//#!INJECT_END
//#!INJECT_BEGIN FRAG_READ_INPUTS 0
/*-Triplanar---------------------------------------------------------------------------------------------------------*/
float2 uvTP;
half3x3 TStoWsTP;
half2 scale = 1.0/_UVScaler;
#if defined(_EXPENSIVE_TP)
tpDerivatives tpDD;
GetDirectionalDerivatives(i.wPos, tpDD);
half2 ddxTP, ddyTP;
GetTPUVExpensive(uvTP, ddxTP, ddyTP, TStoWsTP, i.wPos, normalize(i.normXYZ_tanX.xyz), tpDD);
ddxTP = _RotateUVs ? half2(-ddxTP.y, ddxTP.x) : ddxTP;
ddyTP = _RotateUVs ? half2(-ddyTP.y, ddyTP.x) : ddyTP;
half2 ddxMain = ddxTP * scale;
half2 ddyMain = ddyTP * scale;
#else
GetTPUVCheap(uvTP, TStoWsTP, i.wPos, normalize(i.normXYZ_tanX.xyz));
#endif
uvTP = _RotateUVs ? float2(-uvTP.y, uvTP.x) : uvTP;
float2 uv_main = mad(uvTP, scale, _BaseMap_ST.zw);
half4 albedo = SLZ_SAMPLE_TP_MAIN(_BaseMap, sampler_BaseMap, uv_main);
half3 mas = SLZ_SAMPLE_TP_MAIN(_MetallicGlossMap, sampler_BaseMap, uv_main).rgb;
//#!INJECT_END
//#!INJECT_BEGIN NORMAL_MAP 0
/*-Triplanar Psuedo tangent space normals----------------------------------------------------------------------------*/
normalMap = SLZ_SAMPLE_TP_MAIN(_BumpMap, sampler_BaseMap, uv_main);
normalTS = UnpackNormal(normalMap);
normalTS = _Normals ? normalTS : half3(0, 0, 1);
normalTS = _RotateUVs ? half3(normalTS.y, -normalTS.x, normalTS.z) : normalTS;
geoSmooth = _Normals ? normalMap.b : 1.0;
smoothness = saturate(smoothness + geoSmooth - 1.0);
//#!INJECT_END
//#!INJECT_BEGIN DETAIL_MAP 0
/*-Triplanar---------------------------------------------------------------------------------------------------------*/
float2 uv_detail = mad(uvTP, _DetailMap_ST.xx, _DetailMap_ST.zw);
uv_detail = _DetailsuseLocalUVs ? mad(float2(i.uv0XY_bitZ_fog.xy), _DetailMap_ST.xy, _DetailMap_ST.zw) : uv_detail;
#if defined(_EXPENSIVE_TP)
half2 ddxDetail = ddx(uv_detail);
half2 ddyDetail = ddy(uv_detail);
ddxDetail = _DetailsuseLocalUVs ? ddxDetail : ddxTP * _DetailMap_ST.xx;
ddyDetail = _DetailsuseLocalUVs ? ddyDetail : ddyTP * _DetailMap_ST.xx;
#endif
half4 detailMap = SLZ_SAMPLE_TP_DETAIL(_DetailMap, sampler_DetailMap, uv_detail);
half3 detailTS = half3(2.0 * detailMap.ag - 1.0, 1.0);
detailTS = _RotateUVs && !(_DetailsuseLocalUVs) ? half3(detailTS.y, -detailTS.x, detailTS.z) : detailTS;
normalTS = BlendNormal(normalTS, detailTS);
//#!INJECT_END
//#!INJECT_BEGIN NORMAL_TRANSFORM 0
/*-Triplanar-------------------------------------------------------------------------------------------------------------*/
half3 normalWS = mul(TStoWsTP, normalTS);
normalWS = normalize(normalWS);
//#!INJECT_END

View file

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

View file

@ -0,0 +1,8 @@
//#!INJECT_BEGIN MATERIAL_CBUFFER -1
float4 _DetailMap_ST;
half _Details;
half _Normals;
half _DetailsuseLocalUVs;
half _RotateUVs;
half _UVScaler;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,8 @@
//#!INJECT_BEGIN MATERIAL_CBUFFER -1
float4 _DetailMap_ST;
half _Details;
half _Normals;
half _DetailsuseLocalUVs;
half _RotateUVs;
half _UVScaler;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,23 @@
//#!INJECT_BEGIN VERTEX_IN 0
float4 color : COLOR;
//#!INJECT_END
//#!INJECT_BEGIN INTERPOLATORS 0
float4 color : COLOR;
//#!INJECT_END
//#!INJECT_BEGIN VERTEX_END 0
o.color = v.color;
//#!INJECT_END
//#!INJECT_BEGIN PBR_VALUES 0
albedo *= lerp(1, _BaseColor, albedo.a);
half metallic = mas.r;
half ao = mas.g;
half smoothness = mas.b;
//#!INJECT_END
//#!INJECT_BEGIN PRE_FRAGDATA 0
ao *= i.color.a;
albedo.rgb *= i.color.rgb;
//#!INJECT_END

View file

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

View file

@ -0,0 +1,17 @@
//#!INJECT_BEGIN UNIFORMS 0
TEXTURE2D(_PenMap);
//#!INJECT_END
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
float4 _PenMap_ST;
half _PenMono;
half4 _PenMonoColor;
//#!INJECT_END
//#!INJECT_BEGIN FRAG_POST_READ 0
float2 uv_pen = mad(float2(i.uv0XY_bitZ_fog.xy), _PenMap_ST.xy, _PenMap_ST.zw);
half4 penMap = SAMPLE_TEXTURE2D(_PenMap, sampler_BaseMap, uv_pen);
penMap = _PenMono > 0.5 ? penMap.rrrr : penMap;
penMap.rgb = _PenMono > 0.5 ? penMap.rgb * _PenMonoColor.rgb : penMap.rgb;
albedo.rgb = penMap.rgb + albedo.rgb * (1.0h - penMap.a);
//#!INJECT_END

View file

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

View file

@ -0,0 +1,5 @@
//#!INJECT_BEGIN MATERIAL_CBUFFER 0
float4 _PenMap_ST;
half _PenMono;
half4 _PenMonoColor;
//#!INJECT_END

Some files were not shown because too many files have changed in this diff Show more