Add shaders

This commit is contained in:
Williams
2026-05-19 15:33:18 +02:00
committed by Lucien
parent 593c2e75b2
commit cd9df45d08
1358 changed files with 2429155 additions and 0 deletions
@@ -1,255 +0,0 @@
#include "UnityCG.cginc"
uniform float4 _HeightParams;
uniform float4 _DistanceParams;
uniform int4 _SceneFogMode;
uniform float4 _SceneFogParams;
uniform sampler2D _EnviroVolumeLightingTex;
uniform float4 _FogNoiseData;// x: scale, y: intensity, z: intensity offset
uniform float4 _FogNoiseVelocity; // x: x velocity, y: z velocity
uniform float4 _EnviroParams; //gametime,distance,height,_tonemapping
uniform float _EnviroVolumeDensity;
uniform float3 _Br;
uniform float3 _Bm;
uniform float3 _BmScene;
uniform float3 _mieG;
uniform float3 _mieGScene;
uniform float _FogExposure;
uniform float _SkyLuminance;
uniform float _scatteringPower;
uniform float4 _SunParameters; //x = _SunIntensity, y = _SunDiskSize, z = _SunDiskIntensity, w = SkyFog Height Lerp;
uniform float4 _scatteringColor;
uniform float _SkyColorPower;
uniform float3 _SunDir;
uniform float _scatteringStrenght;
uniform half _distanceFogIntensity;
uniform float4 _EnviroSkyFog; // x = _SkyFogHeight, y = _SkyFogIntensity, z = _SkyFogStart, w = _HeightFogIntensity
uniform float _maximumFogDensity;
uniform float4 _weatherSkyMod;
uniform float4 _weatherFogMod;
uniform float _lightning;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
half3 tonemapACES(half3 color, float Exposure)
{
color *= Exposure;
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
const half a = 2.51;
const half b = 0.03;
const half c = 2.43;
const half d = 0.59;
const half e = 0.14;
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
}
half ComputeFogFactor (float coord)
{
float fogFac = 0.0;
if (_SceneFogMode.x == 1) // linear
{
fogFac = coord * _SceneFogParams.z + _SceneFogParams.w;
}
if (_SceneFogMode.x == 2) // exp
{
fogFac = _SceneFogParams.y * coord; fogFac = exp2(-fogFac);
}
if (_SceneFogMode.x == 3) // exp2
{
fogFac = _SceneFogParams.x * coord; fogFac = exp2(-fogFac*fogFac);
}
return saturate(fogFac);
}
// Distance fog
float ComputeDistance (float3 camDir, float zdepth)
{
float dist;
dist = length(camDir);
// Built-in fog starts at near plane, so match that by
// subtracting the near value. Not a perfect approximation
// if near plane is very large, but good enough.
dist -= _ProjectionParams.y;
return dist;
}
// Linear height fog,
float ComputeHalfSpace (float3 wsDir)
{
float3 wpos = _WorldSpaceCameraPos + wsDir;
float FH = _HeightParams.x;
float3 C = _WorldSpaceCameraPos;
float3 V = wsDir;
float3 P = wpos;
float3 aV = (_HeightParams.w * _EnviroSkyFog.w) * V;
float FdotC = _HeightParams.y;
float k = _HeightParams.z;
float FdotP = P.y-FH;
float FdotV = wsDir.y;
float c1 = k * (FdotP + FdotC);
float c2 = (1-2*k) * FdotP;
float g = min(c2, 0.0);
g = -length(aV) * (c1 - g * g / abs(FdotV+1.0e-5f));
return g;
}
float4 ComputeScattering (float3 viewDir, float2 sunPos)
{
float cosTheta = dot(viewDir, _SunDir);
viewDir = viewDir + float3(0.0, 0.1 ,0.0);
float zen = acos(saturate(viewDir.y));
float alb = (cos(zen) + 0.5 * pow(93.885 - ((zen * 180.0) / 3.141592), - 0.253)); // pi
float3 fex = exp(-(_Br * (4 / alb) + _Bm * (1.25 / alb)));
float rayPhase = 2.5 + pow(cosTheta,1);
float miePhase = _mieG.x / pow(_mieG.y - _mieG.z * cosTheta, 1);
float3 BrTheta = 0.059683 * _Br * rayPhase;
float3 BmTheta = 0.079577 * _Bm * miePhase;
float3 BrmTheta = (BrTheta + BmTheta * 2.0) / ((_Bm + _Br) * 0.75);
float3 scattering = BrmTheta * _SunParameters.x * (1.0 - fex);
float3 skyFinalize = saturate((pow( 1.0 - fex, 2.0) * 0.234) * (1 - sunPos.x)) * _SkyLuminance;
skyFinalize = saturate(lerp(float3(0.1,0.1,0.1), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0,1,0)))) * (1-fex));
scattering *= saturate((lerp(float3(_scatteringPower, _scatteringPower, _scatteringPower), pow(2000.0f * BrmTheta * fex, 0.7), sunPos.y) * 0.05));
scattering *= (_SkyLuminance * _scatteringColor.rgb * _scatteringStrenght) * pow((1.0 - fex), 1.0) * sunPos.x;
//skyFinalize = lerp(skyFinalize,lerp(skyFinalize,_weatherFogMod, clamp(cosTheta,0,1)), _weatherFogMod.a);
float4 fogScattering = float4((scattering + skyFinalize), 1);
//Tonemapping
if (_EnviroParams.w == 1)
{
fogScattering.rgb = tonemapACES(fogScattering.rgb, _FogExposure);
}
fogScattering = pow(fogScattering,_SkyColorPower);
fogScattering = lerp(fogScattering,lerp(fogScattering,_weatherSkyMod, clamp(cosTheta,0,1)), _weatherSkyMod.a);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherFogMod, _weatherFogMod.a), _weatherFogMod.a);
if(_lightning > 1)
fogScattering = fogScattering + (_lightning * 0.06);
return fogScattering;
}
float4 ComputeScatteringClouds(float3 viewDir, float2 sunPos, float time)
{
float cosTheta = dot(viewDir, _SunDir);
viewDir = viewDir + float3(0.0, 0.1, 0.0);
float zen = acos(saturate(viewDir.y));
float alb = (cos(zen) + 0.5 * pow(93.885 - ((zen * 180.0) / 3.141592), -0.253)); // pi
float3 fex = exp(-(_Br * (4 / alb) + _Bm * (1.25 / alb)));
float rayPhase = 2.5 + pow(cosTheta, 1);
float miePhase = _mieGScene.x / pow(_mieGScene.y - _mieGScene.z * cosTheta, 1);
float3 BrTheta = 0.059683 * _Br * rayPhase;
float3 BmTheta = 0.079577 * _BmScene * miePhase;
float3 BrmTheta = (BrTheta + BmTheta * 2.0) / ((_BmScene + _Br) * 0.75);
float3 scattering = BrmTheta * _SunParameters.x * (1.0 - fex);
float3 skyFinalize = saturate((pow(1.0 - fex, 2.0) * 0.234) * (1 - sunPos.x)) * _SkyLuminance;
skyFinalize = saturate(lerp(float3(0.1, 0.1, 0.1), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0, 1, 0)))) * (1 - fex));
scattering *= saturate((lerp(float3(_scatteringPower, _scatteringPower, _scatteringPower), pow(2000.0f * BrmTheta * fex, 0.7), sunPos.y) * 0.05));
scattering *= (_SkyLuminance * _scatteringColor.rgb * _scatteringStrenght) * pow((1.0 - fex), 1.0) * sunPos.x;
//skyFinalize = lerp(skyFinalize, lerp(skyFinalize, _weatherFogMod, clamp(cosTheta, 0, 1)), _weatherFogMod.a);
float4 fogScattering = float4((scattering + skyFinalize), 1);
//Tonemapping
if (_EnviroParams.w == 1)
{
fogScattering.rgb = tonemapACES(fogScattering.rgb, _FogExposure);
}
fogScattering = pow(fogScattering, _SkyColorPower);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherSkyMod, clamp(cosTheta, 0, 1)), _weatherSkyMod.a);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherFogMod, _weatherFogMod.a), _weatherFogMod.a);
return fogScattering * time;
}
float4 ComputeScatteringScene (float3 viewDir, float2 sunPos)
{
float cosTheta = dot(viewDir, _SunDir);
viewDir = viewDir + float3(0.0, 0.1 ,0.0);
float zen = acos(saturate(viewDir.y));
float alb = (cos(zen) + 0.5 * pow(93.885 - ((zen * 180.0) / 3.141592), - 0.253)); // pi
float3 fex = exp(-(_Br * (4 / alb) + _BmScene * (1.25 / alb)));
float rayPhase = 2.5 + pow(cosTheta,1);
float miePhase = _mieGScene.x / pow(_mieGScene.y - _mieGScene.z * cosTheta, 1);
float3 BrTheta = 0.059683 * _Br * rayPhase;
float3 BmTheta = 0.079577 * _BmScene * miePhase;
float3 BrmTheta = (BrTheta + BmTheta * 2.0) / ((_BmScene + _Br) * 0.75);
float3 scattering = BrmTheta * _SunParameters.x * (1.0 - fex);
float3 skyFinalize = saturate((pow( 1.0 - fex, 2.0) * 0.234) * (1 - sunPos.x)) * _SkyLuminance;
skyFinalize = saturate(lerp(float3(0.1,0.1,0.1), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0,1,0)))) * (1-fex));
scattering *= saturate((lerp(float3(_scatteringPower, _scatteringPower, _scatteringPower), pow(2000.0f * BrmTheta * fex, 0.7), sunPos.y) * 0.05));
scattering *= (_SkyLuminance * _scatteringColor.rgb * _scatteringStrenght) * pow((1.0 - fex), 1.0) * sunPos.x;
float4 fogScattering = float4((scattering + skyFinalize), 1);
//Tonemapping
if (_EnviroParams.w == 1)
{
fogScattering.rgb = tonemapACES(fogScattering.rgb, _FogExposure);
}
fogScattering = pow(fogScattering,_SkyColorPower);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherSkyMod, clamp(cosTheta, 0, 1)), _weatherSkyMod.a);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherFogMod, _weatherFogMod.a), _weatherFogMod.a);
if(_lightning > 1)
fogScattering = fogScattering + (_lightning * 0.06);
return fogScattering;
}
float4 TransparentFog(float4 clr, float3 wPos,float2 uv, half depth)
{
float3 wsDir = wPos - _WorldSpaceCameraPos;
float g = _DistanceParams.x;
if (_EnviroParams.y > 0)
{
g += ComputeDistance (wsDir, depth);
g *= _distanceFogIntensity ;
}
if (_EnviroParams.z > 0)
{
//g += ComputeHalfSpaceWithNoise (wsDir);
g += ComputeHalfSpace(wsDir);
}
float fogFac = ComputeFogFactor (max(0.0,g));
fogFac = lerp(_maximumFogDensity,1.0f,fogFac);
float4 fogClr = float4(0, 0, 0, 0);
#ifdef UNITY_PASS_FORWARDADD
float4 volumeLighting = float4(0, 0, 0, 0);
#else
#if ENVIRO_SIMPLE_FOG
fogClr = unity_FogColor;
#else
float2 sunDir;
sunDir.x = saturate(_SunDir.y + 0.25);
sunDir.y = saturate(clamp(1.0 - _SunDir.y, 0.0, 0.5));
fogClr = ComputeScatteringScene(normalize(wsDir), sunDir);
#endif
#if UNITY_SINGLE_PASS_STEREO
float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
uv = (uv - scaleOffset.zw) / scaleOffset.xy;
#endif
float4 volumeLighting = tex2D(_EnviroVolumeLightingTex, UnityStereoTransformScreenSpaceTex(uv)) * _EnviroParams.x;
#endif
float4 final = lerp (lerp(fogClr, fogClr + volumeLighting, _EnviroVolumeDensity), lerp(clr, clr + volumeLighting, _EnviroVolumeDensity), fogFac);
return final;
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 557ec7efae03e3d4c8c4a050ae0f6ef7
timeCreated: 1505167667
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,254 +0,0 @@
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
uniform float4 _HeightParams;
uniform float4 _DistanceParams;
uniform int4 _SceneFogMode;
uniform float4 _SceneFogParams;
uniform sampler2D _EnviroVolumeLightingTex;
uniform float4 _FogNoiseData;// x: scale, y: intensity, z: intensity offset
uniform float4 _FogNoiseVelocity; // x: x velocity, y: z velocity
uniform float4 _EnviroParams; //gametime,distance,height,_hdr
uniform float _EnviroVolumeDensity;
uniform float3 _Br;
uniform float3 _Bm;
uniform float3 _BmScene;
uniform float3 _mieG;
uniform float3 _mieGScene;
uniform float _FogExposure;
uniform float _SkyLuminance;
uniform float _scatteringPower;
uniform float4 _SunParameters; //x = _SunIntensity, y = _SunDiskSize, z = _SunDiskIntensity;
uniform float4 _scatteringColor;
uniform float _SkyColorPower;
uniform float3 _SunDir;
uniform float _scatteringStrenght;
uniform half _distanceFogIntensity;
uniform float4 _EnviroSkyFog; // x = _SkyFogHeight, y = _SkyFogIntensity, z = _SkyFogStart, w = _HeightFogIntensity
uniform float _maximumFogDensity;
uniform float4 _weatherSkyMod;
uniform float4 _weatherFogMod;
uniform float _lightning;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
half3 tonemapACES(half3 color, float Exposure)
{
color *= Exposure;
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
const half a = 2.51;
const half b = 0.03;
const half c = 2.43;
const half d = 0.59;
const half e = 0.14;
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
}
half ComputeFogFactorEnviro (float coord)
{
float fogFac = 0.0;
if (_SceneFogMode.x == 1) // linear
{
fogFac = coord * _SceneFogParams.z + _SceneFogParams.w;
}
if (_SceneFogMode.x == 2) // exp
{
fogFac = _SceneFogParams.y * coord; fogFac = exp2(-fogFac);
}
if (_SceneFogMode.x == 3) // exp2
{
fogFac = _SceneFogParams.x * coord; fogFac = exp2(-fogFac*fogFac);
}
return saturate(fogFac);
}
// Distance fog
float ComputeDistance (float3 camDir, float zdepth)
{
float dist;
dist = length(camDir);
// Built-in fog starts at near plane, so match that by
// subtracting the near value. Not a perfect approximation
// if near plane is very large, but good enough.
dist -= _ProjectionParams.y;
return dist;
}
// Linear height fog,
float ComputeHalfSpace (float3 wsDir)
{
float3 wpos = _WorldSpaceCameraPos + wsDir;
float FH = _HeightParams.x;
float3 C = _WorldSpaceCameraPos;
float3 V = wsDir;
float3 P = wpos;
float3 aV = (_HeightParams.w * _EnviroSkyFog.w) * V;
float FdotC = _HeightParams.y;
float k = _HeightParams.z;
float FdotP = P.y-FH;
float FdotV = wsDir.y;
float c1 = k * (FdotP + FdotC);
float c2 = (1-2*k) * FdotP;
float g = min(c2, 0.0);
g = -length(aV) * (c1 - g * g / abs(FdotV+1.0e-5f));
return g;
}
float4 ComputeScattering (float3 viewDir, float2 sunPos)
{
float cosTheta = dot(viewDir, _SunDir);
viewDir = viewDir + float3(0.0, 0.1 ,0.0);
float zen = acos(saturate(viewDir.y));
float alb = (cos(zen) + 0.5 * pow(93.885 - ((zen * 180.0) / 3.141592), - 0.253)); // pi
float3 fex = exp(-(_Br * (4 / alb) + _Bm * (1.25 / alb)));
float rayPhase = 2.5 + pow(cosTheta,1);
float miePhase = _mieG.x / pow(_mieG.y - _mieG.z * cosTheta, 1);
float3 BrTheta = 0.059683 * _Br * rayPhase;
float3 BmTheta = 0.079577 * _Bm * miePhase;
float3 BrmTheta = (BrTheta + BmTheta * 2.0) / ((_Bm + _Br) * 0.75);
float3 scattering = BrmTheta * _SunParameters.x * (1.0 - fex);
float3 skyFinalize = saturate((pow( 1.0 - fex, 2.0) * 0.234) * (1 - sunPos.x)) * _SkyLuminance;
skyFinalize = saturate(lerp(float3(0.1,0.1,0.1), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0,1,0)))) * (1-fex));
scattering *= saturate((lerp(float3(_scatteringPower, _scatteringPower, _scatteringPower), pow(2000.0f * BrmTheta * fex, 0.7), sunPos.y) * 0.05));
scattering *= (_SkyLuminance * _scatteringColor.rgb * _scatteringStrenght) * pow((1.0 - fex), 1.0) * sunPos.x;
//skyFinalize = lerp(skyFinalize,lerp(skyFinalize,_weatherFogMod, clamp(cosTheta,0,1)), _weatherFogMod.a);
float4 fogScattering = float4((scattering + skyFinalize), 1);
//Tonemapping
if (_EnviroParams.w == 1)
{
fogScattering.rgb = tonemapACES(fogScattering.rgb, _FogExposure);
}
fogScattering = pow(fogScattering,_SkyColorPower);
fogScattering = lerp(fogScattering,lerp(fogScattering,_weatherSkyMod, clamp(cosTheta,0,1)), _weatherSkyMod.a);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherFogMod, _weatherFogMod.a), _weatherFogMod.a);
if(_lightning > 1)
fogScattering = fogScattering + (_lightning * 0.06);
return fogScattering;
}
float4 ComputeScatteringClouds(float3 viewDir, float2 sunPos, float time)
{
float cosTheta = dot(viewDir, _SunDir);
viewDir = viewDir + float3(0.0, 0.1, 0.0);
float zen = acos(saturate(viewDir.y));
float alb = (cos(zen) + 0.5 * pow(93.885 - ((zen * 180.0) / 3.141592), -0.253)); // pi
float3 fex = exp(-(_Br * (4 / alb) + _Bm * (1.25 / alb)));
float rayPhase = 2.5 + pow(cosTheta, 1);
float miePhase = _mieG.x / pow(_mieG.y - _mieG.z * cosTheta, 1);
float3 BrTheta = 0.059683 * _Br * rayPhase;
float3 BmTheta = 0.079577 * _Bm * miePhase;
float3 BrmTheta = (BrTheta + BmTheta * 2.0) / ((_Bm + _Br) * 0.75);
float3 scattering = BrmTheta * _SunParameters.x * (1.0 - fex);
float3 skyFinalize = saturate((pow(1.0 - fex, 2.0) * 0.234) * (1 - sunPos.x)) * _SkyLuminance;
skyFinalize = saturate(lerp(float3(0.1, 0.1, 0.1), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0, 1, 0)))) * (1 - fex));
scattering *= saturate((lerp(float3(_scatteringPower, _scatteringPower, _scatteringPower), pow(2000.0f * BrmTheta * fex, 0.7), sunPos.y) * 0.05));
scattering *= (_SkyLuminance * _scatteringColor.rgb * _scatteringStrenght) * pow((1.0 - fex), 1.0) * sunPos.x;
//skyFinalize = lerp(skyFinalize, lerp(skyFinalize, _weatherFogMod, clamp(cosTheta, 0, 1)), _weatherFogMod.a);
float4 fogScattering = float4((scattering + skyFinalize), 1);
//Tonemapping
if (_EnviroParams.w == 1)
{
fogScattering.rgb = tonemapACES(fogScattering.rgb, _FogExposure);
}
fogScattering = pow(fogScattering, _SkyColorPower);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherSkyMod, clamp(cosTheta, 0, 1)), _weatherSkyMod.a);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherFogMod, _weatherFogMod.a), _weatherFogMod.a);
return fogScattering * time;
}
float4 ComputeScatteringScene (float3 viewDir, float2 sunPos)
{
float cosTheta = dot(viewDir, _SunDir);
viewDir = viewDir + float3(0.0, 0.1 ,0.0);
float zen = acos(saturate(viewDir.y));
float alb = (cos(zen) + 0.5 * pow(93.885 - ((zen * 180.0) / 3.141592), - 0.253)); // pi
float3 fex = exp(-(_Br * (4 / alb) + _BmScene * (1.25 / alb)));
float rayPhase = 2.5 + pow(cosTheta,1);
float miePhase = _mieGScene.x / pow(_mieGScene.y - _mieGScene.z * cosTheta, 1);
float3 BrTheta = 0.059683 * _Br * rayPhase;
float3 BmTheta = 0.079577 * _BmScene * miePhase;
float3 BrmTheta = (BrTheta + BmTheta * 2.0) / ((_BmScene + _Br) * 0.75);
float3 scattering = BrmTheta * _SunParameters.x * (1.0 - fex);
float3 skyFinalize = saturate((pow( 1.0 - fex, 2.0) * 0.234) * (1 - sunPos.x)) * _SkyLuminance;
skyFinalize = saturate(lerp(float3(0.1,0.1,0.1), skyFinalize, saturate(dot(viewDir.y + 0.3, float3(0,1,0)))) * (1-fex));
scattering *= saturate((lerp(float3(_scatteringPower, _scatteringPower, _scatteringPower), pow(2000.0f * BrmTheta * fex, 0.7), sunPos.y) * 0.05));
scattering *= (_SkyLuminance * _scatteringColor.rgb * _scatteringStrenght) * pow((1.0 - fex), 1.0) * sunPos.x;
float4 fogScattering = float4((scattering + skyFinalize), 1);
//Tonemapping
if (_EnviroParams.w == 1)
{
fogScattering.rgb = tonemapACES(fogScattering.rgb, _FogExposure);
}
fogScattering = pow(fogScattering,_SkyColorPower);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherSkyMod, clamp(cosTheta, 0, 1)), _weatherSkyMod.a);
fogScattering = lerp(fogScattering, lerp(fogScattering, _weatherFogMod, _weatherFogMod.a), _weatherFogMod.a);
if(_lightning > 1)
fogScattering = fogScattering + (_lightning * 0.06);
return fogScattering;
}
float4 TransparentFog(float4 clr, float3 wPos,float2 uv, half depth)
{
float3 wsDir = wPos - _WorldSpaceCameraPos;
float g = _DistanceParams.x;
if (_EnviroParams.y > 0)
{
g += ComputeDistance (wsDir, depth);
g *= _distanceFogIntensity ;
}
if (_EnviroParams.z > 0)
{
//g += ComputeHalfSpaceWithNoise (wsDir);
g += ComputeHalfSpace(wsDir);
}
float fogFac = ComputeFogFactorEnviro(max(0.0,g));
fogFac = lerp(_maximumFogDensity,1.0f,fogFac);
float4 fogClr = float4(0, 0, 0, 0);
#ifdef UNITY_PASS_FORWARDADD
float4 volumeLighting = float4(0, 0, 0, 0);
#else
#if ENVIRO_SIMPLE_FOG
fogClr = unity_FogColor;
#else
float2 sunDir;
sunDir.x = saturate(_SunDir.y + 0.25);
sunDir.y = saturate(clamp(1.0 - _SunDir.y, 0.0, 0.5));
fogClr = ComputeScatteringScene(normalize(wsDir), sunDir);
#endif
#if UNITY_SINGLE_PASS_STEREO
float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
uv = (uv - scaleOffset.zw) / scaleOffset.xy;
#endif
float4 volumeLighting = tex2D(_EnviroVolumeLightingTex, uv) * _EnviroParams.x;
#endif
float4 final = lerp (lerp(fogClr, fogClr + volumeLighting, _EnviroVolumeDensity), lerp(clr, clr + volumeLighting, _EnviroVolumeDensity), fogFac);
return final;
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 221026906cc779e4b9ab486bbbd30032
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,46 +0,0 @@
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Enviro/Effects/ClearLightShafts" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Pass {
ZTest Always Cull Off ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
uniform float4 _MainTex_TexelSize;
struct v2f {
float4 pos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert( appdata_img v )
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v); //Insert
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
o.pos = UnityObjectToClipPos(v.vertex);
return o;
}
half4 frag (v2f i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
return half4(0,0,0,0);
}
ENDCG
}
}
Fallback off
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: ca46cc6d87e05cb4993352de483e4370
timeCreated: 1472350262
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,254 +0,0 @@
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Enviro/Effects/LightShafts" {
Properties{
_MainTex("Base", Any) = "" {}
_ColorBuffer("Color", Any) = "" {}
_Skybox("Skybox", Any) = "" {}
}
CGINCLUDE
#include "UnityCG.cginc"
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
#if UNITY_UV_STARTS_AT_TOP
float2 uv1 : TEXCOORD1;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
struct v2f_radial {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float2 blurVector : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_ColorBuffer);
UNITY_DECLARE_SCREENSPACE_TEXTURE(_Skybox);
//sampler2D_float _CameraDepthTexture;
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
uniform half4 _SunThreshold;
uniform half4 _SunColor;
uniform half4 _BlurRadius4;
uniform half4 _SunPosition;
uniform half4 _MainTex_TexelSize;
half4 _MainTex_ST;
half4 _ColorBuffer_ST;
half4 _Skybox_ST;
half4 _CameraDepthTexture_ST;
#define SAMPLES_FLOAT 6.0f
#define SAMPLES_INT 6
v2f vert(appdata_img v) {
v2f o;
UNITY_SETUP_INSTANCE_ID(v); //Insert
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.texcoord.xy;
#if UNITY_UV_STARTS_AT_TOP
o.uv1 = v.texcoord.xy;
if (_MainTex_TexelSize.y < 0)
o.uv1.y = 1 - o.uv1.y;
#endif
return o;
}
half4 fragScreen(v2f i) : SV_Target{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 colorA = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _MainTex_ST));
#if UNITY_UV_STARTS_AT_TOP
half4 colorB = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_ColorBuffer, UnityStereoScreenSpaceUVAdjust(i.uv1.xy, _ColorBuffer_ST));
#else
half4 colorB = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_ColorBuffer, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _ColorBuffer_ST));
#endif
half4 depthMask = saturate(colorB * _SunColor);
return 1.0f - (1.0f - colorA) * (1.0f - depthMask);
}
half4 fragAdd(v2f i) : SV_Target{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 colorA = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _MainTex_ST));
#if UNITY_UV_STARTS_AT_TOP
half4 colorB = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_ColorBuffer, UnityStereoScreenSpaceUVAdjust(i.uv1.xy, _ColorBuffer_ST));
#else
half4 colorB = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_ColorBuffer, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _ColorBuffer_ST));
#endif
half4 depthMask = saturate(colorB * _SunColor);
return colorA + depthMask;
}
v2f_radial vert_radial(appdata_img v) {
v2f_radial o;
UNITY_SETUP_INSTANCE_ID(v); //Insert
UNITY_INITIALIZE_OUTPUT(v2f_radial, o); //Insert
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
o.pos = UnityObjectToClipPos(v.vertex);
o.uv.xy = v.texcoord.xy;
o.blurVector = (_SunPosition.xy - v.texcoord.xy) * _BlurRadius4.xy;
return o;
}
half4 frag_radial(v2f_radial i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
half4 color = half4(0,0,0,0);
for (int j = 0; j < SAMPLES_INT; j++)
{
half4 tmpColor = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _MainTex_ST));
color += tmpColor;
i.uv.xy += i.blurVector;
}
return color / SAMPLES_FLOAT;
}
half TransformColor(half4 skyboxValue)
{
return dot(max(skyboxValue.rgb - _SunThreshold.rgb, half3(0, 0, 0)), half3(1, 1, 1)); //threshold and convert to greyscale
}
half4 frag_depth(v2f i) : SV_Target{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
#if UNITY_UV_STARTS_AT_TOP
float depthSample = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(i.uv1.xy, _CameraDepthTexture_ST));
#else
float depthSample = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _CameraDepthTexture_ST));
#endif
half4 tex = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _MainTex_ST));
depthSample = Linear01Depth(depthSample);
// consider maximum radius
#if UNITY_UV_STARTS_AT_TOP
half2 vec = _SunPosition.xy - UnityStereoScreenSpaceUVAdjust(i.uv.xy, _MainTex_ST);
#else
half2 vec = _SunPosition.xy - UnityStereoScreenSpaceUVAdjust(i.uv.xy, _MainTex_ST);
#endif
half dist = saturate(_SunPosition.w - length(vec.xy));
half4 outColor = 0;
// consider shafts blockers
if (depthSample > 0.99)
{
outColor = TransformColor(tex) * dist;
}
return outColor;
}
half4 frag_nodepth(v2f i) : SV_Target{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
#if UNITY_UV_STARTS_AT_TOP
float4 sky = (UNITY_SAMPLE_SCREENSPACE_TEXTURE(_Skybox, UnityStereoScreenSpaceUVAdjust(i.uv1.xy, _Skybox_ST)));
#else
float4 sky = (UNITY_SAMPLE_SCREENSPACE_TEXTURE(_Skybox, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _Skybox_ST)));
#endif
float4 tex = (UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv.xy, _MainTex_ST)));
// consider maximum radius
#if UNITY_UV_STARTS_AT_TOP
half2 vec = _SunPosition.xy - i.uv1.xy;
#else
half2 vec = _SunPosition.xy - i.uv.xy;
#endif
half dist = saturate(_SunPosition.w - length(vec));
half4 outColor = 0;
// find unoccluded sky pixels
// consider pixel values that differ significantly between framebuffer and sky-only buffer as occluded
if (Luminance(abs(sky.rgb - tex.rgb)) < 0.2)
{
outColor = TransformColor(sky) * dist;
}
return outColor;
}
ENDCG
Subshader {
Pass{
ZTest Always Cull Off ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment fragScreen
ENDCG
}
Pass{
ZTest Always Cull Off ZWrite Off
CGPROGRAM
#pragma vertex vert_radial
#pragma fragment frag_radial
ENDCG
}
Pass{
ZTest Always Cull Off ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag_depth
ENDCG
}
Pass{
ZTest Always Cull Off ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag_nodepth
ENDCG
}
Pass{
ZTest Always Cull Off ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment fragAdd
ENDCG
}
}
Fallback off
} // shader
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 2721eac037fc4544abddca473138e9f1
timeCreated: 1472350262
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,56 +0,0 @@
Shader "Hidden/Enviro/BakeCubemap"
{
Properties
{
_MainTex("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Pass
{
ZTest Always
Cull Off
ZWrite Off
Blend Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 pos : SV_POSITION;
};
v2f vert(appdata v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.uv.x = 1 - o.uv.x;
o.uv.y = 1 - o.uv.y;
return o;
}
float4 frag(v2f IN) : COLOR
{
return tex2D(_MainTex, IN.uv);
}
ENDCG
}
}
}
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 48f6b84faa79d414db8ed9f447b2f771
timeCreated: 1543550691
licenseType: Store
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,130 +0,0 @@
Shader "Enviro/Clouds Particles Advanced" {
Properties {
_CloudsColor("Color", Color) = (0.5,0.5,0.5,0.5)
_MainTex ("Particle Texture", 2D) = "white" {}
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Blend SrcAlpha OneMinusSrcAlpha
ColorMask RGB
Cull Off Lighting Off ZWrite Off
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#if ENVIRO_SIMPLE_FOG
#pragma target 2.0
#else
#pragma target 3.0
#endif
#pragma multi_compile_particles
#pragma multi_compile_fog
#pragma multi_compile __ ENVIRO_SIMPLE_FOG
#pragma multi_compile __ ENVIROVOLUMELIGHT
#include "UnityCG.cginc"
#if ENVIRO_SIMPLE_FOG
uniform float3 _SunDir;
uniform half4 _EnviroSkyFog;
#else
#include "Core/EnviroFogCore.cginc"
#endif
uniform sampler2D _MainTex;
uniform fixed4 _CloudsColor;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
float3 posWorld : TEXCOORD2;
float4 uv : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v); //Insert
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
o.vertex = UnityObjectToClipPos(v.vertex);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
o.uv = ComputeScreenPos(o.vertex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 TransparentParticleCloudsFog(fixed4 clr, float3 wPos, float2 uv)
{
float3 wsDir = wPos - _WorldSpaceCameraPos;
float f = saturate((_EnviroSkyFog.x * (dot(normalize(wPos - _WorldSpaceCameraPos.xyz), float3(0, 1, 0)))) +_EnviroSkyFog.z);
f = pow(f, _EnviroSkyFog.y);
half fogFacSky = (clamp(f, 0, 1));
fixed4 fogClr = fixed4(0, 0, 0, 0);
fixed4 final = fixed4(0, 0, 0, 0);
#if ENVIRO_SIMPLE_FOG
fogClr = unity_FogColor * 2;
final = lerp(fogClr, clr, fogFacSky);
#else
float2 sunDir;
sunDir.x = saturate(_SunDir.y + 0.25);
sunDir.y = saturate(clamp(1.0 - _SunDir.y, 0.0, 0.5));
fogClr = ComputeScattering(normalize(wsDir), sunDir);
#if ENVIROVOLUMELIGHT
#if UNITY_SINGLE_PASS_STEREO
float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
uv = (uv - scaleOffset.zw) / scaleOffset.xy;
#endif
float4 volumeLighting = tex2D(_EnviroVolumeLightingTex, UnityStereoTransformScreenSpaceTex(uv));
volumeLighting *= _EnviroParams.x;
final = lerp(lerp(fogClr, fogClr + volumeLighting, _EnviroVolumeDensity), lerp(clr, clr + volumeLighting, _EnviroVolumeDensity), fogFacSky);
#else
final = lerp(fogClr, clr, fogFacSky);
#endif
#endif
return final;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = 2.0f * i.color * tex2D(_MainTex, i.texcoord) * _CloudsColor;
UNITY_APPLY_FOG(i.fogCoord, col);
float3 wsDir = normalize(i.posWorld.xyz -_WorldSpaceCameraPos);
float4 fog = TransparentParticleCloudsFog(col, i.posWorld,i.uv.xy / i.uv.w);
//float alpha = clamp(col.a * clamp(wsDir.y*1.5, 0, 1),0,1);
//if(wsDir.y + _WorldSpaceCameraPos.y < _WorldSpaceCameraPos.y)
//alpha = col.a;
return float4(fog.rgb, clamp(col.a * clamp(wsDir.y*1.5, 0, 1),0,1));
}
ENDCG
}
}
}
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 33a3df5c42ad8b94399677a41417d650
timeCreated: 1528820905
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,55 +0,0 @@
Shader "Hidden/Enviro/ReflectionProbe"
{
Properties
{
_MainTex("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Pass
{
ZTest Always
Cull Off
ZWrite Off
Blend Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 pos : SV_POSITION;
};
v2f vert(appdata v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.uv.x = 1 - o.uv.x;
return o;
}
float4 frag(v2f IN) : COLOR
{
return tex2D(_MainTex, IN.uv);
}
ENDCG
}
}
}
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 41ac77e495e78d44789ff533b305c2fd
timeCreated: 1543550691
licenseType: Store
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,383 +0,0 @@
Shader "Enviro/Lite/SkyboxSimple"
{
Properties
{
_SkyColor ("Sky Color", Color) = (0, 0, 0, 0)
_HorizonColor ("Horizon Color", Color) = (0, 0, 0, 0)
_SunColor ("Sun Color", Color) = (0, 0, 0, 0)
_Stars ("StarsMap", Cube) = "black" {}
_MoonTex("Moon Tex", 2D) = "black" {}
_FlatCloudsBaseTexture("Base Map", 2D) = "black" {}
_FlatCloudsDetailTexture("Detail Map", 2D) = "black" {}
}
SubShader
{
Lod 300
Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" "IgnoreProjector"="True" }
Pass
{
Cull Back
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#pragma target 3.0
//#pragma multi_compile_fog
uniform half4 _SkyColor;
uniform half4 _HorizonColor;
uniform half4 _SunColor;
uniform samplerCUBE _Stars;
uniform float4x4 _StarsMatrix;
uniform half _StarsIntensity;
uniform half _SunDiskSizeSimple;
uniform float4 _weatherSkyMod;
uniform half _BlackGround;
uniform float3 _SunDir;
uniform sampler2D _MoonTex;
uniform float3 _MoonDir;
uniform float4 _MoonColor;
uniform float4 _moonParams;
struct VertexInput
{
float4 vertex : POSITION;
float3 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 position : POSITION;
float4 WorldPosition : TEXCOORD0;
float3 starPos : TEXCOORD1;
half3 vertex : TEXCOORD2;
float3 moonPos : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(VertexInput v) {
v2f o;
UNITY_SETUP_INSTANCE_ID(v); //Insert
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
float3 viewDir = normalize(v.texcoord + float3(0.0, 0.1, 0.0));
o.position = UnityObjectToClipPos(v.vertex);
o.WorldPosition = normalize(mul((float4x4)unity_ObjectToWorld, v.vertex)).xyzw;
o.starPos = mul((float3x3)_StarsMatrix,v.vertex.xyz);
o.vertex = -v.vertex;
float3 r = normalize(cross(_MoonDir.xyz, float3(0, -1, 0)));
float3 u = cross(_MoonDir.xyz, r);
o.moonPos.xy = float2(dot(r, v.vertex.xyz), dot(u, v.vertex.xyz)) * (21.0 - _moonParams.x) + 0.5;
o.moonPos.z = saturate(dot(-_MoonDir.xyz, viewDir));
return o;
}
float MoonPhaseFactor(float2 uv, float phase)
{
float alpha = 1.0;
float srefx = uv.x - 0.5;
float refx = abs(uv.x - 0.5);
if (phase > 0)
{
srefx = (1 - uv.x) - 0.5;
refx = abs((1 - uv.x) - 0.5);
}
phase = abs(_moonParams.w);
float refy = abs(uv.y - 0.5);
float refxfory = sqrt(0.25 - refy * refy);
float xmin = -refxfory;
float xmax = refxfory;
float xmin1 = (xmax - xmin) * (phase / 2) + xmin;
float xmin2 = (xmax - xmin) * phase + xmin;
if (srefx < xmin1)
{
alpha = 0;
}
else if (srefx < xmin2 && xmin1 != xmin2)
{
alpha = (srefx - xmin1) / (xmin2 - xmin1);
}
return alpha;
}
half getMiePhase(half eyeCos, half eyeCos2, half y)
{
half temp = 1.0 + 0.9801 - 2.0 * (-0.990) * eyeCos;
temp = pow(temp, pow(_SunDiskSizeSimple, 0.65) * 10);
temp = max(temp, 1.0e-4); // prevent division by zero, esp. in half precision
temp = 1.5 * ((1.0 - 0.9801) / (2.0 + 0.9801)) * (1.0 + eyeCos2) / temp;
//#if defined(UNITY_COLORSPACE_GAMMA) && SKYBOX_COLOR_IN_TARGET_COLOR_SPACE
// temp = pow(temp, .454545);
//#endif
return temp;
}
fixed4 frag(v2f i) : COLOR
{
half3 ray = normalize(mul((float3x3)unity_ObjectToWorld, i.vertex));
half y = ray.y / 0.02;
float4 skyColor = float4(0, 0, 0, 1);
if(_BlackGround == 1.0 && y > 5.0)
skyColor = float4(0, 0, 0, 1);
else
{
float3 viewDir = normalize(i.WorldPosition + float3(0,0.2,0));
float4 moonSampler = tex2D(_MoonTex, i.moonPos.xy);
float alpha = MoonPhaseFactor(i.moonPos.xy, _moonParams.w);
float3 moonArea = clamp(moonSampler * 10, 0, 1) * i.moonPos.z;
moonSampler = lerp(float4(0, 0, 0, 0), moonSampler, alpha);
moonSampler = (moonSampler * _MoonColor) * 2;
float starsBehindMoon = 1 - clamp((moonArea * 5), 0, 1);
float3 starsMap = texCUBE(_Stars, i.starPos.xyz);
float4 nightSky = float4(((_StarsIntensity * 50) * starsMap.rgb),1) * starsBehindMoon;
skyColor = lerp(_HorizonColor,_SkyColor,smoothstep(dot(viewDir.y, float3(0,2,0)),0,0.3));
if (y < 50.0 && y > 5.0)
skyColor = _HorizonColor;
skyColor = skyColor + (1 - skyColor.a) * nightSky;
half eyeCos = dot(_SunDir, ray);
half eyeCos2 = eyeCos * eyeCos;
half mie = getMiePhase(eyeCos, eyeCos2,y);
skyColor += mie * _SunColor;
skyColor.rgb += (moonSampler.rgb * i.moonPos.z);
skyColor = lerp(skyColor, (lerp(skyColor, _weatherSkyMod, _weatherSkyMod.a)), _weatherSkyMod.a);
}
return skyColor;
}
ENDCG
}
//Cirrus Clouds
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma target 2.0
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _CloudMap;
uniform float _CloudAlpha;
uniform float _CloudCoverage;
uniform float _CloudAltitude;
uniform float4 _CloudColor;
uniform float _CloudColorPower;
uniform float2 _CloudAnimation;
struct appdata {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 Position : SV_POSITION;
float4 uv : TEXCOORD0;
float3 worldPos : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v); //Insert
UNITY_INITIALIZE_OUTPUT(v2f, o); //Insert
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Ins
o.Position = UnityObjectToClipPos(v.vertex);
o.worldPos = normalize(v.vertex).xyz;
float3 viewDir = normalize(o.worldPos + float3(0,1,0));
o.worldPos.y *= 1 - dot(viewDir.y + _CloudAltitude, float3(0,-0.15,0));
return o;
}
float4 frag(v2f i) : SV_Target
{
float3 uvs = normalize(i.worldPos);
float4 uv1;
float4 uv2;
uv1.xy = (uvs.xz * 0.2) + _CloudAnimation;
uv2.xy = (uvs.xz * 0.4) + _CloudAnimation;
float4 clouds1 = tex2D(_CloudMap, uv1.xy);
float4 clouds2 = tex2D(_CloudMap, uv2.xy);
float color1 = pow(clouds1.g + clouds2.g, 0.1);
float color2 = pow(clouds2.b * clouds1.r, 0.2);
float4 finalClouds = lerp(clouds1, clouds2, color1 * color2);
float cloudExtinction = pow(uvs.y , 2);
finalClouds.a *= _CloudAlpha;
finalClouds.a *= cloudExtinction;
if (uvs.y < 0)
finalClouds.a = 0;
finalClouds.rgb = finalClouds.a * pow(_CloudColor,_CloudColorPower);
finalClouds.rgb = pow(finalClouds.rgb,1 - _CloudCoverage);
return finalClouds;
}
ENDCG
}
//Flat Clouds
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _FlatCloudsBaseTexture;
uniform sampler2D _FlatCloudsDetailTexture;
uniform float4 _FlatCloudsAnimation;
uniform float3 _FlatCloudsLightDirection;
uniform float3 _FlatCloudsLightColor;
uniform float3 _FlatCloudsAmbientColor;
uniform float4 _FlatCloudsLightingParams; // x = LightIntensity, y = AmbientIntensity, z = Absorbtion, w = HgPhase
uniform float4 _FlatCloudsParams; // x = Coverage, y = Density, z = Altitude, w = tonemapping
uniform float4 _FlatCloudsTiling; // x = Base, y = Detail
uniform float _CloudsExposure;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 Position : SV_POSITION;
float4 uv : TEXCOORD0;
float3 worldPos : TEXCOORD1;
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert(appdata_base v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.Position = UnityObjectToClipPos(v.vertex);
o.uv = normalize(v.vertex).xyzw;
float3 viewDir = normalize(o.uv + float3(0, 1, 0));
o.uv.y *= 1 - dot(viewDir.y + _FlatCloudsParams.z, float3(0, -0.2, 0));
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
return o;
}
float Remap(float org_val, float org_min, float org_max, float new_min, float new_max)
{
return new_min + saturate(((org_val - org_min) / (org_max - org_min))*(new_max - new_min));
}
float HenryGreenstein(float cosTheta, float g)
{
float k = 3.0 / (8.0 * 3.1415926f) * (1.0 - g * g) / (2.0 + g * g);
return k * (1.0 + cosTheta * cosTheta) / pow(abs(1.0 + g * g - 2.0 * g * cosTheta), 1.5);
}
half3 tonemapACES(half3 color, float Exposure)
{
color *= Exposure;
// See https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
const half a = 2.51;
const half b = 0.03;
const half c = 2.43;
const half d = 0.59;
const half e = 0.14;
return saturate((color * (a * color + b)) / (color * (c * color + d) + e));
}
float CalculateCloudDensity(float2 posBase, float2 posDetail, float coverage)
{
float4 baseNoise = tex2D(_FlatCloudsBaseTexture, posBase);
float low_freq_fBm = (baseNoise.g * 0.625) + (baseNoise.b * 0.25) + (baseNoise.a * 0.125);
float base_cloud = Remap(baseNoise.r, -(1.0 - low_freq_fBm), 1.0, 0.0, 1.0) * coverage;
float4 detailNoise = tex2D(_FlatCloudsDetailTexture, posDetail * 2);
float high_freq_fBm = (detailNoise.r * 0.625) + (detailNoise.g * 0.25) + (detailNoise.b * 0.125);
float density = Remap(base_cloud, 1.0 - high_freq_fBm * 0.5, 1.0, 0.0, 1.0);
density *= pow(high_freq_fBm, 0.4);
density *= _FlatCloudsParams.y;
return density;
}
half4 frag(v2f i) : SV_Target
{
half4 col = 0;
float3 uvs = normalize(i.uv);
float4 uv1;
uv1.xy = (uvs.xz * _FlatCloudsTiling.x) + _FlatCloudsAnimation.xy;
uv1.zw = (uvs.xz * _FlatCloudsTiling.y) + _FlatCloudsAnimation.zw;
float cloudExtinction = pow(uvs.y, 2);
half density = CalculateCloudDensity(uv1.xy, uv1.zw, _FlatCloudsParams.x);
//Lighting
fixed absorbtion = exp2(-1 * (density * _FlatCloudsLightingParams.z));
float3 viewDir = normalize(i.worldPos - _WorldSpaceCameraPos);
float inscatterAngle = dot(normalize(_FlatCloudsLightDirection), -viewDir);
fixed hg = HenryGreenstein(inscatterAngle, _FlatCloudsLightingParams.w) * 2 * absorbtion;
fixed lighting = density * (absorbtion + hg);
float3 lightColor = pow(_FlatCloudsLightColor, 2) * (_FlatCloudsLightingParams.x);
col.rgb = lightColor * lighting;
col.rgb = col.rgb + (_FlatCloudsAmbientColor * _FlatCloudsLightingParams.y);
//Tonemapping
if (_FlatCloudsParams.w == 1)
col.rgb = tonemapACES(col.rgb, _CloudsExposure);
col.a = saturate(density * cloudExtinction);
if (uvs.y < 0)
col.a = 0;
return col;
}
ENDCG
}
}
FallBack "None"
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 846f1e8b410d51444866f03712815c1e
timeCreated: 1503929340
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,56 +0,0 @@
Shader "Enviro/Particles/Lit Weather" {
Properties{
_TintColor("Tint Color", Color) = (1,1,1,1)
_MainTex("Particle Texture", 2D) = "white" {}
_Intensity("Intensity", Range(1,100)) = 10
}
SubShader{
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
LOD 200
CGPROGRAM
#pragma surface surf Standard alpha:fade finalcolor:ApplyFog
#pragma target 3.0
sampler2D _MainTex;
#include "../../Resources/Shaders/Core/EnviroFogCore.cginc"
struct Input {
float2 uv_MainTex;
fixed4 color : COLOR;
float4 screenPos;
float3 worldPos;
};
fixed4 _TintColor;
float _Intensity;
void ApplyFog(Input IN, SurfaceOutputStandard o, inout fixed4 color)
{
//Get ScreenPosition
float3 uvscreen = IN.screenPos.xyz / IN.screenPos.w;
// Calculate Linear Depth
half linear01Depth = Linear01Depth(uvscreen.z);
//get World Position
float3 wPos = IN.worldPos.xyz;
// Calculate Fog and apply volume lighting tex
float4 fogClr = TransparentFog(color, wPos, uvscreen.xy, linear01Depth);
#if _ALPHAPREMULTIPLY_ON
fogClr.rgb *= o.Alpha;
#endif
#ifndef UNITY_PASS_FORWARDADD
color.rgb = fogClr.rgb;
#endif
}
void surf(Input IN, inout SurfaceOutputStandard o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * (IN.color * _TintColor);
o.Albedo = c.rgb * _Intensity;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 12af3ffc6c4bf5242a04cc4d8dea12e1
timeCreated: 1541339377
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,90 +0,0 @@
Shader "Enviro/Particles/Additive" {
Properties {
_MainTex ("Particle Texture", 2D) = "white" {}
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Blend One OneMinusSrcColor
ColorMask RGB
Cull Off Lighting Off ZWrite Off
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma exclude_renderers gles
#pragma multi_compile_particles
#pragma multi_compile_fog
#include "UnityCG.cginc"
#include "../../Resources/Shaders/Core/EnviroFogCore.cginc"
sampler2D _MainTex;
fixed4 _TintColor;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 projPos : TEXCOORD2;
float3 posWorld : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
o.projPos = ComputeScreenPos (o.vertex);
COMPUTE_EYEDEPTH(o.projPos.z);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
float _InvFade;
fixed4 frag (v2f i) : SV_Target
{
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
#ifdef SOFTPARTICLES_ON
float partZ = i.projPos.z;
float fade = saturate (_InvFade * (sceneZ-partZ));
i.color.a *= fade;
#endif
half4 col = i.color * tex2D(_MainTex, i.texcoord);
col.rgb *= col.a;
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0,0,0,0)); // fog towards black due to our blend mode
//half linear01Depth = LinearEyeDepth(i.projPos.z);
float4 fog = TransparentFog(col,i.posWorld,i.projPos.xy,sceneZ);
fog.rgb *= col.rgb;
return fog;
}
ENDCG
}
}
}
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 83de0fc6fdb60ae4f879ec2a0d1e18fd
timeCreated: 1506252156
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,90 +0,0 @@
Shader "Enviro/Particles/Alpha Blended" {
Properties {
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
_MainTex ("Particle Texture", 2D) = "white" {}
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Blend SrcAlpha OneMinusSrcAlpha
ColorMask RGB
Cull Off Lighting Off ZWrite Off
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile_particles
#pragma multi_compile_fog
#pragma exclude_renderers gles
#include "UnityCG.cginc"
#include "../../Resources/Shaders/Core/EnviroFogCore.cginc"
sampler2D _MainTex;
fixed4 _TintColor;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 projPos : TEXCOORD2;
float3 posWorld : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
o.projPos = ComputeScreenPos (o.vertex);
COMPUTE_EYEDEPTH(o.projPos.z);
o.color = v.color * _TintColor;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
float _InvFade;
fixed4 frag (v2f i) : SV_Target
{
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
#ifdef SOFTPARTICLES_ON
float partZ = i.projPos.z;
float fade = saturate (_InvFade * (sceneZ-partZ));
i.color.a *= fade;
#endif
fixed4 col = 2.0f * i.color * tex2D(_MainTex, i.texcoord);
UNITY_APPLY_FOG(i.fogCoord, col);
float4 fog = TransparentFog(col,i.posWorld,i.projPos.xy,sceneZ);
return float4(fog.rgb,col.a);
}
ENDCG
}
}
}
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 4b46c5cd78fad2b4bb7e182ea4f565d4
timeCreated: 1506436501
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,95 +0,0 @@
Shader "Enviro/Particles/Lightning" {
Properties {
_MainTex ("Particle Texture", 2D) = "white" {}
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
_Intensity("Brightness", float) = 250
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Blend One OneMinusSrcColor
ColorMask RGB
Cull Off Lighting Off ZWrite Off
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile_particles
#pragma multi_compile_fog
#pragma exclude_renderers gles
#include "UnityCG.cginc"
#include "../../Resources/Shaders/Core/EnviroFogCore.cginc"
sampler2D _MainTex;
fixed4 _TintColor;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 projPos : TEXCOORD2;
float3 posWorld : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
o.projPos = ComputeScreenPos (o.vertex);
COMPUTE_EYEDEPTH(o.projPos.z);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
float _InvFade;
float _Intensity;
fixed4 frag (v2f i) : SV_Target
{
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
#ifdef SOFTPARTICLES_ON
float partZ = i.projPos.z;
float fade = saturate (_InvFade * (sceneZ-partZ));
i.color.a *= fade;
#endif
half4 col = i.color * tex2D(_MainTex, i.texcoord);
col.rgb *= _Intensity;
col.rgb *= col.a;
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0,0,0,0)); // fog towards black due to our blend mode
//half linear01Depth = LinearEyeDepth(i.projPos.z);
float4 fog = TransparentFog(col,i.posWorld, i.projPos.xy,sceneZ);
fog.rgb *= col.rgb;
return fog;
//return col;
}
ENDCG
}
}
}
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: db239a9a1eba8f3459e2cb60bd1ec552
timeCreated: 1506252156
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,94 +0,0 @@
Shader "Enviro/Particles/WeatherParticles" {
Properties {
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
_MainTex ("Particle Texture", 2D) = "white" {}
//_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
_lightIntensity ("Light Intensity", Range(0.0,1.0)) = 1.0
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
ColorMask RGBA
Cull Off Lighting Off ZWrite Off
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#pragma multi_compile_particles
#pragma multi_compile_fog
#pragma exclude_renderers gles
#include "UnityCG.cginc"
#include "../../Resources/Shaders/Core/EnviroFogCore.cginc"
sampler2D _MainTex;
fixed4 _TintColor;
float4 _EnviroLighting;
float _lightIntensity;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 projPos : TEXCOORD2;
float3 posWorld : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
o.projPos = ComputeScreenPos (o.vertex);
COMPUTE_EYEDEPTH(o.projPos.z);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
//float _InvFade;
fixed4 frag (v2f i) : SV_Target
{
float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
#ifdef SOFTPARTICLES_ON
float partZ = i.projPos.z;
float fade = saturate (0.5 * (sceneZ-partZ));
i.color.a *= fade;
#endif
fixed4 col = 2.0f * i.color * _TintColor * tex2D(_MainTex, i.texcoord);
col *= _EnviroLighting * _lightIntensity;
UNITY_APPLY_FOG(i.fogCoord, col);
float4 fog = TransparentFog(col,i.posWorld,i.projPos.xy,sceneZ);
return float4(fog.rgb,col.a);
}
ENDCG
}
}
}
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: acc6584263b225742a2e39740a470be8
timeCreated: 1472601408
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,97 +0,0 @@
Shader "Enviro/Particles/WeatherParticlesAdditive" {
Properties {
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
_MainTex ("Particle Texture", 2D) = "white" {}
_InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0
_lightIntensity ("Light Intensity", Range(0.0,1.0)) = 1.0
}
Category {
Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" }
Blend One OneMinusSrcColor
ColorMask RGB
Cull Off Lighting Off ZWrite Off
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#pragma multi_compile_particles
#pragma multi_compile_fog
#pragma exclude_renderers gles
#include "UnityCG.cginc"
#include "../../Resources/Shaders/Core/EnviroFogCore.cginc"
sampler2D _MainTex;
fixed4 _TintColor;
float4 _EnviroLighting;
float _lightIntensity;
float _InvFade;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 projPos : TEXCOORD2;
float3 posWorld : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
o.projPos = ComputeScreenPos (o.vertex);
COMPUTE_EYEDEPTH(o.projPos.z);
o.color = v.color;
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
//float _InvFade;
fixed4 frag (v2f i) : SV_Target
{
float sceneZ = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)));
#ifdef SOFTPARTICLES_ON
float partZ = i.projPos.z;
float fade = saturate(_InvFade * (sceneZ - partZ));
i.color.a *= fade;
#endif
half4 col = i.color * tex2D(_MainTex, i.texcoord);
col.rgb *= _EnviroLighting * 1.5;
col.rgb *= col.a;
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, fixed4(0, 0, 0, 0)); // fog towards black due to our blend mode
//half linear01Depth = LinearEyeDepth(i.projPos.z);
float4 fog = TransparentFog(col, i.posWorld, i.projPos.xy, sceneZ);
fog.rgb *= col.rgb;
return fog;
}
ENDCG
}
}
}
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 7887324a897cd4d4b89d3e52af0d1e46
timeCreated: 1472601408
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -1,66 +0,0 @@
Shader "Enviro/StandardAlphaBlended"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags {"Queue" = "Transparent" "RenderType"="Transparent" }
LOD 200
CGPROGRAM
#include "../../Resources/Shaders/Core/EnviroFogCore.cginc"
#pragma surface surf Standard fullforwardshadows alpha finalcolor:ApplyFog
#pragma target 3.0
sampler2D _MainTex;
sampler2D _CameraDepthTexture;
struct Input {
float2 uv_MainTex;
float4 screenPos;
float3 worldPos;
};
void ApplyFog(Input IN, SurfaceOutputStandard o, inout fixed4 color)
{
//Get ScreenPosition
float3 uvscreen = IN.screenPos.xyz/IN.screenPos.w;
// Calculate Linear Depth
half linear01Depth = Linear01Depth(uvscreen.z);
//get World Position
float3 wPos = IN.worldPos.xyz;
// Calculate Fog and apply volume lighting tex
float4 fogClr = TransparentFog(color,wPos, uvscreen.xy, linear01Depth);
#if _ALPHAPREMULTIPLY_ON
fogClr.rgb *= o.Alpha;
#endif
#ifndef UNITY_PASS_FORWARDADD
color.rgb = fogClr.rgb;
#endif
}
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Standard"
}
@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 58f17004d23396448827417fe395f149
timeCreated: 1506388388
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant: