mirror of
https://github.com/muskit/H3VR-TNH-Quality-of-Life-Improvements.git
synced 2026-06-03 04:34:26 -07:00
Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// Alloy Physical Shader Framework
|
||||
// Copyright 2013-2017 RUST LLC.
|
||||
// http://www.alloy.rustltd.com/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// @file Add.cginc
|
||||
/// @brief Forward add lighting pass vertex & fragment shaders.
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ALLOY_SHADERS_FORWARD_ADD_CGINC
|
||||
#define ALLOY_SHADERS_FORWARD_ADD_CGINC
|
||||
|
||||
#define A_TESSELLATION_PASS
|
||||
#define A_NORMAL_MAPPED_PASS
|
||||
#define A_PARALLAX_MAPPED_PASS
|
||||
#define A_DIRECT_LIGHTING_PASS
|
||||
#define A_VOLUMETRIC_PASS
|
||||
#define A_ALPHA_BLENDING_PASS
|
||||
|
||||
#include "Assets/Alloy/Shaders/Framework/Forward.cginc"
|
||||
|
||||
void aMainVertexShader(
|
||||
AVertexInput v,
|
||||
out AFragmentInput o,
|
||||
out float4 opos : SV_POSITION)
|
||||
{
|
||||
aForwardVertexShader(v, o, opos);
|
||||
}
|
||||
|
||||
half4 aMainFragmentShader(
|
||||
AFragmentInput i
|
||||
A_FACING_SIGN_PARAM) : SV_Target
|
||||
{
|
||||
return aForwardLitColorShader(i, A_FACING_SIGN);
|
||||
}
|
||||
|
||||
#endif // ALLOY_SHADERS_FORWARD_ADD_CGINC
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 058d3393fb69e6d448c6d7d49a4e12f1
|
||||
timeCreated: 1450820201
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
// Alloy Physical Shader Framework
|
||||
// Copyright 2013-2017 RUST LLC.
|
||||
// http://www.alloy.rustltd.com/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// @file Base.cginc
|
||||
/// @brief Forward base lighting pass vertex & fragment shaders.
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ALLOY_SHADERS_FORWARD_BASE_CGINC
|
||||
#define ALLOY_SHADERS_FORWARD_BASE_CGINC
|
||||
|
||||
#define A_BASE_PASS
|
||||
#define A_TESSELLATION_PASS
|
||||
#define A_INSTANCING_PASS
|
||||
#define A_STEREO_INSTANCING_PASS
|
||||
#define A_NORMAL_MAPPED_PASS
|
||||
#define A_PARALLAX_MAPPED_PASS
|
||||
#define A_DIRECT_LIGHTING_PASS
|
||||
#define A_INDIRECT_LIGHTING_PASS
|
||||
#define A_VOLUMETRIC_PASS
|
||||
#define A_ALPHA_BLENDING_PASS
|
||||
|
||||
#include "Assets/Alloy/Shaders/Framework/Forward.cginc"
|
||||
|
||||
void aMainVertexShader(
|
||||
AVertexInput v,
|
||||
out AFragmentInput o,
|
||||
out float4 opos : SV_POSITION)
|
||||
{
|
||||
aForwardVertexShader(v, o, opos);
|
||||
}
|
||||
|
||||
half4 aMainFragmentShader(
|
||||
AFragmentInput i
|
||||
A_FACING_SIGN_PARAM) : SV_Target
|
||||
{
|
||||
return aForwardLitColorShader(i, A_FACING_SIGN);
|
||||
}
|
||||
|
||||
#endif // ALLOY_SHADERS_FORWARD_BASE_CGINC
|
||||
@@ -0,0 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a7c53c728dcbca448292b6df23444f4
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -0,0 +1,97 @@
|
||||
// Alloy Physical Shader Framework
|
||||
// Copyright 2013-2017 RUST LLC.
|
||||
// http://www.alloy.rustltd.com/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// @file Distort.cginc
|
||||
/// @brief Forward distort pass vertex & fragment shaders.
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ALLOY_SHADERS_FORWARD_DISTORT_CGINC
|
||||
#define ALLOY_SHADERS_FORWARD_DISTORT_CGINC
|
||||
|
||||
#define A_TEXEL_SIZE(a) a##_TexelSize
|
||||
|
||||
#ifndef A_DISTORT_TEXTURE
|
||||
#define A_DISTORT_TEXTURE _GrabTexture
|
||||
#endif
|
||||
|
||||
#define A_DISTORT_TEXTURE_TEXEL_SIZE A_TEXEL_SIZE(A_DISTORT_TEXTURE)
|
||||
|
||||
#define A_BASE_PASS
|
||||
#define A_TESSELLATION_PASS
|
||||
#define A_INSTANCING_PASS
|
||||
#define A_STEREO_INSTANCING_PASS
|
||||
#define A_NORMAL_MAPPED_PASS
|
||||
#define A_PARALLAX_MAPPED_PASS
|
||||
#define A_VOLUMETRIC_PASS
|
||||
|
||||
#define A_FORWARD_TEXCOORD0 float3 normalProjection : TEXCOORD0;
|
||||
#define A_FORWARD_TEXCOORD1 float4 grabUv : TEXCOORD1;
|
||||
|
||||
#include "Assets/Alloy/Shaders/Framework/Forward.cginc"
|
||||
|
||||
/// Grab texture containing copy of the back buffer.
|
||||
sampler2D A_DISTORT_TEXTURE;
|
||||
|
||||
/// Grab texture dimension info.
|
||||
/// (x: 1 / width, y: 1 / height, z: width, w: height).
|
||||
float4 A_DISTORT_TEXTURE_TEXEL_SIZE;
|
||||
|
||||
/// Weight of the distortion effect.
|
||||
/// Expects values in the range [0,1].
|
||||
float _DistortWeight;
|
||||
|
||||
/// Strength of the distortion effect.
|
||||
/// Expects values in the range [0,128].
|
||||
float _DistortIntensity;
|
||||
|
||||
/// Mesh normals influence on distortion.
|
||||
/// Expects values in the range [0,1].
|
||||
float _DistortGeoWeight;
|
||||
|
||||
void aMainVertexShader(
|
||||
AVertexInput v,
|
||||
out AFragmentInput o,
|
||||
out float4 opos : SV_POSITION)
|
||||
{
|
||||
aForwardVertexShader(v, o, opos);
|
||||
o.normalProjection = mul((float3x3)UNITY_MATRIX_MVP, v.normal);
|
||||
|
||||
// Until ComputeGrabScreenPos() is fixed, just directly pasted code here.
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
float scale = -1.0;
|
||||
#else
|
||||
float scale = 1.0;
|
||||
#endif
|
||||
o.grabUv.xy = (float2(opos.x, opos.y * scale) + opos.ww) * 0.5;
|
||||
o.grabUv.zw = opos.zw;
|
||||
}
|
||||
|
||||
half4 aMainFragmentShader(
|
||||
AFragmentInput i
|
||||
A_FACING_SIGN_PARAM) : SV_Target
|
||||
{
|
||||
// Transfer instancing and stereo IDs.
|
||||
ASurface s = aForwardSurface(i, A_FACING_SIGN);
|
||||
|
||||
// Adjust grab texture UVs and weight.
|
||||
i.grabUv.z = UNITY_Z_0_FAR_FROM_CLIPSPACE(i.grabUv.z);
|
||||
|
||||
#if UNITY_SINGLE_PASS_STEREO
|
||||
i.grabUv.xy = TransformStereoScreenSpaceTex(i.grabUv.xy, i.grabUv.w);
|
||||
#endif
|
||||
|
||||
// Mesh normals distortion.
|
||||
// cf http://wiki.unity3d.com/index.php?title=Refraction
|
||||
float3 bump = s.normalTangent + i.normalProjection * abs(i.normalProjection);
|
||||
float2 offset = A_DISTORT_TEXTURE_TEXEL_SIZE.xy * lerp(s.normalTangent, bump, _DistortGeoWeight).xy;
|
||||
|
||||
i.grabUv.xy += offset * (i.grabUv.z * _DistortWeight * _DistortIntensity);
|
||||
|
||||
// Sample and combine textures.
|
||||
half3 refr = tex2Dproj(A_DISTORT_TEXTURE, UNITY_PROJ_COORD(i.grabUv)).rgb;
|
||||
return aForwardColor(s, s.baseColor * refr);
|
||||
}
|
||||
|
||||
#endif // ALLOY_SHADERS_FORWARD_DISTORT_CGINC
|
||||
@@ -0,0 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acbe11d41b7bd5e4cb2521d5fad8840d
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -0,0 +1,39 @@
|
||||
// Alloy Physical Shader Framework
|
||||
// Copyright 2013-2017 RUST LLC.
|
||||
// http://www.alloy.rustltd.com/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// @file Gbuffer.cginc
|
||||
/// @brief Forward g-buffer fill pass vertex & fragment shaders.
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ALLOY_SHADERS_FORWARD_GBUFFER_CGINC
|
||||
#define ALLOY_SHADERS_FORWARD_GBUFFER_CGINC
|
||||
|
||||
#define A_BASE_PASS
|
||||
#define A_TESSELLATION_PASS
|
||||
#define A_INSTANCING_PASS
|
||||
#define A_STEREO_INSTANCING_PASS
|
||||
#define A_NORMAL_MAPPED_PASS
|
||||
#define A_PARALLAX_MAPPED_PASS
|
||||
#define A_INDIRECT_LIGHTING_PASS
|
||||
#define A_GBUFFER_PASS
|
||||
|
||||
#include "Assets/Alloy/Shaders/Framework/Forward.cginc"
|
||||
|
||||
void aMainVertexShader(
|
||||
AVertexInput v,
|
||||
out AFragmentInput o,
|
||||
out float4 opos : SV_POSITION)
|
||||
{
|
||||
aForwardVertexShader(v, o, opos);
|
||||
}
|
||||
|
||||
AGbuffer aMainFragmentShader(
|
||||
AFragmentInput i
|
||||
A_FACING_SIGN_PARAM)
|
||||
{
|
||||
return aForwardLitGbufferShader(i, A_FACING_SIGN);
|
||||
}
|
||||
|
||||
#endif // ALLOY_SHADERS_FORWARD_GBUFFER_CGINC
|
||||
@@ -0,0 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a504ca3a7ab5c143a425e5baf077a21
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -0,0 +1,57 @@
|
||||
// Alloy Physical Shader Framework
|
||||
// Copyright 2013-2017 RUST LLC.
|
||||
// http://www.alloy.rustltd.com/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// @file Meta.cginc
|
||||
/// @brief Forward meta pass vertex & fragment shaders.
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ALLOY_SHADERS_FORWARD_META_CGINC
|
||||
#define ALLOY_SHADERS_FORWARD_META_CGINC
|
||||
|
||||
#ifndef A_UV2_ON
|
||||
#define A_UV2_ON
|
||||
#endif
|
||||
|
||||
#define A_BASE_PASS
|
||||
|
||||
#include "Assets/Alloy/Shaders/Framework/Forward.cginc"
|
||||
|
||||
#include "UnityMetaPass.cginc"
|
||||
|
||||
void aMainVertexShader(
|
||||
AVertexInput v,
|
||||
out AFragmentInput o,
|
||||
out float4 opos : SV_POSITION)
|
||||
{
|
||||
aForwardVertexShader(v, o, opos);
|
||||
opos = UnityMetaVertexPosition(v.vertex, v.uv1.xy, v.uv2.xy, unity_LightmapST, unity_DynamicLightmapST);
|
||||
}
|
||||
|
||||
float4 aMainFragmentShader(
|
||||
AFragmentInput i) : SV_Target
|
||||
{
|
||||
UnityMetaInput o;
|
||||
ASurface s = aForwardSurface(i, 1.0h);
|
||||
|
||||
UNITY_INITIALIZE_OUTPUT(UnityMetaInput, o);
|
||||
|
||||
#if defined(EDITOR_VISUALIZATION)
|
||||
o.Albedo = s.albedo;
|
||||
#else
|
||||
o.Albedo = s.albedo + (s.f0 * (s.beckmannRoughness * 0.5h));
|
||||
#endif
|
||||
|
||||
o.SpecularColor = s.f0;
|
||||
|
||||
#ifndef A_EMISSIVE_COLOR_ON
|
||||
o.Emission = A_BLACK;
|
||||
#else
|
||||
o.Emission = aHdrClamp(s.emissiveColor);
|
||||
#endif
|
||||
|
||||
return UnityMetaFragment(o);
|
||||
}
|
||||
|
||||
#endif // ALLOY_SHADERS_FORWARD_META_CGINC
|
||||
@@ -0,0 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24101a9f398da70458f5277778ea3eff
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -0,0 +1,87 @@
|
||||
// Alloy Physical Shader Framework
|
||||
// Copyright 2013-2017 RUST LLC.
|
||||
// http://www.alloy.rustltd.com/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/// @file Shadow.cginc
|
||||
/// @brief Forward shadow pass vertex & fragment shaders.
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ALLOY_SHADERS_FORWARD_SHADOW_CGINC
|
||||
#define ALLOY_SHADERS_FORWARD_SHADOW_CGINC
|
||||
|
||||
// Do dithering for alpha blended shadows on SM3+/desktop;
|
||||
// on lesser systems do simple alpha-tested shadows
|
||||
#if defined(A_ALPHA_BLENDING_ON) && defined(UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS)
|
||||
#define UNITY_STANDARD_USE_DITHER_MASK 1
|
||||
#endif
|
||||
|
||||
// Need to output UVs in shadow caster, since we need to sample texture and do clip/dithering based on it
|
||||
#if !defined(INSTANCING_ON) && !defined(A_OPACITY_MASK_ON) && !defined(_ALPHATEST_ON) && !defined(A_ALPHA_BLENDING_ON)
|
||||
#define A_SURFACE_SHADER_OFF
|
||||
#endif
|
||||
|
||||
// Has a non-empty shadow caster output struct (it's an error to have empty structs on some platforms...)
|
||||
#if defined(V2F_SHADOW_CASTER_NOPOS_IS_EMPTY) && defined(A_SURFACE_SHADER_OFF)
|
||||
#define A_VERTEX_TO_FRAGMENT_OFF
|
||||
#endif
|
||||
|
||||
#define A_TESSELLATION_PASS
|
||||
#define A_INSTANCING_PASS
|
||||
|
||||
#ifdef UNITY_STEREO_INSTANCING_ENABLED
|
||||
#define A_STEREO_INSTANCING_PASS
|
||||
#endif
|
||||
|
||||
#define A_FORWARD_TEXCOORD0 V2F_SHADOW_CASTER_NOPOS
|
||||
|
||||
#include "Assets/Alloy/Shaders/Framework/Forward.cginc"
|
||||
|
||||
#ifdef UNITY_STANDARD_USE_DITHER_MASK
|
||||
sampler3D _DitherMaskLOD;
|
||||
#endif
|
||||
|
||||
// We have to do these dances of outputting SV_POSITION separately from the vertex shader,
|
||||
// and inputting VPOS in the pixel shader, since they both map to "POSITION" semantic on
|
||||
// some platforms, and then things don't go well.
|
||||
|
||||
void aMainVertexShader(
|
||||
AVertexInput v,
|
||||
#ifndef A_VERTEX_TO_FRAGMENT_OFF
|
||||
out AFragmentInput o,
|
||||
#endif
|
||||
out float4 opos : SV_POSITION)
|
||||
{
|
||||
#ifndef A_SURFACE_SHADER_OFF
|
||||
aForwardVertexShader(v, o, opos);
|
||||
#endif
|
||||
TRANSFER_SHADOW_CASTER_NOPOS(o, opos) // Implicitly expects 'v' parameter.
|
||||
}
|
||||
|
||||
half4 aMainFragmentShader(
|
||||
#ifndef A_VERTEX_TO_FRAGMENT_OFF
|
||||
AFragmentInput i
|
||||
#endif
|
||||
#ifdef UNITY_STANDARD_USE_DITHER_MASK
|
||||
, UNITY_VPOS_TYPE vpos : VPOS
|
||||
#endif
|
||||
#ifndef A_VERTEX_TO_FRAGMENT_OFF
|
||||
A_FACING_SIGN_PARAM
|
||||
#endif
|
||||
) : SV_Target
|
||||
{
|
||||
#ifndef A_SURFACE_SHADER_OFF
|
||||
ASurface s = aForwardSurface(i, A_FACING_SIGN);
|
||||
|
||||
#ifdef UNITY_STANDARD_USE_DITHER_MASK
|
||||
// Use dither mask for alpha blended shadows, based on pixel position xy
|
||||
// and alpha level. Our dither texture is 4x4x16.
|
||||
half alphaRef = tex3D(_DitherMaskLOD, float3(vpos.xy * 0.25f, s.opacity * 0.9375f)).a;
|
||||
clip(alphaRef - 0.01h);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SHADOW_CASTER_FRAGMENT(i)
|
||||
}
|
||||
|
||||
#endif // ALLOY_SHADERS_FORWARD_SHADOW_CGINC
|
||||
@@ -0,0 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18b775132d894a64fa8bc3d75d59182b
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
Reference in New Issue
Block a user