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
+44
View File
@@ -0,0 +1,44 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file AO2.cginc
/// @brief Secondary Ambient Occlusion, possibly on a different UV.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_AO2_CGINC
#define ALLOY_SHADERS_FEATURE_AO2_CGINC
#if !defined(A_AO2_ON) && defined(_AO2_ON)
#define A_AO2_ON
#endif
#ifdef A_AO2_ON
#ifndef A_AMBIENT_OCCLUSION_ON
#define A_AMBIENT_OCCLUSION_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_AO2_ON
/// Secondary Ambient Occlusion map.
/// Expects an RGB map with sRGB sampling
A_SAMPLER_2D(_Ao2Map);
/// Ambient Occlusion strength.
/// Expects values in the range [0,1].
half _Ao2Occlusion;
#endif
void aAo2(
inout ASurface s)
{
#ifdef A_AO2_ON
float2 ao2Uv = A_TEX_TRANSFORM_UV(s, _Ao2Map);
s.ambientOcclusion *= aLerpOneTo(tex2D(_Ao2Map, ao2Uv).g, _Ao2Occlusion * s.mask);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_AO2_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 26dd662bbb79c0e4a8a2ff89526035a4
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
+104
View File
@@ -0,0 +1,104 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file CarPaint.cginc
/// @brief View-dependent secondary color tint and metal flakes layers.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_CAR_PAINT_CGINC
#define ALLOY_SHADERS_FEATURE_CAR_PAINT_CGINC
#ifdef A_CAR_PAINT_ON
#ifndef A_METALLIC_ON
#define A_METALLIC_ON
#endif
#ifndef A_NORMAL_WORLD_ON
#define A_NORMAL_WORLD_ON
#endif
#ifndef A_VIEW_DIR_WORLD_ON
#define A_VIEW_DIR_WORLD_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_CAR_PAINT_ON
/// The primary paint tint color.
/// Expects a linear LDR color.
half3 _CarPrimaryColor;
/// The secondary paint tint color.
/// Expects a linear LDR color.
half3 _CarSecondaryColor;
/// The secondary paint tint color weight.
/// Expects values in the range [0,1].
half _CarSecondaryColorWeight;
/// Controls the width of the secondary paint tint color rim effect.
/// Expects values in the range [0,1].
half _CarSecondaryColorFalloff;
/// The metallic flake tint color.
/// Expects a linear LDR color.
half4 _CarFlakeColor;
/// Metal flake color in RGB, and weight in A.
/// Expects an RGBA map with sRGB sampling.
A_SAMPLER_2D(_CarFlakeMap);
/// Gamma applied to the metal flake weight map.
/// Expects values in the range [0.01,n].
half _CarFlakeMapFalloff;
/// The metal flake weight.
/// Expects values in the range [0,1].
half _CarFlakeWeight;
/// Controls the view-dependent spread of the metal flakes over the surface.
/// Expects values in the range [0,1].
half _CarFlakeSpread;
/// Controls the view-dependent spread of highlights over the metal flakes.
/// Expects values in the range [0,1].
half _CarFlakeHighlightSpread;
#endif
void aCarPaint(
inout ASurface s)
{
#ifdef A_CAR_PAINT_ON
// Multi-layer car paint.
// cf http://www.elliottpacel.co.uk/blog/pbr-practice
// cf http://blenderartists.org/forum/showthread.php?250127-Car-Paint-Materials-Iridescent-Layers-Carbon-Fiber-Leather&p=2083499&viewfull=1#post2083499
// Two-Tone Paint
half secondaryColorFalloff = 1.0h - pow(s.NdotV, 0.1 + 9.9h * _CarSecondaryColorFalloff);
half secondaryColorWeight = _CarSecondaryColorWeight * secondaryColorFalloff;
half3 paintColor = lerp(_CarPrimaryColor, _CarSecondaryColor, secondaryColorWeight);
s.baseColor *= aLerpWhiteTo(paintColor, s.mask);
// Metal Flakes
// NOTE: Metal brightness will overpower clearcoat, hiding roughness difference.
float2 flakeUv = A_TEX_TRANSFORM_UV(s, _CarFlakeMap);
half4 flakes = _CarFlakeColor * tex2D(_CarFlakeMap, flakeUv);
half flakeMask = pow(flakes.a, _CarFlakeMapFalloff);
half flakeSpread = pow(s.NdotV, _CarFlakeSpread * -9.9h + 10.0h); //[10,0]
half flakeWeight = s.mask * flakeMask * flakeSpread * _CarFlakeWeight;
s.baseColor = lerp(s.baseColor, flakes.rgb, flakeWeight);
s.metallic = lerp(s.metallic, 1.0h, flakeWeight);
s.roughness = lerp(s.roughness, 1.0h, flakeWeight * _CarFlakeHighlightSpread);
// Clear Coat
// NOTE: Only added to metallic parts, as dielectrics already have it.
s.baseColor += aSpecularityToF0(s.mask * s.specularity * s.metallic);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_CAR_PAINT_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 49bf32b325f0e1f43b4cf4b06c157c38
timeCreated: 1429971495
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
+55
View File
@@ -0,0 +1,55 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Decal.cginc
/// @brief Handles vertex-weighted alpha-blended decals.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_DECAL_CGINC
#define ALLOY_SHADERS_FEATURE_DECAL_CGINC
#if !defined(A_DECAL_ON) && defined(_DECAL_ON)
#define A_DECAL_ON
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_DECAL_ON
/// The decal tint color.
/// Expects a linear LDR color with alpha.
half4 _DecalColor;
/// Decal texture.
/// Expects an RGBA map with sRGB sampling.
A_SAMPLER_2D(_DecalTex);
/// Weight of the decal effect.
/// Expects values in the range [0,1].
half _DecalWeight;
/// The specularity that will be applied over the decal.
/// Expects values in the range [0,1].
half _DecalSpecularity;
/// Toggles tinting the decal alpha by the vertex alpha.
/// Expects values in the range [0,1].
half _DecalAlphaVertexTint;
#endif
void aDecal(
inout ASurface s)
{
#ifdef A_DECAL_ON
float2 detailUv = A_TEX_TRANSFORM_UV(s, _DecalTex);
half4 decal = _DecalColor * tex2D(_DecalTex, detailUv);
half weight = s.mask * _DecalWeight * decal.a * aLerpOneTo(s.vertexColor.a, _DecalAlphaVertexTint);
s.baseColor = lerp(s.baseColor, decal.rgb, weight);
s.metallic *= 1.0h - weight;
s.specularity = lerp(s.specularity, _DecalSpecularity, weight);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_DECAL_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 4656c3259023a1c4aa228ab121733f03
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
+96
View File
@@ -0,0 +1,96 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Detail.cginc
/// @brief Surface detail materials and normals.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_DETAIL_CGINC
#define ALLOY_SHADERS_FEATURE_DETAIL_CGINC
#if !defined(A_DETAIL_ON) && defined(_DETAIL_MULX2)
#define A_DETAIL_ON
#endif
#if !defined(A_DETAIL_MASK_VERTEX_COLOR_ALPHA_ON) && defined(_NORMALMAP)
#define A_DETAIL_MASK_VERTEX_COLOR_ALPHA_ON
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_DETAIL_ON
#ifndef A_DETAIL_MASK_OFF
/// Mask that controls the detail influence on the base material.
/// Expects an alpha data map.
sampler2D _DetailMask;
#endif
/// Controls how much the vertex alpha masks the detail maps.
/// Expects values in the range [0,1].
half _DetailMaskStrength;
#ifndef A_DETAIL_COLOR_MAP_OFF
/// Detail base color blending mode.
/// Expects either 0 or 1.
float _DetailMode;
/// Detail base color map.
/// Expects an RGB map with sRGB sampling.
A_SAMPLER_2D(_DetailAlbedoMap);
#endif
#ifndef A_DETAIL_NORMAL_MAP_OFF
/// Detail normal map.
/// Expects a compressed normal map.
A_SAMPLER_2D(_DetailNormalMap);
#endif
/// Controls the detail influence on the base material.
/// Expects values in the range [0,1].
half _DetailWeight;
#ifndef A_DETAIL_NORMAL_MAP_OFF
/// Normal map XY scale.
half _DetailNormalMapScale;
#endif
#endif
void aDetail(
inout ASurface s)
{
#ifdef A_DETAIL_ON
half mask = s.mask * _DetailWeight;
#ifndef A_DETAIL_MASK_OFF
#ifdef A_DETAIL_MASK_VERTEX_COLOR_ALPHA_ON
half alpha = s.vertexColor.a;
#else
half alpha = tex2D(_DetailMask, s.baseUv).a;
#endif
mask *= aLerpOneTo(alpha, _DetailMaskStrength);
#endif
#ifndef A_DETAIL_COLOR_MAP_OFF
float2 detailUv = A_TEX_TRANSFORM_UV_SCROLL(s, _DetailAlbedoMap);
#else
float2 detailUv = A_TEX_TRANSFORM_UV_SCROLL(s, _DetailNormalMap);
#endif
#ifndef A_DETAIL_COLOR_MAP_OFF
half3 detailAlbedo = tex2D(_DetailAlbedoMap, detailUv).rgb;
half3 colorScale = _DetailMode < 0.5f ? A_WHITE : unity_ColorSpaceDouble.rgb;
s.baseColor *= aLerpWhiteTo(detailAlbedo * colorScale, mask);
#endif
#ifndef A_DETAIL_NORMAL_MAP_OFF
half3 detailNormalTangent = UnpackScaleNormal(tex2D(_DetailNormalMap, detailUv), mask * _DetailNormalMapScale);
s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, detailNormalTangent));
#endif
#endif
}
#endif // ALLOY_SHADERS_FEATURE_DETAIL_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: d8bd66578335a4341bd3117c16a356fd
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
@@ -0,0 +1,67 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file DirectionalBlend.cginc
/// @brief Allows blending based how much a normal faces a given direction.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_DIRECTIONAL_BLEND_CGINC
#define ALLOY_SHADERS_FEATURE_DIRECTIONAL_BLEND_CGINC
#ifdef A_DIRECTIONAL_BLEND_ON
#ifndef _DIRECTIONALBLENDMODE_WORLD
#ifdef A_DIRECTIONAL_BLEND_MODE_OFF
#define _DIRECTIONALBLENDMODE_WORLD
#else
#define A_WORLD_TO_OBJECT_ON
#endif
#endif
#ifndef A_NORMAL_WORLD_ON
#define A_NORMAL_WORLD_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_DIRECTIONAL_BLEND_ON
/// Direction around which the blending occurs.
/// Expects a normalized direction vector.
half3 _DirectionalBlendDirection;
/// Directional Blend weight.
/// Expects values in the range [0,1].
half _OrientedScale;
/// Hemispherical cutoff where blend begins.
/// Expects values in the range [0,1].
half _OrientedCutoff;
/// Offset from cutoff where smooth blending occurs.
/// Expects values in the range [0.0001,1].
half _OrientedBlend;
/// Controls how much the vertex color alpha influences the cutoff.
/// Expects values in the range [0,1].
half _DirectionalBlendAlphaVertexTint;
#endif
void aDirectionalBlend(
inout ASurface s)
{
#ifdef A_DIRECTIONAL_BLEND_ON
#ifdef _DIRECTIONALBLENDMODE_WORLD
half3 normal = s.normalWorld;
#else
half3 normal = UnityWorldToObjectDir(s.normalWorld);
#endif
// Convert [-1,1] -> [1,0] to flip direction for free.
half mask = dot(normal, _DirectionalBlendDirection) * -0.5h + 0.5h;
aBlendRangeMask(s, mask, _OrientedScale, _OrientedCutoff, _OrientedBlend, _DirectionalBlendAlphaVertexTint);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_DIRECTIONAL_BLEND_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0214d8d671f8fec40b5918f808135dda
timeCreated: 1429743781
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,74 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Dissolve.cginc
/// @brief Surface dissolve effects.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_DISSOLVE_CGINC
#define ALLOY_SHADERS_FEATURE_DISSOLVE_CGINC
#if !defined(A_DISSOLVE_ON) && defined(_DISSOLVE_ON)
#define A_DISSOLVE_ON
#endif
#ifdef A_DISSOLVE_ON
#ifndef A_OPACITY_MASK_ON
#define A_OPACITY_MASK_ON
#endif
#ifndef A_EMISSIVE_COLOR_ON
#define A_EMISSIVE_COLOR_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_DISSOLVE_ON
/// Dissolve glow tint color.
/// Expects a linear HDR color with alpha.
half4 _DissolveGlowColor;
/// Dissolve glow color with effect ramp in the alpha.
/// Expects an RGBA map with sRGB sampling.
A_SAMPLER_2D(_DissolveTex);
/// The cutoff value for the dissolve effect in the ramp map.
/// Expects values in the range [0,1].
half _DissolveCutoff;
#ifndef A_DISSOLVE_GLOW_OFF
/// The weight of the dissolve glow effect.
/// Expects linear space value in the range [0,1].
half _DissolveGlowWeight;
/// The width of the dissolve glow effect.
/// Expects values in the range [0,1].
half _DissolveEdgeWidth;
#endif
#endif
void aDissolve(
inout ASurface s)
{
#ifdef A_DISSOLVE_ON
float2 dissolveUv = A_TEX_TRANSFORM_UV(s, _DissolveTex);
half4 dissolveBase = _DissolveGlowColor * tex2D(_DissolveTex, dissolveUv);
half dissolveCutoff = s.mask * _DissolveCutoff;
half clipval = dissolveBase.a * 0.99h - dissolveCutoff;
clip(clipval); // NOTE: Eliminates need for blend edge.
#ifndef A_DISSOLVE_GLOW_OFF
// Dissolve glow
half3 glow = s.emissiveColor + dissolveBase.rgb * _DissolveGlowWeight;
glow = clipval >= _DissolveEdgeWidth ? s.emissiveColor : glow; // Outer edge.
s.emissiveColor = dissolveCutoff < A_EPSILON ? s.emissiveColor : glow; // Kill when cutoff is zero.
#endif
#endif
}
#endif // ALLOY_SHADERS_FEATURE_DISSOLVE_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 2d9fe839dda81834a8612d65d3dcdef5
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
@@ -0,0 +1,66 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Emission.cginc
/// @brief Surface emission effects.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_EMISSION_CGINC
#define ALLOY_SHADERS_FEATURE_EMISSION_CGINC
#if !defined(A_EMISSION_ON) && defined(_EMISSION)
#define A_EMISSION_ON
#endif
#ifdef A_EMISSION_ON
#ifndef A_EMISSIVE_COLOR_ON
#define A_EMISSIVE_COLOR_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_EMISSION_ON
/// Emission tint color.
/// Expects a linear LDR color.
half3 _EmissionColor;
#ifndef A_EMISSION_MASK_MAP_OFF
/// Emission mask texture.
/// Expects an RGB map with sRGB sampling.
sampler2D _EmissionMap;
#endif
#ifndef A_EMISSION_EFFECTS_MAP_OFF
/// Emission effect texture.
/// Expects an RGB map with sRGB sampling.
A_SAMPLER_2D(_IncandescenceMap);
#endif
/// The weight of the emission effect.
/// Expects linear space value in the range [0,1].
half _EmissionWeight;
#endif
void aEmission(
inout ASurface s)
{
#ifdef A_EMISSION_ON
half3 emission = _EmissionColor;
#ifndef A_EMISSION_MASK_MAP_OFF
emission *= tex2D(_EmissionMap, s.baseUv).rgb;
#endif
#ifndef A_EMISSION_EFFECTS_MAP_OFF
float2 incandescenceUv = A_TEX_TRANSFORM_UV_SCROLL(s, _IncandescenceMap);
emission *= tex2D(_IncandescenceMap, incandescenceUv).rgb;
#endif
s.emissiveColor += emission * (_EmissionWeight * s.mask);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_EMISSION_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 48469a9a682a0b643a5772eabe9dbee1
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
@@ -0,0 +1,66 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Emission2.cginc
/// @brief Secondary emission effects.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_EMISSION2_CGINC
#define ALLOY_SHADERS_FEATURE_EMISSION2_CGINC
#if !defined(A_EMISSION2_ON) && defined(_EMISSION2_ON)
#define A_EMISSION2_ON
#endif
#ifdef A_EMISSION2_ON
#ifndef A_EMISSIVE_COLOR_ON
#define A_EMISSIVE_COLOR_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_EMISSION2_ON
/// Secondary emission tint color.
/// Expects a linear LDR color.
half3 _Emission2Color;
#ifndef A_EMISSION2_MASK_MAP_OFF
//// Secondary emission mask texture.
/// Expects an RGB map with sRGB sampling.
sampler2D _EmissionMap2;
#endif
#ifndef A_EMISSION2_EFFECTS_MAP_OFF
/// Secondary emission effect texture.
/// Expects an RGB map with sRGB sampling.
A_SAMPLER_2D(_IncandescenceMap2);
#endif
/// The weight of the secondary emission effect.
/// Expects linear space value in the range [0,1].
half _Emission2Weight;
#endif
void aEmission2(
inout ASurface s)
{
#ifdef A_EMISSION2_ON
half3 emission = _Emission2Color;
#ifndef A_EMISSION2_MASK_MAP_OFF
emission *= tex2D(_EmissionMap2, s.baseUv).rgb;
#endif
#ifndef A_EMISSION2_EFFECTS_MAP_OFF
float2 incandescenceUv2 = A_TEX_TRANSFORM_UV_SCROLL(s, _IncandescenceMap2);
emission *= tex2D(_IncandescenceMap2, incandescenceUv2).rgb;
#endif
s.emissiveColor += emission * (_Emission2Weight * s.mask);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_EMISSION2_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6917272733d53ab408659b331bb657cd
timeCreated: 1429487905
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
+131
View File
@@ -0,0 +1,131 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Eye.cginc
/// @brief Eye parallax, layer control, etc.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_EYE_CGINC
#define ALLOY_SHADERS_FEATURE_EYE_CGINC
#ifdef A_EYE_ON
#ifndef A_NORMAL_MAPPING_ON
#define A_NORMAL_MAPPING_ON
#endif
#ifndef A_VIEW_DIR_TANGENT_ON
#define A_VIEW_DIR_TANGENT_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_EYE_ON
/// Cornea tint color.
/// Expects a linear LDR color.
half4 _CorneaColor;
/// Cornea normal map.
/// Expects a compressed normal map.
sampler2D _CorneaNormalMap;
/// Cornea specularity.
/// Expects values in the range [0,1].
half _CorneaSpecularity;
/// Cornea roughness.
/// Expects values in the range [0,1].
half _CorneaRoughness;
/// Cornea normal map XY scale.
half _CorneaNormalMapScale;
/// Iris tint color.
/// Expects a linear LDR color.
half3 _IrisColor;
/// Iris pupil dilation.
/// Expects values in the range [0,1].
half _IrisPupilSize;
/// Iris fake shadowing at grazing angles.
/// Expects values in the range [0.01,n].
half _IrisShadowing;
/// Iris fake scattering intensity.
/// Expects values in the range [0,n].
half _IrisScatterIntensity;
/// Iris fake scattering falloff.
/// Expects values in the range [0.01,n].
half _IrisScatterPower;
/// Schlera tint color.
/// Expects a linear LDR color.
half3 _ScleraColor;
/// Schlera specularity.
/// Expects values in the range [0,1].
half _ScleraSpecularity;
/// Schlera roughness.
/// Expects values in the range [0,1].
half _ScleraRoughness;
/// Schlera normal map XY scale.
half _ScleraNormalMapScale;
#endif
void aEye(
inout ASurface s)
{
#ifdef A_EYE_ON
float2 baseUv = s.baseUv;
float4 uv = s.uv01;
// Cornea "Refraction".
aParallaxOcclusionMapping(s, 10.0f, 25.0f);
// Pupil Dilation
// HACK: Use the heightmap as the gradient, since it matches the other maps.
// http://www.polycount.com/forum/showpost.php?p=1511423&postcount=13
half mask = 1.0h - aSampleHeight(s);
float2 centeredUv = frac(s.baseUv) + float2(-0.5f, -0.5f);
float2 dilationOffset = centeredUv * (mask * _IrisPupilSize);
aParallaxOffset(s, -dilationOffset);
// Materials.
half4 base = aSampleBase(s);
half irisMask = base.a;
s.baseColor = base.rgb;
// Iris.
half3 irisBump = aSampleBumpScale(s, lerp(_ScleraNormalMapScale, 1.0h, irisMask));
half irisNdotV = irisMask * aDotClamp(irisBump, s.viewDirTangent);
irisBump = normalize(lerp(irisBump, A_FLAT_NORMAL, irisMask));
s.baseColor += (_IrisScatterIntensity * pow(aLuminance(base) * irisNdotV, _IrisScatterPower)).rrr;
s.baseColor *= aLerpOneTo(pow(irisNdotV, _IrisShadowing), irisMask);
s.baseColor *= _Color * aBaseVertexColorTint(s) * lerp(_ScleraColor, _IrisColor, irisMask);
// No Parallax.
s.baseUv = A_BV(s, baseUv);
s.uv01 = uv;
// Cornea & Sclera.
half3 corneaBump = UnpackScaleNormal(tex2D(_CorneaNormalMap, s.baseUv), _CorneaNormalMapScale);
s.baseColor = lerp(s.baseColor, _CorneaColor, irisMask * _CorneaColor.a);
s.specularity = lerp(_ScleraSpecularity, _CorneaSpecularity, irisMask);
s.roughness = lerp(_ScleraRoughness, _CorneaRoughness, irisMask);
s.normalTangent = A_NT(s, BlendNormals(irisBump, corneaBump));
// Iris mask on outside effects.
s.mask = 1.0h - irisMask;
#endif
}
#endif // ALLOY_SHADERS_FEATURE_EYE_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 93f289c36f5ff0c49a8ec1866fa82592
timeCreated: 1467936284
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file MainTextures.cginc
/// @brief Main set of textures.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_MAIN_TEXTURES_CGINC
#define ALLOY_SHADERS_FEATURE_MAIN_TEXTURES_CGINC
#ifdef A_MAIN_TEXTURES_ON
#ifndef A_MAIN_TEXTURES_MATERIAL_MAP_OFF
#ifndef A_METALLIC_ON
#define A_METALLIC_ON
#endif
#ifndef A_SPECULAR_TINT_ON
#define A_SPECULAR_TINT_ON
#endif
#if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA)
#define A_AMBIENT_OCCLUSION_ON
#endif
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
void aMainTextures(
inout ASurface s)
{
#ifdef A_MAIN_TEXTURES_ON
half4 tint = aBaseTint(s);
half4 base = aSampleBase(s);
#ifdef A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA
s.baseColor = tint.rgb * base.rgb;
s.opacity = tint.a;
s.metallic = _Metal;
s.ambientOcclusion = 1.0h;
s.specularity = _Specularity;
s.specularTint = _SpecularTint;
s.roughness = _Roughness * base.a;
#else
base *= tint;
s.baseColor = base.rgb;
s.opacity = base.a;
#ifndef A_MAIN_TEXTURES_CUTOUT_OFF
aCutout(s);
#endif
#ifndef A_MAIN_TEXTURES_MATERIAL_MAP_OFF
half4 material = aSampleMaterial(s);
s.metallic = _Metal * material.A_METALLIC_CHANNEL;
s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion);
s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL;
s.specularTint = _SpecularTint;
s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL;
#endif
#endif
s.normalTangent = A_NT(s, aSampleBump(s));
#endif
}
#endif // ALLOY_SHADERS_FEATURE_MAIN_TEXTURES_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 443b9ecd2643e9847af7438c6e17824b
timeCreated: 1456687148
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,111 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file OrientedTextures.cginc
/// @brief Secondary set of textures using world/object position XZ as their UVs.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_ORIENTED_TEXTURES_CGINC
#define ALLOY_SHADERS_FEATURE_ORIENTED_TEXTURES_CGINC
#ifdef A_ORIENTED_TEXTURES_ON
#ifndef A_TRIPLANAR_MAPPING_ON
#define A_TRIPLANAR_MAPPING_ON
#endif
#ifndef _TRIPLANARMODE_WORLD
#define _TRIPLANARMODE_WORLD
#endif
#ifndef A_NORMAL_WORLD_ON
#define A_NORMAL_WORLD_ON
#endif
#ifndef A_POSITION_WORLD_ON
#define A_POSITION_WORLD_ON
#endif
#ifndef A_METALLIC_ON
#define A_METALLIC_ON
#endif
#ifndef A_SPECULAR_TINT_ON
#define A_SPECULAR_TINT_ON
#endif
#if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA)
#define A_AMBIENT_OCCLUSION_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_ORIENTED_TEXTURES_ON
/// The world-oriented tint color.
/// Expects a linear LDR color with alpha.
half4 _OrientedColor;
/// The world-oriented color map.
/// Expects an RGB(A) map with sRGB sampling.
A_SAMPLER_2D(_OrientedMainTex);
/// The world-oriented packed material map.
/// Expects an RGBA data map.
sampler2D _OrientedMaterialMap;
/// The world-oriented normal map.
/// Expects a compressed normal map.
sampler2D _OrientedBumpMap;
/// Toggles tinting the world-oriented color by the vertex color.
/// Expects values in the range [0,1].
half _OrientedColorVertexTint;
/// The world-oriented metallic scale.
/// Expects values in the range [0,1].
half _OrientedMetallic;
/// The world-oriented specularity scale.
/// Expects values in the range [0,1].
half _OrientedSpecularity;
// Amount that f0 is tinted by the base color.
/// Expects values in the range [0,1].
half _OrientedSpecularTint;
/// The world-oriented roughness scale.
/// Expects values in the range [0,1].
half _OrientedRoughness;
/// Ambient Occlusion strength.
/// Expects values in the range [0,1].
half _OrientedOcclusion;
/// Normal map XY scale.
half _OrientedNormalMapScale;
#endif
void aOrientedTextures(
inout ASurface s)
{
#ifdef A_ORIENTED_TEXTURES_ON
ASplatContext sc = aNewSplatContext(s, 1.0h, 1.0f);
ASplat sp = aNewSplat();
sc.blend = A_ONE;
aTriPlanarY(sp, sc, A_SAMPLER_2D_INPUT(_OrientedMainTex), _OrientedMaterialMap, _OrientedBumpMap, _OrientedOcclusion, _OrientedNormalMapScale);
aSplatMaterial(sp, sc, _OrientedColor, _OrientedColorVertexTint, _OrientedMetallic, _OrientedSpecularity, _OrientedSpecularTint, _OrientedRoughness);
#ifdef A_ORIENTED_TEXTURES_BLEND_OFF
aApplySplat(s, sp);
#elif defined(A_ORIENTED_TEXTURES_ALPHA_BLEND_OFF)
aBlendSplat(s, sp);
#else
aBlendSplatWithOpacity(s, sp);
#endif
#endif
}
#endif // ALLOY_SHADERS_FEATURE_ORIENTED_TEXTURES_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6036fb82bd94ea74bbe7382e28759d91
timeCreated: 1429745916
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,47 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Parallax.cginc
/// @brief Surface heightmap-based texcoord modification.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_PARALLAX_CGINC
#define ALLOY_SHADERS_FEATURE_PARALLAX_CGINC
#if !defined(A_PARALLAX_ON) && defined(_PARALLAXMAP)
#define A_PARALLAX_ON
#endif
#ifdef A_PARALLAX_ON
#ifndef A_VIEW_DIR_TANGENT_ON
#define A_VIEW_DIR_TANGENT_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_PARALLAX_ON
/// Number of samples used for direct view of POM effect.
/// Expects values in the range [1,n].
float _MinSamples;
/// Number of samples used for grazing view of POM effect.
/// Expects values in the range [1,n].
float _MaxSamples;
#endif
void aParallax(
inout ASurface s)
{
#ifdef A_PARALLAX_ON
#ifndef _BUMPMODE_POM
aOffsetBumpMapping(s);
#else
aParallaxOcclusionMapping(s, _MinSamples, _MaxSamples);
#endif
#endif
}
#endif // ALLOY_SHADERS_FEATURE_PARALLAX_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 40772d7597163a44895afaec77233382
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
@@ -0,0 +1,64 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Puddles.cginc
/// @brief Handles all puddle material effects.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_PUDDLES_CGINC
#define ALLOY_SHADERS_FEATURE_PUDDLES_CGINC
#if !defined(A_PUDDLES_ON) && defined(_PUDDLES_ON)
#define A_PUDDLES_ON
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_PUDDLES_ON
A_SAMPLER_2D(_PuddlesRippleTex);
// Mask
half _PuddlesWeight;
half _PuddlesRippleWeight;
// Wetness
// Wet Tint
// Wet roughness.
half _PuddlesLevel;
// Puddle Roughness
#endif
void aPuddles(
inout ASurface s)
{
#ifdef A_PUDDLES_ON
half mask = _PuddlesWeight * s.vertexColor.a * s.mask;
// Physically-based puddles.
// cf https://seblagarde.wordpress.com/2013/01/03/water-drop-2b-dynamic-rain-and-its-effects/
// Wetness
// Unity uses a Left-handed axis, so it requires clumsy remapping.
//const half3x3 yTangentToWorld = half3x3(A_AXIS_X, A_AXIS_Z, s.vertexNormalWorld);
//float2 rippleUv = A_TEX_TRANSFORM_SCROLL(_RippleTex, s.positionWorld.xz);
//half3 ripples = lerp(A_FLAT_NORMAL, tex2D(_RippleTex, rippleUv) * 2.0h - 1.0h, _PuddlesRippleWeight);
//ripples = mul(ripples, yTangentToWorld);
//ripples = aWorldToTangent(s, ripples);
//half puddles = _PuddlesLevel * mask;
//s.normalTangent = A_NT(s, normalize(lerp(s.normalTangent, ripples, puddles)));
#endif
}
#endif // ALLOY_SHADERS_FEATURE_PUDDLES_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2284f1b75bd3e0643b4c7fc387b9574a
timeCreated: 1470010611
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
+72
View File
@@ -0,0 +1,72 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Rim.cginc
/// @brief Rim lighting effects.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_RIM_CGINC
#define ALLOY_SHADERS_FEATURE_RIM_CGINC
#if !defined(A_RIM_ON) && defined(_RIM_ON)
#define A_RIM_ON
#endif
#ifdef A_RIM_ON
#ifndef A_NORMAL_WORLD_ON
#define A_NORMAL_WORLD_ON
#endif
#ifndef A_VIEW_DIR_WORLD_ON
#define A_VIEW_DIR_WORLD_ON
#endif
#ifndef A_EMISSIVE_COLOR_ON
#define A_EMISSIVE_COLOR_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_RIM_ON
/// Rim lighting tint color.
/// Expects a linear HDR color.
half3 _RimColor;
#ifndef A_RIM_EFFECTS_MAP_OFF
/// Rim effect texture.
/// Expects an RGB map with sRGB sampling.
A_SAMPLER_2D(_RimTex);
#endif
/// The weight of the rim lighting effect.
/// Expects linear space value in the range [0,1].
half _RimWeight;
/// Fills in the center of the rim lighting effect.
/// Expects linear-space values in the range [0,1].
half _RimBias;
/// Controls the falloff of the rim lighting effect.
/// Expects values in the range [0.01,n].
half _RimPower;
#endif
void aRim(
inout ASurface s)
{
#ifdef A_RIM_ON
half3 rim = _RimColor;
#ifndef A_RIM_EFFECTS_MAP_OFF
float2 rimUv = A_TEX_TRANSFORM_UV_SCROLL(s, _RimTex);
rim *= tex2D(_RimTex, rimUv).rgb;
#endif
s.emissiveColor += rim * aRimLight(_RimWeight * s.mask, _RimBias, _RimPower, s.NdotV);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_RIM_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: bd3768b8012337f44875c64f6d4cf535
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
+72
View File
@@ -0,0 +1,72 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Rim2.cginc
/// @brief Secondary rim lighting effects.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_RIM2_CGINC
#define ALLOY_SHADERS_FEATURE_RIM2_CGINC
#if !defined(A_RIM2_ON) && defined(_RIM2_ON)
#define A_RIM2_ON
#endif
#ifdef A_RIM2_ON
#ifndef A_NORMAL_WORLD_ON
#define A_NORMAL_WORLD_ON
#endif
#ifndef A_VIEW_DIR_WORLD_ON
#define A_VIEW_DIR_WORLD_ON
#endif
#ifndef A_EMISSIVE_COLOR_ON
#define A_EMISSIVE_COLOR_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_RIM2_ON
/// Secondary rim lighting tint color.
/// Expects a linear HDR color.
half3 _Rim2Color;
#ifndef A_RIM2_EFFECTS_MAP_OFF
/// Secondary rim effect texture.
/// Expects an RGB map with sRGB sampling.
A_SAMPLER_2D(_RimTex2);
#endif
/// The weight of the secondary rim lighting effect.
/// Expects linear space value in the range [0,1].
half _Rim2Weight;
/// Fills in the center of the secondary rim lighting effect.
/// Expects linear-space values in the range [0,1].
half _Rim2Bias;
/// Controls the falloff of the secondary rim lighting effect.
/// Expects values in the range [0.01,n].
half _Rim2Power;
#endif
void aRim2(
inout ASurface s)
{
#ifdef A_RIM2_ON
half3 rim = _Rim2Color;
#ifndef A_RIM2_EFFECTS_MAP_OFF
float2 rimUv2 = A_TEX_TRANSFORM_UV_SCROLL(s, _RimTex2);
rim *= tex2D(_RimTex2, rimUv2).rgb;
#endif
s.emissiveColor += rim * aRimLight(_Rim2Weight * s.mask, _Rim2Bias, _Rim2Power, s.NdotV);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_RIM2_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2d9c9b283ffc148428d0b7dcb671d75a
timeCreated: 1429487905
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,97 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file SecondaryTextures.cginc
/// @brief Secondary set of textures.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_SECONDARY_TEXTURES_CGINC
#define ALLOY_SHADERS_FEATURE_SECONDARY_TEXTURES_CGINC
#ifdef A_SECONDARY_TEXTURES_ON
#ifndef A_METALLIC_ON
#define A_METALLIC_ON
#endif
#ifndef A_SPECULAR_TINT_ON
#define A_SPECULAR_TINT_ON
#endif
#if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA)
#define A_AMBIENT_OCCLUSION_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_SECONDARY_TEXTURES_ON
/// The secondary tint color.
/// Expects a linear LDR color with alpha.
half4 _Color2;
/// The secondary color map.
/// Expects an RGB(A) map with sRGB sampling.
A_SAMPLER_2D(_MainTex2);
/// The secondary packed material map.
/// Expects an RGBA data map.
sampler2D _MaterialMap2;
/// The secondary normal map.
/// Expects a compressed normal map.
sampler2D _BumpMap2;
/// Toggles tinting the secondary color by the vertex color.
/// Expects values in the range [0,1].
half _BaseColorVertexTint2;
/// The secondary metallic scale.
/// Expects values in the range [0,1].
half _Metallic2;
/// The secondary specularity scale.
/// Expects values in the range [0,1].
half _Specularity2;
// Amount that f0 is tinted by the base color.
/// Expects values in the range [0,1].
half _SpecularTint2;
/// The secondary roughness scale.
/// Expects values in the range [0,1].
half _Roughness2;
/// Ambient Occlusion strength.
/// Expects values in the range [0,1].
half _Occlusion2;
/// Normal map XY scale.
half _BumpScale2;
#endif
void aSecondaryTextures(
inout ASurface s)
{
#ifdef A_SECONDARY_TEXTURES_ON
ASplatContext sc = aNewSplatContext(s, 1.0h, 1.0f);
ASplat sp = aNewSplat(sc, A_SAMPLER_2D_INPUT(_MainTex2), _MaterialMap2, _BumpMap2, _Color2, _BaseColorVertexTint2, _Metallic2, _Specularity2, _SpecularTint2, _Roughness2, _Occlusion2, _BumpScale2);
#ifdef A_SECONDARY_TEXTURES_ALPHA_BLEND_OFF
aBlendSplat(s, sp);
#else
aBlendSplatWithOpacity(s, sp);
#endif
// NOTE: These are applied in here so we can use baseUv2.
float2 baseUv = s.baseUv;
s.baseUv = A_BV(s, sp.baseUv);
aEmission2(s);
aRim2(s);
s.baseUv = A_BV(s, baseUv);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_SECONDARY_TEXTURES_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 07856fd9f4cd69146ab3ecb6ecc7ff7e
timeCreated: 1429755843
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 SkinTextures.cginc
/// @brief Main set of textures for Skin shaders.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_SKIN_TEXTURES_CGINC
#define ALLOY_SHADERS_FEATURE_SKIN_TEXTURES_CGINC
#ifdef A_SKIN_TEXTURES_ON
#ifndef A_METALLIC_ON
#define A_METALLIC_ON
#endif
#ifndef A_AMBIENT_OCCLUSION_ON
#define A_AMBIENT_OCCLUSION_ON
#endif
#ifndef A_SUBSURFACE_ON
#define A_SUBSURFACE_ON
#endif
#ifndef A_SCATTERING_ON
#define A_SCATTERING_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
void aSkinTextures(
inout ASurface s)
{
#ifdef A_SKIN_TEXTURES_ON
half4 base = aBase(s);
s.baseColor = base.rgb;
s.subsurface = A_SS(s, base.a);
s.opacity = 1.0h - base.a;
aCutout(s);
half4 material = aSampleMaterial(s);
s.metallic = _Metal * material.A_METALLIC_CHANNEL;
s.ambientOcclusion = aLerpOneTo(material.A_AO_CHANNEL, _Occlusion);
s.specularity = _Specularity * material.A_SPECULARITY_CHANNEL;
s.roughness = _Roughness * material.A_ROUGHNESS_CHANNEL;
// Jon Moore recommends a mip bias of 3.0 for blurred skin normals.
// http://www.gamasutra.com/view/news/128934/Indepth_Skin_shading_in_Unity3D.php
s.normalTangent = A_NT(s, aSampleBump(s));
s.blurredNormalTangent = aSampleBumpBias(s, 3.0f);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_SKIN_TEXTURES_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 41b715d6578f2634d905d9f57e4571c6
timeCreated: 1477401865
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,105 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file SpeedTree.cginc
/// @brief SpeedTree standard material properties.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_SPEED_TREE_CGINC
#define ALLOY_SHADERS_FEATURE_SPEED_TREE_CGINC
#ifdef A_SPEED_TREE_ON
// NOTE: AO on/off determined by matching SpeedTree(Billboard) Model.
#if defined(GEOM_TYPE_FROND) || defined(GEOM_TYPE_LEAF) || defined(GEOM_TYPE_FACING_LEAF)
#ifndef _ALPHATEST_ON
#define _ALPHATEST_ON
#endif
#ifndef A_TWO_SIDED_SHADER
#define A_TWO_SIDED_SHADER
#endif
#ifndef A_SUBSURFACE_ON
#define A_SUBSURFACE_ON
#endif
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_SPEED_TREE_ON
#ifdef GEOM_TYPE_BRANCH_DETAIL
sampler2D _DetailTex;
sampler2D _DetailNormalMap;
#endif
#ifdef EFFECT_HUE_VARIATION
half4 _HueVariation;
#endif
#ifdef A_SUBSURFACE_ON
/// Transmission tint color.
/// Expects a linear LDR color.
half3 _TransColor;
/// Transmission color * thickness texture.
/// Expects an RGB map with sRGB sampling.
sampler2D _TransTex;
/// Weight of the transmission effect.
/// Expects gamma-space values in the range [0,1].
half _TransScale;
#endif
#endif
void aSpeedTree(
inout ASurface s)
{
#ifdef A_SPEED_TREE_ON
half4 base = aSampleBase(s);
s.baseColor = base.rgb;
s.opacity = _Color.a * base.a;
aCutout(s);
// AO content depends on matching Model header.
s.ambientOcclusion = s.vertexColor.r;
s.normalTangent = A_NT(s, aSampleBump(s));
#ifdef A_SUBSURFACE_ON
s.subsurface = A_SS(s, _TransScale * tex2D(_TransTex, s.baseUv).a);
s.subsurfaceColor *= _TransColor;
#endif
#ifdef GEOM_TYPE_BRANCH_DETAIL
half4 detailColor = tex2D(_DetailTex, s.uv01.zw);
half weight = s.vertexColor.g < 2.0f ? saturate(s.vertexColor.g) : detailColor.a;
s.baseColor = lerp(s.baseColor, detailColor.rgb, weight);
half3 detailNormals = UnpackScaleNormal(tex2D(_DetailNormalMap, s.uv01.zw), weight);
s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, detailNormals));
#endif
#ifdef EFFECT_HUE_VARIATION
half3 shiftedColor = lerp(s.baseColor, _HueVariation.rgb, s.vertexColor.b);
half maxBase = max(s.baseColor.r, max(s.baseColor.g, s.baseColor.b));
half newMaxBase = max(shiftedColor.r, max(shiftedColor.g, shiftedColor.b));
maxBase /= newMaxBase;
maxBase = maxBase * 0.5f + 0.5f;
// preserve vibrance
shiftedColor.rgb *= maxBase;
s.baseColor = saturate(shiftedColor);
#endif
s.baseColor *= _Color.rgb;
#endif
}
#endif // ALLOY_SHADERS_FEATURE_SPEED_TREE_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 18ae5991297c6154b9c6ae35e79d210c
timeCreated: 1462649829
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file TeamColor.cginc
/// @brief Team Color via texture color component masks and per-mask tint colors.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_TEAMCOLOR_CGINC
#define ALLOY_SHADERS_FEATURE_TEAMCOLOR_CGINC
#if !defined(A_TEAMCOLOR_ON) && defined(_TEAMCOLOR_ON)
#define A_TEAMCOLOR_ON
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_TEAMCOLOR_ON
/// Toggles using the mask texture as a color tint.
/// Expects either 0 or 1.
float _TeamColorMasksAsTint;
/// Mask map that stores a tint mask in each channel.
/// Expects an RGB(A) data map.
sampler2D _TeamColorMaskMap;
/// Toggles which channels to use from the masks map.
/// Expects a vector where each component is either 0 or 1;
half4 _TeamColorMasks;
/// The red channel mask tint color.
/// Expects a linear LDR color.
half3 _TeamColor0;
/// The green channel mask tint color.
/// Expects a linear LDR color.
half3 _TeamColor1;
/// The blue channel mask tint color.
/// Expects a linear LDR color.
half3 _TeamColor2;
/// The alpha channel mask tint color.
/// Expects a linear LDR color.
half3 _TeamColor3;
#endif
void aTeamColor(
inout ASurface s)
{
#ifdef A_TEAMCOLOR_ON
half4 masksColor = tex2D(_TeamColorMaskMap, s.baseUv);
half4 masks = s.mask * (_TeamColorMasks * masksColor);
half weight = dot(masks, A_ONE4);
// Renormalize masks when their combined weight sums to greater than one.
masks /= max(1.0h, weight);
// Combine colors, then fill to white where weights sum to less than one.
half3 teamColor = _TeamColor0 * masks.r
+ _TeamColor1 * masks.g
+ _TeamColor2 * masks.b
+ _TeamColor3 * masks.a
+ saturate(1.0h - weight).rrr;
s.baseColor *= _TeamColorMasksAsTint < 0.5f ? teamColor : masksColor.rgb;
#endif
}
#endif // ALLOY_SHADERS_FEATURE_TEAMCOLOR_CGINC
@@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 1b62132a7383f004fb2fcc4110d1bf2a
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
+129
View File
@@ -0,0 +1,129 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Terrain.cginc
/// @brief Unity terrain mapping.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_TERRAIN_CGINC
#define ALLOY_SHADERS_FEATURE_TERRAIN_CGINC
#ifdef A_TERRAIN_ON
#ifndef A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA
#define A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA
#endif
#ifndef A_TERRAIN_DISTANT
#ifndef A_VIEW_DEPTH_ON
#define A_VIEW_DEPTH_ON
#endif
#else
// Needed for detail normal map.
#ifndef A_NORMAL_MAPPING_ON
#define A_NORMAL_MAPPING_ON
#endif
#endif
#ifndef A_METALLIC_ON
#define A_METALLIC_ON
#endif
#ifndef A_SPECULAR_TINT_ON
#define A_SPECULAR_TINT_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_TERRAIN_ON
#ifdef A_TERRAIN_DISTANT
sampler2D _MetallicTex;
#else
A_SAMPLER_2D(_Control);
half _TriplanarBlendSharpness;
A_SAMPLER_2D(_Splat0);
sampler2D _Normal0;
half _Metallic0;
half _SplatSpecularity0;
half _SplatSpecularTint0;
A_SAMPLER_2D(_Splat1);
sampler2D _Normal1;
half _Metallic1;
half _SplatSpecularity1;
half _SplatSpecularTint1;
A_SAMPLER_2D(_Splat2);
sampler2D _Normal2;
half _Metallic2;
half _SplatSpecularity2;
half _SplatSpecularTint2;
A_SAMPLER_2D(_Splat3);
sampler2D _Normal3;
half _Metallic3;
half _SplatSpecularity3;
half _SplatSpecularTint3;
half _FadeDist;
half _FadeRange;
#endif
half _DistantSpecularity;
half _DistantSpecularTint;
half _DistantRoughness;
#endif
void aTerrain(
inout ASurface s)
{
#ifdef A_TERRAIN_ON
#ifdef A_TERRAIN_DISTANT
half4 col = aSampleBase(s);
s.baseColor = col.rgb;
s.metallic = tex2D (_MetallicTex, s.baseUv).r;
s.specularity = _DistantSpecularity;
s.specularTint = _DistantSpecularTint;
s.roughness = col.a * _DistantRoughness;
#else
// Create a smooth blend between near and distant terrain to hide transition.
// NOTE: Can't kill specular completely since we have to worry about deferred.
half fade = saturate((s.viewDepth - _FadeDist) / _FadeRange);
half4 splatControl = tex2D(_Control, A_TEX_TRANSFORM(s, _Control));
half weight = dot(splatControl, A_ONE4);
#if !defined(SHADER_API_MOBILE) && defined(A_TERRAIN_NSPLAT_ADDPASS_SHADER)
clip(weight == 0.0f ? -1 : 1);
#endif
// NOTE: 0.01 matches tiling of distant terrain combined maps.
ASplatContext sc = aNewSplatContext(s, _TriplanarBlendSharpness, 0.01f);
ASplat sp0 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat0), _Splat0, _Normal0, A_WHITE4, 0.0h, _Metallic0, _SplatSpecularity0, _SplatSpecularTint0, 1.0h, 1.0h, 1.0h);
ASplat sp1 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat1), _Splat1, _Normal1, A_WHITE4, 0.0h, _Metallic1, _SplatSpecularity1, _SplatSpecularTint1, 1.0h, 1.0h, 1.0h);
ASplat sp2 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat2), _Splat2, _Normal2, A_WHITE4, 0.0h, _Metallic2, _SplatSpecularity2, _SplatSpecularTint2, 1.0h, 1.0h, 1.0h);
ASplat sp3 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat3), _Splat3, _Normal3, A_WHITE4, 0.0h, _Metallic3, _SplatSpecularity3, _SplatSpecularTint3, 1.0h, 1.0h, 1.0h);
splatControl /= (weight + A_EPSILON);
aApplyTerrainSplats(s, splatControl, sp0, sp1, sp2, sp3);
#ifdef A_TERRAIN_NSPLAT_SHADER
s.specularity = _DistantSpecularity;
s.specularTint = _DistantSpecularTint;
#else
s.specularity = lerp(s.specularity, _DistantSpecularity, fade);
s.specularTint = lerp(s.specularTint, _DistantSpecularTint, fade);
#endif
s.roughness *= aLerpOneTo(_DistantRoughness, fade);
s.normalTangent = A_NT(s, normalize(lerp(s.normalTangent, A_FLAT_NORMAL, fade)));
s.opacity = weight; // Last to avoid being overwritten.
#endif
#endif
}
#endif // ALLOY_SHADERS_FEATURE_TERRAIN_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3c796aeac953f7b41b74f1fca8a41e59
timeCreated: 1468173456
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,65 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file TransitionBlend.cginc
/// @brief Blending using an alpha mask and a cutoff, with a glow effect.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_TRANSITION_BLEND_CGINC
#define ALLOY_SHADERS_FEATURE_TRANSITION_BLEND_CGINC
#ifdef A_TRANSITION_BLEND_ON
#ifndef A_EMISSIVE_COLOR_ON
#define A_EMISSIVE_COLOR_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_TRANSITION_BLEND_ON
/// Transition glow tint color.
/// Expects a linear HDR color with alpha.
half4 _TransitionGlowColor;
/// Transition glow color with effect ramp in the alpha.
/// Expects an RGBA map with sRGB sampling.
A_SAMPLER_2D(_TransitionTex);
/// The cutoff value for the transition effect in the ramp map.
/// Expects values in the range [0,1].
half _TransitionCutoff;
#ifndef A_TRANSITION_BLEND_GLOW_OFF
/// The weight of the transition glow effect.
/// Expects linear space value in the range [0,1].
half _TransitionGlowWeight;
/// The width of the transition glow effect.
/// Expects values in the range [0,1].
half _TransitionEdgeWidth;
#endif
#endif
void aTransitionBlend(
inout ASurface s)
{
#ifdef A_TRANSITION_BLEND_ON
float2 transitionUv = A_TEX_TRANSFORM_UV(s, _TransitionTex);
half4 transitionBase = _TransitionGlowColor * tex2D(_TransitionTex, transitionUv);
half clipval = transitionBase.a * 0.99h - _TransitionCutoff;
s.mask = clipval >= 0 ? 0.0h : s.mask;
#ifndef A_TRANSITION_BLEND_GLOW_OFF
// Transition glow
half3 glow = s.emissiveColor + transitionBase.rgb * _TransitionGlowWeight;
glow = clipval >= _TransitionEdgeWidth ? s.emissiveColor : glow; // Outer edge.
s.emissiveColor = _TransitionCutoff < A_EPSILON ? s.emissiveColor : glow; // Kill when cutoff is zero.
#endif
#endif
}
#endif // ALLOY_SHADERS_FEATURE_TRANSITION_BLEND_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c1bf572183fb24d498a29832cce8c0a3
timeCreated: 1429964722
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,44 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Transmission.cginc
/// @brief Basic transmission, handling render path differences.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_TRANSMISSION_CGINC
#define ALLOY_SHADERS_FEATURE_TRANSMISSION_CGINC
#ifdef A_TRANSMISSION_ON
#ifndef A_SUBSURFACE_ON
#define A_SUBSURFACE_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_TRANSMISSION_ON
/// Transmission tint color.
/// Expects a linear LDR color.
half3 _TransColor;
/// Transmission color * thickness texture.
/// Expects an RGB map with sRGB sampling.
sampler2D _TransTex;
/// Weight of the transmission effect.
/// Expects linear-space values in the range [0,1].
half _TransScale;
#endif
void aTransmission(
inout ASurface s)
{
#ifdef A_TRANSMISSION_ON
s.subsurfaceColor = A_SSC(s, _TransScale * tex2D(_TransTex, s.baseUv).rgb);
s.subsurfaceColor *= _TransColor;
#endif
}
#endif // ALLOY_SHADERS_FEATURE_TRANSMISSION_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 76933f9f19a25d0499212bf92af13044
timeCreated: 1468011426
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,146 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file TriPlanar.cginc
/// @brief TriPlanar mapping.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_TRIPLANAR_CGINC
#define ALLOY_SHADERS_FEATURE_TRIPLANAR_CGINC
#ifdef A_TRIPLANAR_ON
#ifndef A_TRIPLANAR_MAPPING_ON
#define A_TRIPLANAR_MAPPING_ON
#endif
#ifndef A_METALLIC_ON
#define A_METALLIC_ON
#endif
#ifndef A_SPECULAR_TINT_ON
#define A_SPECULAR_TINT_ON
#endif
#if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA)
#define A_AMBIENT_OCCLUSION_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_TRIPLANAR_ON
half _TriplanarBlendSharpness;
half4 _PrimaryColor;
A_SAMPLER_2D(_PrimaryMainTex);
sampler2D _PrimaryMaterialMap;
sampler2D _PrimaryBumpMap;
half _PrimaryColorVertexTint;
half _PrimaryMetallic;
half _PrimarySpecularity;
half _PrimarySpecularTint;
half _PrimaryOcclusion;
half _PrimaryRoughness;
half _PrimaryBumpScale;
#ifdef _SECONDARY_TRIPLANAR_ON
half4 _SecondaryColor;
A_SAMPLER_2D(_SecondaryMainTex);
sampler2D _SecondaryMaterialMap;
sampler2D _SecondaryBumpMap;
half _SecondaryColorVertexTint;
half _SecondaryMetallic;
half _SecondarySpecularity;
half _SecondarySpecularTint;
half _SecondaryOcclusion;
half _SecondaryRoughness;
half _SecondaryBumpScale;
#endif
#ifdef _TERTIARY_TRIPLANAR_ON
half4 _TertiaryColor;
A_SAMPLER_2D(_TertiaryMainTex);
sampler2D _TertiaryMaterialMap;
sampler2D _TertiaryBumpMap;
half _TertiaryColorVertexTint;
half _TertiaryMetallic;
half _TertiarySpecularity;
half _TertiarySpecularTint;
half _TertiaryOcclusion;
half _TertiaryRoughness;
half _TertiaryBumpScale;
#endif
#ifdef _QUATERNARY_TRIPLANAR_ON
half4 _QuaternaryColor;
A_SAMPLER_2D(_QuaternaryMainTex);
sampler2D _QuaternaryMaterialMap;
sampler2D _QuaternaryBumpMap;
half _QuaternaryColorVertexTint;
half _QuaternaryMetallic;
half _QuaternarySpecularity;
half _QuaternarySpecularTint;
half _QuaternaryRoughness;
half _QuaternaryOcclusion;
half _QuaternaryBumpScale;
#endif
#endif
void aTriPlanar(
inout ASurface s)
{
#ifdef A_TRIPLANAR_ON
ASplatContext sc = aNewSplatContext(s, _TriplanarBlendSharpness, 1.0h);
ASplat sp0 = aNewSplat();
#if 1 // PRIMARY
#if defined(_SECONDARY_TRIPLANAR_ON) || defined(_TERTIARY_TRIPLANAR_ON)
aTriPlanarPositiveY(sp0, sc, A_SAMPLER_2D_INPUT(_PrimaryMainTex), _PrimaryMaterialMap, _PrimaryBumpMap, _PrimaryOcclusion, _PrimaryBumpScale);
#else
aTriPlanarY(sp0, sc, A_SAMPLER_2D_INPUT(_PrimaryMainTex), _PrimaryMaterialMap, _PrimaryBumpMap, _PrimaryOcclusion, _PrimaryBumpScale);
#endif
#ifndef _SECONDARY_TRIPLANAR_ON
aTriPlanarX(sp0, sc, A_SAMPLER_2D_INPUT(_PrimaryMainTex), _PrimaryMaterialMap, _PrimaryBumpMap, _PrimaryOcclusion, _PrimaryBumpScale);
#ifndef _QUATERNARY_TRIPLANAR_ON
aTriPlanarZ(sp0, sc, A_SAMPLER_2D_INPUT(_PrimaryMainTex), _PrimaryMaterialMap, _PrimaryBumpMap, _PrimaryOcclusion, _PrimaryBumpScale);
#endif
#endif
aSplatMaterial(sp0, sc, _PrimaryColor, _PrimaryColorVertexTint, _PrimaryMetallic, _PrimarySpecularity, _PrimarySpecularTint, _PrimaryRoughness);
#endif
#ifdef _SECONDARY_TRIPLANAR_ON
ASplat sp1 = aNewSplat();
aTriPlanarX(sp1, sc, A_SAMPLER_2D_INPUT(_SecondaryMainTex), _SecondaryMaterialMap, _SecondaryBumpMap, _SecondaryOcclusion, _SecondaryBumpScale);
#ifndef _TERTIARY_TRIPLANAR_ON
aTriPlanarNegativeY(sp1, sc, A_SAMPLER_2D_INPUT(_SecondaryMainTex), _SecondaryMaterialMap, _SecondaryBumpMap, _SecondaryOcclusion, _SecondaryBumpScale);
#endif
#ifndef _QUATERNARY_TRIPLANAR_ON
aTriPlanarZ(sp1, sc, A_SAMPLER_2D_INPUT(_SecondaryMainTex), _SecondaryMaterialMap, _SecondaryBumpMap, _SecondaryOcclusion, _SecondaryBumpScale);
#endif
aSplatMaterial(sp1, sc, _SecondaryColor, _SecondaryColorVertexTint, _SecondaryMetallic, _SecondarySpecularity, _SecondarySpecularTint, _SecondaryRoughness);
aMergeSplats(sp0, sp1);
#endif
#ifdef _TERTIARY_TRIPLANAR_ON
ASplat sp2 = aNewSplat();
aTriPlanarNegativeY(sp2, sc, A_SAMPLER_2D_INPUT(_TertiaryMainTex), _TertiaryMaterialMap, _TertiaryBumpMap, _TertiaryOcclusion, _TertiaryBumpScale);
aSplatMaterial(sp2, sc, _TertiaryColor, _TertiaryColorVertexTint, _TertiaryMetallic, _TertiarySpecularity, _TertiarySpecularTint, _TertiaryRoughness);
aMergeSplats(sp0, sp2);
#endif
#ifdef _QUATERNARY_TRIPLANAR_ON
ASplat sp3 = aNewSplat();
aTriPlanarZ(sp3, sc, A_SAMPLER_2D_INPUT(_QuaternaryMainTex), _QuaternaryMaterialMap, _QuaternaryBumpMap, _QuaternaryOcclusion, _QuaternaryBumpScale);
aSplatMaterial(sp3, sc, _QuaternaryColor, _QuaternaryColorVertexTint, _QuaternaryMetallic, _QuaternarySpecularity, _QuaternarySpecularTint, _QuaternaryRoughness);
aMergeSplats(sp0, sp3);
#endif
aApplySplat(s, sp0);
aCutout(s);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_TRIPLANAR_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: df4fa77c31f768b498ff4092a03d54dd
timeCreated: 1468172538
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,113 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file VertexBlend.cginc
/// @brief 3-4 splat blending with vertex color weights.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_VERTEX_BLEND_CGINC
#define ALLOY_SHADERS_FEATURE_VERTEX_BLEND_CGINC
#if !defined(A_ALPHA_SPLAT_ON) && defined(_SPECGLOSSMAP)
#define A_ALPHA_SPLAT_ON
#endif
#ifdef A_VERTEX_BLEND_ON
#ifndef A_VERTEX_COLOR_IS_DATA
#define A_VERTEX_COLOR_IS_DATA
#endif
#ifndef A_METALLIC_ON
#define A_METALLIC_ON
#endif
#ifndef A_SPECULAR_TINT_ON
#define A_SPECULAR_TINT_ON
#endif
#if !defined(A_AMBIENT_OCCLUSION_ON) && !defined(A_ROUGHNESS_SOURCE_BASE_COLOR_ALPHA)
#define A_AMBIENT_OCCLUSION_ON
#endif
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_VERTEX_BLEND_ON
half _TriplanarBlendSharpness;
half4 _Splat0Tint;
A_SAMPLER_2D(_Splat0);
sampler2D _MaterialMap0;
sampler2D _Normal0;
half _Metallic0;
half _SplatSpecularity0;
half _SplatSpecularTint0;
half _SplatRoughness0;
half _SplatOcclusion0;
half _SplatBumpScale0;
half4 _Splat1Tint;
A_SAMPLER_2D(_Splat1);
sampler2D _MaterialMap1;
sampler2D _Normal1;
half _Metallic1;
half _SplatSpecularity1;
half _SplatSpecularTint1;
half _SplatRoughness1;
half _SplatOcclusion1;
half _SplatBumpScale1;
half4 _Splat2Tint;
A_SAMPLER_2D(_Splat2);
sampler2D _MaterialMap2;
sampler2D _Normal2;
half _Metallic2;
half _SplatSpecularity2;
half _SplatSpecularTint2;
half _SplatRoughness2;
half _SplatOcclusion2;
half _SplatBumpScale2;
#ifdef A_ALPHA_SPLAT_ON
half4 _Splat3Tint;
A_SAMPLER_2D(_Splat3);
sampler2D _MaterialMap3;
sampler2D _Normal3;
half _Metallic3;
half _SplatSpecularity3;
half _SplatSpecularTint3;
half _SplatRoughness3;
half _SplatOcclusion3;
half _SplatBumpScale3;
#endif
#endif
void aVertexBlend(
inout ASurface s)
{
#ifdef A_VERTEX_BLEND_ON
ASplatContext sc = aNewSplatContext(s, _TriplanarBlendSharpness, 1.0f);
ASplat sp0 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat0), _MaterialMap0, _Normal0, _Splat0Tint, 0.0h, _Metallic0, _SplatSpecularity0, _SplatSpecularTint0, _SplatRoughness0, _SplatOcclusion0, _SplatBumpScale0);
ASplat sp1 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat1), _MaterialMap1, _Normal1, _Splat1Tint, 0.0h, _Metallic1, _SplatSpecularity1, _SplatSpecularTint1, _SplatRoughness1, _SplatOcclusion1, _SplatBumpScale1);
ASplat sp2 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat2), _MaterialMap2, _Normal2, _Splat2Tint, 0.0h, _Metallic2, _SplatSpecularity2, _SplatSpecularTint2, _SplatRoughness2, _SplatOcclusion2, _SplatBumpScale2);
#ifdef A_ALPHA_SPLAT_ON
half4 splatControl = s.vertexColor;
ASplat sp3 = aNewSplat(sc, A_SAMPLER_2D_INPUT(_Splat3), _MaterialMap3, _Normal3, _Splat3Tint, 0.0h, _Metallic3, _SplatSpecularity3, _SplatSpecularTint3, _SplatRoughness3, _SplatOcclusion3, _SplatBumpScale3);
splatControl /= (dot(splatControl, A_ONE4) + A_EPSILON);
aApplyTerrainSplats(s, splatControl, sp0, sp1, sp2, sp3);
#else
half3 splatControl = s.vertexColor.xyz;
splatControl /= (dot(splatControl, A_ONE) + A_EPSILON);
aApplyTerrainSplats(s, splatControl, sp0, sp1, sp2);
#endif
aCutout(s);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_VERTEX_BLEND_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b8f13d9e421ffde4aa730e71d0646108
timeCreated: 1473017552
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file WeightedBlend.cginc
/// @brief Blending with a heightmap, a cutoff value, and the vertex color alpha.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_WEIGHTED_BLEND_CGINC
#define ALLOY_SHADERS_FEATURE_WEIGHTED_BLEND_CGINC
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_WEIGHTED_BLEND_ON
/// Heightmap used for blending.
/// Expects an RGB data map.
A_SAMPLER_2D(_BlendMap);
/// Heightmap Blend weight.
/// Expects values in the range [0,1].
half _BlendScale;
/// Height cutoff where blend begins.
/// Expects values in the range [0,1].
half _BlendCutoff;
/// Offset from cutoff where smooth blending occurs.
/// Expects values in the range [0.0001,1].
half _Blend;
/// Controls how much the vertex color alpha influences the cutoff.
/// Expects values in the range [0,1].
half _BlendAlphaVertexTint;
#endif
void aHeightmapBlend(
inout ASurface s)
{
#ifdef A_WEIGHTED_BLEND_ON
float2 blendUv = A_TEX_TRANSFORM_UV(s, _BlendMap);
half mask = tex2D(_BlendMap, blendUv).g;
aBlendRangeMask(s, mask, _BlendScale, _BlendCutoff, _Blend, _BlendAlphaVertexTint);
#endif
}
#endif // ALLOY_SHADERS_FEATURE_WEIGHTED_BLEND_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4cb825adbb5a5a640acdf28fb71f9a6e
timeCreated: 1429839207
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,89 @@
// Alloy Physical Shader Framework
// Copyright 2013-2017 RUST LLC.
// http://www.alloy.rustltd.com/
/////////////////////////////////////////////////////////////////////////////////
/// @file Wetness.cginc
/// @brief Handles all wet material effects.
/////////////////////////////////////////////////////////////////////////////////
#ifndef ALLOY_SHADERS_FEATURE_WETNESS_CGINC
#define ALLOY_SHADERS_FEATURE_WETNESS_CGINC
#if !defined(A_WETNESS_ON) && defined(_WETNESS_ON)
#define A_WETNESS_ON
#endif
#include "Assets/Alloy/Shaders/Framework/Feature.cginc"
#ifdef A_WETNESS_ON
#ifndef A_WETNESS_MASK_OFF
/// Mask that controls the wetness influence on the base material.
/// Expects an alpha data map.
A_SAMPLER_2D(_WetMask);
#endif
/// Controls how much the vertex alpha masks the detail maps.
/// Expects values in the range [0,1].
half _WetMaskStrength;
/// The tint color for liquid wetting the surface.
/// Expects a linear LDR color.
half3 _WetTint;
#ifndef A_WETNESS_NORMAL_MAP_OFF
/// Wetness normal map.
/// Expects a compressed normal map.
A_SAMPLER_2D(_WetNormalMap);
#endif
/// Controls the wetness influence on the base material.
/// Expects values in the range [0,1].
half _WetWeight;
/// The roughness for wet porous materials.
/// Expects values in the range [0,1].
half _WetRoughness;
#ifndef A_WETNESS_NORMAL_MAP_OFF
/// Normal map XY scale.
half _WetNormalMapScale;
#endif
#endif
void aWetness(
inout ASurface s)
{
#ifdef A_WETNESS_ON
half mask = s.mask * _WetWeight;
#ifndef A_WETNESS_MASK_OFF
#ifdef _WETMASKSOURCE_VERTEXCOLORALPHA
half alpha = s.vertexColor.a;
#else
half alpha = tex2D(_WetMask, A_TEX_TRANSFORM_UV_SCROLL(s, _WetMask)).a;
#endif
mask *= aLerpOneTo(alpha, _WetMaskStrength);
#endif
// Physically-based wet surfaces.
// cf https://seblagarde.files.wordpress.com/2013/08/gdce13_lagarde_harduin_light.pdf pg 63
half porosity = 1.0h;
#ifndef A_WETNESS_POROSITY_OFF
porosity = (1.0h - s.metallic) * saturate(s.roughness * 2.5h - 1.25h);
#endif
s.baseColor *= aLerpWhiteTo(_WetTint * aLerpOneTo(0.2h, porosity), mask);
s.roughness *= aLerpOneTo(_WetRoughness, aLerpOneTo(0.2h, 0.5h * porosity) * mask);
#ifndef A_WETNESS_NORMAL_MAP_OFF
float2 normalUv = A_TEX_TRANSFORM_UV_SCROLL(s, _WetNormalMap);
half3 wetNormals = UnpackScaleNormal(tex2D(_WetNormalMap, normalUv), mask * _WetNormalMapScale);
s.normalTangent = A_NT(s, BlendNormals(s.normalTangent, wetNormals));
#endif
#endif
}
#endif // ALLOY_SHADERS_FEATURE_WETNESS_CGINC
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 206217fa75cf77d4680055f3a67639fd
timeCreated: 1468787829
licenseType: Pro
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant: