Initial commit

This commit is contained in:
msk
2022-01-22 20:13:49 -08:00
parent f9d23e5bcf
commit 687473573d
878 changed files with 70957 additions and 0 deletions
@@ -0,0 +1,39 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Decode.cginc
/// @brief Deferred decode light buffer pass vertex & fragment shaders.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_DEFERRED_DECODE_CGINC
#define ALLOY_SHADERS_DEFERRED_DECODE_CGINC
sampler2D _LightBuffer;
struct AFragmentInput {
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
AFragmentInput aMainVertexShader(
float4 vertex : POSITION,
float2 texcoord : TEXCOORD0)
{
AFragmentInput o;
o.vertex = UnityObjectToClipPos(vertex);
o.texcoord = texcoord.xy;
#ifdef UNITY_SINGLE_PASS_STEREO
o.texcoord = TransformStereoScreenSpaceTex(o.texcoord, 1.0f);
#endif
return o;
}
fixed4 aMainFragmentShader(
AFragmentInput i) : SV_Target
{
return -log2(tex2D(_LightBuffer, i.texcoord));
}
#endif // ALLOY_SHADERS_DEFERRED_DECODE_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5661f4df05e27394b9cd50398246c3fa
timeCreated: 1490736319
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
+94
View File
@@ -0,0 +1,94 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Light.cginc
/// @brief Deferred light pass vertex & fragment shaders.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_DEFERRED_LIGHT_CGINC
#define ALLOY_SHADERS_DEFERRED_LIGHT_CGINC
#define A_DIRECT_LIGHTING_PASS
#include "Assets/Alloy/Shaders/Framework/Deferred.cginc"
unity_v2f_deferred aMainVertexShader(
float4 vertex : POSITION,
float3 normal : NORMAL)
{
return vert_deferred(vertex, normal);
}
#ifdef UNITY_HDR_ON
half4
#else
fixed4
#endif
aMainFragmentShader(
unity_v2f_deferred i) : SV_Target
{
ASurface s = aDeferredSurface(i);
ADirect d = aNewDirect();
float fadeDist = UnityComputeShadowFadeDistance(s.positionWorld, s.viewDepth);
float4 lightCoord = 0.0f;
float3 lightVector = 0.0f;
half3 lightAxis = 0.0h;
half range = 1.0h;
half4 c = 0.0h;
d.color = _LightColor.rgb;
#ifndef DIRECTIONAL
lightCoord = mul(unity_WorldToLight, float4(s.positionWorld, 1.0f));
#endif
#if defined(USING_DIRECTIONAL_LIGHT)
lightVector = -_LightDir.xyz;
d.shadow = UnityDeferredComputeShadow(s.positionWorld, fadeDist, s.screenUv);
#if !defined(ALLOY_SUPPORT_REDLIGHTS) && defined(DIRECTIONAL_COOKIE)
aLightCookie(d, tex2Dbias(_LightTexture0, float4(lightCoord.xy, 0, -8)));
#endif
#elif defined(POINT) || defined(POINT_COOKIE) || defined(SPOT)
lightVector = _LightPos.xyz - s.positionWorld;
lightAxis = normalize(unity_WorldToLight[1].xyz);
range = rsqrt(_LightPos.w); // _LightPos.w = 1/r*r
#if defined(SPOT)
// negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/
half4 cookie = tex2Dbias(_LightTexture0, float4(lightCoord.xy / lightCoord.w, 0, -8));
cookie.a *= (lightCoord.w < 0.0f);
aLightCookie(d, cookie);
d.shadow = UnityDeferredComputeShadow(s.positionWorld, fadeDist, s.screenUv);
#elif defined(POINT) || defined(POINT_COOKIE)
d.shadow = UnityDeferredComputeShadow(-lightVector, fadeDist, s.screenUv);
#if defined (POINT_COOKIE)
aLightCookie(d, texCUBEbias(_LightTexture0, float4(lightCoord.xyz, -8)));
#endif //POINT_COOKIE
#endif //POINT || POINT_COOKIE
A_UNITY_ATTENUATION(d, _LightTextureB0, lightVector, _LightPos.w)
#endif
#if !defined(ALLOY_SUPPORT_REDLIGHTS) || !defined(DIRECTIONAL_COOKIE)
aAreaLight(d, s, _LightColor, lightAxis, lightVector, range);
#else
d.direction = lightVector;
d.color *= redLightFunctionLegacy(_LightTexture0, s.positionWorld, s.normalWorld, s.viewDirWorld, d.direction);
aDirectionalLight(d, s);
#endif
c.rgb = aHdrClamp(aDirectLighting(d, s));
#ifdef UNITY_HDR_ON
return c;
#else
return exp2(-c);
#endif
}
#endif // ALLOY_SHADERS_DEFERRED_LIGHT_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d3107cea335f9344382bd082656550fc
timeCreated: 1490737757
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file ReflectionAdd.cginc
/// @brief Deferred reflection buffer add pass vertex & fragment shaders.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_DEFERRED_REFLECTION_ADD_CGINC
#define ALLOY_SHADERS_DEFERRED_REFLECTION_ADD_CGINC
#include "UnityCG.cginc"
sampler2D _CameraReflectionsTexture;
struct AFragmentInput {
float2 uv : TEXCOORD0;
float4 pos : SV_POSITION;
};
AFragmentInput aMainVertexShader(
float3 vertex : POSITION)
{
AFragmentInput o;
o.pos = UnityObjectToClipPos(vertex);
o.uv = ComputeScreenPos(o.pos).xy;
return o;
}
half4 aMainFragmentShader(
AFragmentInput i) : SV_Target
{
half4 c = tex2D(_CameraReflectionsTexture, i.uv);
#ifdef UNITY_HDR_ON
return float4(c.rgb, 0.0f);
#else
return float4(exp2(-c.rgb), 0.0f);
#endif
}
#endif // ALLOY_SHADERS_DEFERRED_REFLECTION_ADD_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1e9a104470b80e94a82881d1187f6e5b
timeCreated: 1491142566
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file ReflectionProbe.cginc
/// @brief Deferred reflection probe pass vertex & fragment shaders.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_DEFERRED_REFLECTION_PROBE_CGINC
#define ALLOY_SHADERS_DEFERRED_REFLECTION_PROBE_CGINC
#define A_INDIRECT_LIGHTING_PASS
#include "Assets/Alloy/Shaders/Framework/Deferred.cginc"
unity_v2f_deferred aMainVertexShader(
float4 vertex : POSITION,
float3 normal : NORMAL)
{
return vert_deferred(vertex, normal);
}
half4 aMainFragmentShader(
unity_v2f_deferred i) : SV_Target
{
UnityGIInput d;
ASurface s = aDeferredSurface(i);
float blendDistance = unity_SpecCube1_ProbePosition.w; // will be set to blend distance for this probe
d.worldPos = s.positionWorld;
d.worldViewDir = s.viewDirWorld; // ???
d.probeHDR[0] = unity_SpecCube0_HDR;
#ifdef UNITY_SPECCUBE_BOX_PROJECTION
d.probePosition[0] = unity_SpecCube0_ProbePosition;
d.boxMin[0].xyz = unity_SpecCube0_BoxMin - float4(blendDistance,blendDistance,blendDistance,0);
d.boxMin[0].w = 1; // 1 in .w allow to disable blending in UnityGI_IndirectSpecular call
d.boxMax[0].xyz = unity_SpecCube0_BoxMax + float4(blendDistance,blendDistance,blendDistance,0);
#endif
Unity_GlossyEnvironmentData g;
AIndirect ind = aNewIndirect();
g.roughness = s.roughness;
g.reflUVW = s.reflectionVectorWorld;
ind.specular = UnityGI_IndirectSpecular(d, 1.0h, g);
// Calculate falloff value, so reflections on the edges of the probe would gradually blend to previous reflection.
// Also this ensures that pixels not located in the reflection probe AABB won't
// accidentally pick up reflections from this probe.
half3 distance = aDistanceFromAabb(s.positionWorld, unity_SpecCube0_BoxMin.xyz, unity_SpecCube0_BoxMax.xyz);
half falloff = saturate(1.0 - length(distance) / blendDistance);
return half4(aIndirectLighting(ind, s), falloff);
}
#endif // ALLOY_SHADERS_DEFERRED_REFLECTION_PROBE_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3011708aeab7fe148ad3912213be977c
timeCreated: 1491142106
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant: