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,53 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file EyeOcclusion.cginc
/// @brief Eye Occlusion surface shader definition.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_EYE_OCCLUSION_CGINC
#define ALLOY_LEGACY_SHADERS_DEFINITION_EYE_OCCLUSION_CGINC
#define A_AMBIENT_OCCLUSION_ON
#define A_EXPANDED_MATERIAL_MAPS
#include "Assets/Alloy/Shaders/Framework/Lighting.cginc"
#include "Assets/Alloy/Shaders/Type/Standard.cginc"
void aPreLighting(
inout ASurface s)
{
aStandardPreLighting(s);
s.opacity *= 1.0h - s.specularOcclusion;
}
half3 aDirectLighting(
ADirect d,
ASurface s)
{
return d.color * (d.shadow * d.NdotL * s.ambientOcclusion) * s.albedo;
}
half3 aIndirectLighting(
AIndirect i,
ASurface s)
{
return i.diffuse * s.ambientOcclusion * s.albedo;
}
void aSurfaceShader(
inout ASurface s)
{
aDissolve(s);
half4 base = aBase(s);
s.baseColor = base.rgb;
s.opacity = base.a;
s.ambientOcclusion = aLerpOneTo(tex2D(_AoMap, s.baseUv).g, _Occlusion);
}
#endif // ALLOY_LEGACY_SHADERS_DEFINITION_EYE_OCCLUSION_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: f6ce6c59434b4bd42829fc8e6a52e473
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
@@ -0,0 +1,108 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Eyeball.cginc
/// @brief Eyeball surface shader definition.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC
#define ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC
#define A_NORMAL_MAPPING_ON
#define A_AMBIENT_OCCLUSION_ON
#define A_SPECULAR_TINT_ON
#define A_CLEARCOAT_ON
#define A_EYE_PARALLAX_REFRACTION
#define A_DETAIL_MASK_OFF
#include "Assets/Alloy/Shaders/Lighting/Standard.cginc"
#include "Assets/Alloy/Shaders/Type/Standard.cginc"
#include "Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc"
/// Cornea normals.
/// Expects a compressed normal map.
sampler2D _EyeBumpMap;
/// Cornea weight.
/// Expects values in the range [0,1].
half _EyeCorneaWeight;
/// Cornea roughness.
/// Expects values in the range [0,1].
half _EyeRoughness;
/// Schlera tint color.
/// Expects a linear LDR color.
half3 _EyeScleraColor;
/// Iris tint color.
/// Expects a linear LDR color.
half3 _EyeColor;
/// Iris specular tint by base color.
/// Expects values in the range [0,1].
half _EyeSpecularTint;
/// Samples and scales the base bump map.
/// @param s Material surface data.
/// @param scale Normal XY scale factor.
/// @return Normalized tangent-space normal.
half3 aSampleBumpScaleOld(
ASurface s,
half scale)
{
half4 result = 0.0h;
#ifdef _VIRTUALTEXTURING_ON
result = VTSampleNormal(s.baseVirtualCoord);
#else
result = tex2D(_BumpMap, s.baseUv);
#endif
return UnpackScaleNormal(result, _BumpScale * scale);
}
void aSurfaceShader(
inout ASurface s)
{
float4 uv01 = s.uv01;
aEyeParallax(s);
aDissolve(s);
// Iris
half4 base = aBase(s);
half4 material = aSampleMaterial(s);
half irisMask = material.A_METALLIC_CHANNEL;
s.baseColor = base.rgb * lerp(_EyeScleraColor, _EyeColor, irisMask);
s.metallic = 0.0h;
s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion);
s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL;
s.specularTint = _EyeSpecularTint * irisMask;
s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL;
// Cornea
half bumpMask = s.clearCoat * 0.95h;
half3 corneaNormalTangent = UnpackScaleNormal(tex2D(_EyeBumpMap, s.baseUv), bumpMask);
half3 irisScleraNormalTangent = aSampleBumpScaleOld(s, 1.0h - bumpMask);
s.clearCoat = _EyeCorneaWeight * irisMask;
s.clearCoatRoughness = _EyeRoughness;
s.normalTangent = A_NT(s, BlendNormals(irisScleraNormalTangent, corneaNormalTangent));
s.mask = 1.0h - irisMask;
aDetail(s);
s.mask = 1.0h;
aEmission(s);
// Remove parallax so these appears on top of the cornea!
s.uv01 = uv01;
aDecal(s);
aRim(s);
}
#endif // ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9c178cd0ac649324487ffea244d7e632
timeCreated: 1438268034
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,273 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Eyeball.cginc
/// @brief Eyeball surface shader definition.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC
#define ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC
#define A_NORMAL_MAPPING_ON
#define A_VIEW_DIR_TANGENT_ON
#define A_AMBIENT_OCCLUSION_ON
#define A_SPECULAR_TINT_ON
#define A_EYE_PARALLAX_REFRACTION
#define A_DETAIL_MASK_OFF
#define A_SURFACE_CUSTOM_FIELDS \
half3 corneaNormalWorld; \
half3 irisF0; \
half scattering; \
half irisMask; \
half corneaSpecularity; \
half corneaRoughness; \
half irisSpecularOcclusion; \
half irisRoughness; \
half irisBeckmannRoughness; \
half irisNdotV;
#include "Assets/Alloy/Shaders/Framework/Lighting.cginc"
#include "Assets/Alloy/Shaders/Type/Standard.cginc"
#include "Assets/Alloy/Legacy/Shaders/Feature/EyeParallax.cginc"
/// Implements a scattering diffuse BRDF affected by roughness.
/// @param albedo Diffuse albedo LDR color.
/// @param subsurface Blend value between diffuse and scattering [0,1].
/// @param roughness Linear roughness [0,1].
/// @param LdotH Light and half-angle clamped dot product [0,1].
/// @param NdotL Normal and light clamped dot product [0,1].
/// @param NdotV Normal and view clamped dot product [0,1].
/// @return Direct diffuse BRDF.
half3 aDiffuseBssrdf(
half3 albedo,
half subsurface,
half roughness,
half LdotH,
half NdotL,
half NdotV)
{
// Impelementation of Brent Burley's diffuse scattering BRDF.
// Subject to Apache License, version 2.0
// cf https://github.com/wdas/brdf/blob/master/src/brdfs/disney.brdf
half FL = aFresnel(NdotL);
half FV = aFresnel(NdotV);
half Fss90 = LdotH * LdotH * roughness;
half Fd90 = 0.5h + (2.0h * Fss90);
half Fd = aLerpOneTo(Fd90, FL) * aLerpOneTo(Fd90, FV);
half Fss = aLerpOneTo(Fss90, FL) * aLerpOneTo(Fss90, FV);
half ss = 1.25h * (Fss * (1.0h / max(NdotL + NdotV, A_EPSILON) - 0.5h) + 0.5h);
// Pi is cancelled by implicit punctual lighting equation.
// cf http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/
return albedo * lerp(Fd, ss, subsurface);
}
/// A specular BRDF.
/// @param d Direct lighting data.
/// @param s Material surface data.
/// @return Direct specular BRDF.
half3 aLegacySpecularBrdf(
ADirect d,
ASurface s)
{
// Schlick's Fresnel approximation.
half3 F = lerp(s.f0, A_WHITE, aFresnel(d.LdotH));
// GGX (Trowbridge-Reitz) NDF
// cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
half a2 = s.beckmannRoughness * s.beckmannRoughness;
half denom = aLerpOneTo(a2, d.NdotH * d.NdotH);
// John Hable's visibility function.
// cf http://www.filmicworlds.com/2014/04/21/optimizing-ggx-shaders-with-dotlh/
half V = lerp(a2 * 0.25h, 1.0h, d.LdotH * d.LdotH);
// Pi is cancelled by implicit punctual lighting equation.
// cf http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/
half DV = a2 / (4.0h * V * denom * denom);
// Cook-Torrance microfacet model.
// cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
return F * (DV * s.specularOcclusion * d.specularIntensity);
}
/// Indirect specular BRDF.
/// @param s Material surface data.
/// @return Environment BRDF.
half3 aLegacyEnvironmentBrdf(
ASurface s)
{
// Brian Karis' modification of Dimitar Lazarov's Environment BRDF.
// cf https://www.unrealengine.com/blog/physically-based-shading-on-mobile
const half4 c0 = half4(-1.0h, -0.0275h, -0.572h, 0.022h);
const half4 c1 = half4(1.0h, 0.0425h, 1.04h, -0.04h);
half4 r = s.roughness * c0 + c1;
half a004 = min(r.x * r.x, exp2(-9.28h * s.NdotV)) * r.x + r.y;
half2 AB = half2(-1.04h, 1.04h) * a004 + r.zw;
return s.f0 * AB.x + AB.yyy;
}
/// Calculates standard indirect diffuse plus specular illumination.
/// @param d Indirect light description.
/// @param s Material surface data.
/// @return Indirect illumination.
half3 aLegacyStandardIndirect(
AIndirect i,
ASurface s)
{
#ifdef A_REFLECTION_PROBES_ON
half3 specular = i.specular * aLegacyEnvironmentBrdf(s);
#endif
#ifndef A_AMBIENT_OCCLUSION_ON
half3 diffuse = s.albedo * i.diffuse;
#ifndef A_REFLECTION_PROBES_ON
return diffuse;
#else
return diffuse + specular;
#endif
#else
// Yoshiharu Gotanda's fake interreflection for specular occlusion.
// Modified to better account for surface f0.
// cf http://research.tri-ace.com/Data/cedec2011_RealtimePBR_Implementation_e.pptx pg65
half3 ambient = i.diffuse * s.ambientOcclusion;
#ifndef A_REFLECTION_PROBES_ON
// Diffuse and fake interreflection only.
return ambient * (s.albedo + s.f0 * (1.0h - s.specularOcclusion));
#else
// Full equation.
return ambient * s.albedo
+ lerp(ambient * s.f0, specular, s.specularOcclusion);
#endif
#endif
}
void aPreLighting(
inout ASurface s)
{
aStandardPreLighting(s);
// Tint the iris specular to fake caustics.
// cf http://game.watch.impress.co.jp/docs/news/20121129_575412.html
// Iris & Sclera
s.irisNdotV = s.NdotV;
s.irisSpecularOcclusion = s.specularOcclusion;
s.irisF0 = s.f0;
s.irisRoughness = s.roughness;
s.irisBeckmannRoughness = s.beckmannRoughness;
// Cornea
s.roughness = lerp(s.roughness, s.corneaRoughness, s.irisMask);
s.corneaNormalWorld = normalize(lerp(s.normalWorld, s.vertexNormalWorld, s.irisMask));
s.reflectionVectorWorld = reflect(-s.viewDirWorld, s.corneaNormalWorld);
s.NdotV = aDotClamp(s.corneaNormalWorld, s.viewDirWorld);
s.FV = aFresnel(s.NdotV);
s.specularOcclusion = lerp(s.irisSpecularOcclusion, 1.0h, s.irisMask);
s.f0 = lerp(s.irisF0, aSpecularityToF0(s.corneaSpecularity), s.irisMask);
}
half3 aDirectLighting(
ADirect d,
ASurface s)
{
half3 illum = 0.0h;
// Iris & Sclera
illum = d.NdotL * (
aDiffuseBssrdf(s.albedo, s.scattering, s.irisRoughness, d.LdotH, d.NdotL, s.irisNdotV));
//+ (s.irisSpecularOcclusion * AlloyAreaLightNormalization(s.irisBeckmannRoughness, d.solidAngle)
// * aLegacySpecularBrdf(s.irisF0, s.irisBeckmannRoughness, d.LdotH, d.NdotH, d.NdotL, s.irisNdotV)));
// Cornea
d.NdotH = aDotClamp(s.corneaNormalWorld, d.halfAngleWorld);
d.NdotL = aDotClamp(s.corneaNormalWorld, d.direction);
d.specularIntensity *= s.irisMask * d.NdotL;
illum += aLegacySpecularBrdf(d, s);
return illum * d.color * d.shadow;
}
half3 aIndirectLighting(
AIndirect i,
ASurface s)
{
return aLegacyStandardIndirect(i, s);
}
/// Schlera tint color.
/// Expects a linear LDR color.
half3 _EyeScleraColor;
/// Schlera diffuse scattering amount.
/// Expects values in the range [0,1].
half _EyeScleraScattering;
/// Cornea specularity.
/// Expects values in the range [0,1].
half _EyeSpecularity;
/// Cornea roughness.
/// Expects values in the range [0,1].
half _EyeRoughness;
/// Iris tint color.
/// Expects a linear LDR color.
half3 _EyeColor;
/// Iris diffuse scattering amount.
/// Expects values in the range [0,1].
half _EyeIrisScattering;
/// Iris specular tint by base color.
/// Expects values in the range [0,1].
half _EyeSpecularTint;
void aSurfaceShader(
inout ASurface s)
{
float4 uv01 = s.uv01;
aEyeParallax(s);
aDissolve(s);
half4 base = aBase(s);
s.baseColor = base.rgb;
half4 material = aSampleMaterial(s);
s.irisMask = material.A_METALLIC_CHANNEL;
s.metallic = 0.0h;
s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion);
s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL;
s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL;
s.normalTangent = A_NT(s, aSampleBump(s));
s.baseColor *= lerp(_EyeScleraColor, _EyeColor, s.irisMask);
s.specularTint = s.irisMask * _EyeSpecularTint;
s.scattering = lerp(_EyeScleraScattering, _EyeIrisScattering, s.irisMask);
s.corneaSpecularity = _EyeSpecularity;
s.corneaRoughness = _EyeRoughness;
// Don't allow detail normals in the iris.
s.mask = 1.0h - s.irisMask;
aDetail(s);
s.mask = 1.0h;
aEmission(s);
aRim(s);
// Remove parallax so this appears on top of the cornea!
s.uv01 = uv01;
aDecal(s);
}
#endif // ALLOY_LEGACY_SHADERS_DEFINITION_EYEBALL_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 0fb3f9db18784964cb344084b892a928
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
@@ -0,0 +1,264 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Skin.cginc
/// @brief Skin surface shader definition.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_SKIN_CGINC
#define ALLOY_LEGACY_SHADERS_DEFINITION_SKIN_CGINC
#define A_AMBIENT_OCCLUSION_ON
#define A_SURFACE_CUSTOM_FIELDS \
half scatteringMask; \
half scattering;
#include "Assets/Alloy/Shaders/Framework/Lighting.cginc"
#include "Assets/Alloy/Shaders/Type/Standard.cginc"
// Jon Moore recommended this value in his blog post.
#define A_SKIN_BUMP_BLUR_BIAS (3.0)
sampler2D _SssBrdfTex;
/// Biases the thickness value used to look up in the skin LUT.
/// Expects values in the range [0,1].
half _SssBias;
/// Scales the thickness value used to look up in the skin LUT.
/// Expects values in the range [0,1].
half _SssScale;
/// Amount to colorize and darken AO to simulate local scattering.
/// Expects values in the range [0,1].
half _SssAoSaturation;
/// Increases the bluriness of the normal map for diffuse lighting.
/// Expects values in the range [0,1].
half _SssBumpBlur;
/// Transmission tint color.
/// Expects a linear LDR color.
half3 _TransColor;
/// Weight of the transmission effect.
/// Expects linear space value in the range [0,1].
half _TransScale;
/// Falloff of the transmission effect.
/// Expects values in the range [1,n).
half _TransPower;
/// Amount that the transmission is distorted by surface normals.
/// Expects values in the range [0,1].
half _TransDistortion;
/// Calculates standard indirect diffuse plus specular illumination.
/// @param d Direct lighting data.
/// @param s Material surface data.
/// @param skinLut Pre-Integrated scattering LUT.
/// @return Direct diffuse illumination with scattering effect.
half3 aLegacySkin(
ADirect d,
ASurface s,
sampler2D skinLut)
{
// Scattering
// cf http://www.farfarer.com/blog/2013/02/11/pre-integrated-skin-shader-unity-3d/
float ndlBlur = dot(s.ambientNormalWorld, d.direction) * 0.5h + 0.5h;
float2 sssLookupUv = float2(ndlBlur, s.scattering * aLuminance(d.color));
half3 sss = s.scatteringMask * d.shadow * tex2D(skinLut, sssLookupUv).rgb;
//#if !defined(SHADOWS_SCREEN) && !defined(SHADOWS_DEPTH) && !defined(SHADOWS_CUBE)
// // If shadows are off, we need to reduce the brightness
// // of the scattering on polys facing away from the light.
// sss *= saturate(ndlBlur * 4.0h - 1.0h); // [-1,3], then clamp
//#else
// sss *= d.shadow;
//#endif
return d.color * s.albedo * sss;
}
/// Calculates direct light transmission effect using per-pixel thickness.
/// @param d Indirect light description.
/// @param s Material surface data.
/// @param weight Weight of the transmission effect.
/// @param distortion Distortion due to surface normals.
/// @param falloff Tightness of the transmitted light.
/// @param shadowWeight Amount that the transsmision is shadowed.
/// @return Transmission effect.
half3 aLegacyTransmission(
ADirect d,
ASurface s,
half weight,
half distortion,
half falloff,
half shadowWeight)
{
// Transmission
// cf http://www.farfarer.com/blog/2012/09/11/translucent-shader-unity3d/
half3 transLightDir = d.direction + s.normalWorld * distortion;
half transLight = pow(aDotClamp(s.viewDirWorld, -transLightDir), falloff);
transLight *= weight * aLerpOneTo(d.shadow, shadowWeight);
return d.color * s.subsurfaceColor * transLight;
}
/// Direct diffuse and specular BRDF.
/// @param d Direct lighting data.
/// @param s Material surface data.
/// @return Direct diffuse BRDF.
half3 aLegacyDirectBrdf(
ADirect d,
ASurface s,
half diffuseWeight)
{
// Cook-Torrance microfacet model.
// cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
half LdotH2 = d.LdotH * d.LdotH;
// Brent Burley diffuse BRDF.
// cf https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf pg14
half FL = aFresnel(d.NdotL);
half Fd90 = 0.5h + (2.0h * LdotH2 * s.roughness);
half Fd = aLerpOneTo(Fd90, FL) * aLerpOneTo(Fd90, s.FV);
// Schlick's Fresnel approximation.
half3 F = lerp(s.f0, A_WHITE, aFresnel(d.LdotH));
// John Hable's Visibility function.
// cf http://www.filmicworlds.com/2014/04/21/optimizing-ggx-shaders-with-dotlh/
half a2 = s.beckmannRoughness * s.beckmannRoughness;
half k2 = a2 * 0.25h; // k = a/2; k*k = (a*a)/(2*2) = (a^2)/4.
half V = lerp(k2, 1.0h, LdotH2);
// GGX (Trowbridge-Reitz) NDF.
// cf http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
half denom = aLerpOneTo(a2, d.NdotH * d.NdotH);
half mDV = k2 / (V * denom * denom); // k2 is GGX a^2 and microfacet 1/4.
// Punctual lighting equation.
// cf http://seblagarde.wordpress.com/2012/01/08/pi-or-not-to-pi-in-game-lighting-equation/
return (d.shadow * d.NdotL) * (
(s.albedo * (Fd * diffuseWeight)) + (F * (mDV * s.specularOcclusion * d.specularIntensity)));
}
/// Indirect specular BRDF.
/// @param s Material surface data.
/// @return Environment BRDF.
half3 aLegacyEnvironmentBrdf(
ASurface s)
{
// Brian Karis' modification of Dimitar Lazarov's Environment BRDF.
// cf https://www.unrealengine.com/blog/physically-based-shading-on-mobile
const half4 c0 = half4(-1.0h, -0.0275h, -0.572h, 0.022h);
const half4 c1 = half4(1.0h, 0.0425h, 1.04h, -0.04h);
half4 r = s.roughness * c0 + c1;
half a004 = min(r.x * r.x, exp2(-9.28h * s.NdotV)) * r.x + r.y;
half2 AB = half2(-1.04h, 1.04h) * a004 + r.zw;
return s.f0 * AB.x + AB.yyy;
}
/// Calculates standard indirect diffuse plus specular illumination.
/// @param d Indirect light description.
/// @param s Material surface data.
/// @return Indirect illumination.
half3 aLegacyStandardIndirect(
AIndirect i,
ASurface s)
{
#ifdef A_REFLECTION_PROBES_ON
half3 specular = i.specular * aLegacyEnvironmentBrdf(s);
#endif
#ifndef A_AMBIENT_OCCLUSION_ON
half3 diffuse = s.albedo * i.diffuse;
#ifndef A_REFLECTION_PROBES_ON
return diffuse;
#else
return diffuse + specular;
#endif
#else
// Yoshiharu Gotanda's fake interreflection for specular occlusion.
// Modified to better account for surface f0.
// cf http://research.tri-ace.com/Data/cedec2011_RealtimePBR_Implementation_e.pptx pg65
half3 ambient = i.diffuse * s.ambientOcclusion;
#ifndef A_REFLECTION_PROBES_ON
// Diffuse and fake interreflection only.
return ambient * (s.albedo + s.f0 * (1.0h - s.specularOcclusion));
#else
// Full equation.
return ambient * s.albedo
+ lerp(ambient * s.f0, specular, s.specularOcclusion);
#endif
#endif
}
void aPreLighting(
inout ASurface s)
{
aStandardPreLighting(s);
// Blurred normals for indirect diffuse and direct scattering.
s.blurredNormalTangent = normalize(lerp(s.normalTangent, s.blurredNormalTangent, s.scatteringMask * _SssBumpBlur));
s.ambientNormalWorld = aTangentToWorld(s, s.blurredNormalTangent);
s.subsurfaceColor = _TransScale * _TransColor * s.albedo * s.subsurface.rrr;
s.scattering = saturate(s.subsurface * _SssScale + _SssBias);
}
half3 aDirectLighting(
ADirect d,
ASurface s)
{
return (d.color * aLegacyDirectBrdf(d, s, 1.0h - s.scatteringMask))
+ aLegacySkin(d, s, _SssBrdfTex)
+ aLegacyTransmission(d, s, 1.0h, _TransDistortion, _TransPower, 0.0h);
}
half3 aIndirectLighting(
AIndirect i,
ASurface s)
{
// Saturated AO.
// cf http://www.iryoku.com/downloads/Next-Generation-Character-Rendering-v6.pptx pg110
half saturation = s.scatteringMask * _SssAoSaturation;
s.albedo = pow(s.albedo, (1.0h + saturation) - saturation * s.ambientOcclusion);
return aLegacyStandardIndirect(i, s);
}
void aSurfaceShader(
inout ASurface s)
{
aDissolve(s);
half4 base = aBase(s);
s.baseColor = base.rgb;
s.subsurface = A_SS(s, base.a);
half4 material = aSampleMaterial(s);
s.scatteringMask = material.A_METALLIC_CHANNEL;
s.metallic = 0.0h;
s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion);
s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL;
s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL;
s.normalTangent = A_NT(s, aSampleBump(s));
s.blurredNormalTangent = aSampleBumpBias(s, A_SKIN_BUMP_BLUR_BIAS);
aDetail(s);
aTeamColor(s);
aDecal(s);
aRim(s);
aEmission(s);
}
#endif // ALLOY_LEGACY_SHADERS_DEFINITION_SKIN_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 592351fd2bda43b479a4596b48e53d66
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
@@ -0,0 +1,27 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file TriPlanar.cginc
/// @brief TriPlanar shader definition.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_TRIPLANAR_CGINC
#define ALLOY_LEGACY_SHADERS_DEFINITION_TRIPLANAR_CGINC
#define A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA
#define A_TRIPLANAR_ON
#define A_RIM_EFFECTS_MAP_OFF
#include "Assets/Alloy/Shaders/Lighting/Standard.cginc"
#include "Assets/Alloy/Shaders/Type/Standard.cginc"
void aSurfaceShader(
inout ASurface s)
{
aTriPlanar(s);
aRim(s);
}
#endif // ALLOY_LEGACY_SHADERS_DEFINITION_TRIPLANAR_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: af89b12906000ca4d949e437a831c082
timeCreated: 1472680907
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,78 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file VertexBlend.cginc
/// @brief Vertex Blend shader definition.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_LEGACY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC
#define ALLOY_LEGACY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC
#define A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA
#ifndef A_VERTEX_COLOR_IS_DATA
#define A_VERTEX_COLOR_IS_DATA
#endif
#define A_METALLIC_ON
#define A_SPECULAR_TINT_ON
#define A_DETAIL_MASK_OFF
#include "Assets/Alloy/Shaders/Lighting/Standard.cginc"
#include "Assets/Alloy/Shaders/Type/Standard.cginc"
half _TriplanarBlendSharpness;
half4 _Splat0Tint;
A_SAMPLER_2D(_Splat0);
sampler2D _Normal0;
half _Metallic0;
half _SplatSpecularity0;
half _SplatSpecularTint0;
half _SplatRoughness0;
half4 _Splat1Tint;
A_SAMPLER_2D(_Splat1);
sampler2D _Normal1;
half _Metallic1;
half _SplatSpecularity1;
half _SplatSpecularTint1;
half _SplatRoughness1;
half4 _Splat2Tint;
A_SAMPLER_2D(_Splat2);
sampler2D _Normal2;
half _Metallic2;
half _SplatSpecularity2;
half _SplatSpecularTint2;
half _SplatRoughness2;
half4 _Splat3Tint;
A_SAMPLER_2D(_Splat3);
sampler2D _Normal3;
half _Metallic3;
half _SplatSpecularity3;
half _SplatSpecularTint3;
half _SplatRoughness3;
void aSurfaceShader(
inout ASurface s)
{
half4 splatControl = s.vertexColor;
splatControl /= (dot(splatControl, A_ONE4) + A_EPSILON);
ASplatContext sc = aNewSplatContext(s, _TriplanarBlendSharpness, 1.0f);
ASplat sp0 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat0), _Splat0, _Normal0, _Splat0Tint, 0.0h, _Metallic0, _SplatSpecularity0, _SplatSpecularTint0, _SplatRoughness0, 1.0h, 1.0h);
ASplat sp1 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat1), _Splat1, _Normal1, _Splat1Tint, 0.0h, _Metallic1, _SplatSpecularity1, _SplatSpecularTint1, _SplatRoughness1, 1.0h, 1.0h);
ASplat sp2 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat2), _Splat2, _Normal2, _Splat2Tint, 0.0h, _Metallic2, _SplatSpecularity2, _SplatSpecularTint2, _SplatRoughness2, 1.0h, 1.0h);
ASplat sp3 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat3), _Splat3, _Normal3, _Splat3Tint, 0.0h, _Metallic3, _SplatSpecularity3, _SplatSpecularTint3, _SplatRoughness3, 1.0h, 1.0h);
aApplyTerrainSplats(s, splatControl, sp0, sp1, sp2, sp3);
aCutout(s);
aDetail(s);
}
#endif // ALLOY_LEGACY_SHADERS_DEFINITION_VERTEX_BLEND_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4336d3976cbfc8740a237887a1d65eb7
timeCreated: 1430262367
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant: