更新
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#ifndef PARTICLESUNLITINPUT
|
||||
#define PARTICLESUNLITINPUT
|
||||
|
||||
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
|
||||
@@ -14,6 +12,7 @@
|
||||
float _IntersectRadius;
|
||||
half4 _IntersectColor;
|
||||
// #endif
|
||||
half _AdditiveToPreMultiplyAlphaLerp;
|
||||
half _Saturability;
|
||||
half _HueShift;
|
||||
half _Contrast;
|
||||
@@ -35,12 +34,25 @@
|
||||
half _fogintensity;
|
||||
half _Emi_Distortion_intensity;
|
||||
half _BaseMapUVRotation;
|
||||
half _BaseMapUVRotationSpeed;
|
||||
float _MaskMapUVRotation;
|
||||
float _NoiseMapUVRotation;
|
||||
half _uvRapSoft;
|
||||
half4 _EmissionMapColor;
|
||||
half _EmissionMapColorIntensity;
|
||||
|
||||
//--------------光照部分-------------
|
||||
float4 _BumpTex_ST;
|
||||
half _BumpScale;
|
||||
half4 _MaterialInfo;
|
||||
half4 _SpecularColor;
|
||||
//-----------SixWayLight----------
|
||||
half4 _SixWayInfo;
|
||||
half4 _SixWayEmissionColor;
|
||||
|
||||
half4 _MatCapColor;
|
||||
half4 _MatCapInfo;
|
||||
|
||||
half _EdgeFade;
|
||||
half4 _NoiseOffset;
|
||||
half4 _EmissionMapUVOffset;
|
||||
@@ -56,6 +68,21 @@
|
||||
half4 _MaskMapOffsetAnition;
|
||||
half4 _MaskMap3OffsetAnition;
|
||||
half4 _MaskMapVec;
|
||||
half4 _MaskRefineVec;
|
||||
|
||||
int _MaskMapGradientCount;
|
||||
half4 _MaskMapGradientFloat0;
|
||||
half4 _MaskMapGradientFloat1;
|
||||
half4 _MaskMapGradientFloat2;
|
||||
int _MaskMap2GradientCount;
|
||||
half4 _MaskMap2GradientFloat0;
|
||||
half4 _MaskMap2GradientFloat1;
|
||||
half4 _MaskMap2GradientFloat2;
|
||||
int _MaskMap3GradientCount;
|
||||
half4 _MaskMap3GradientFloat0;
|
||||
half4 _MaskMap3GradientFloat1;
|
||||
half4 _MaskMap3GradientFloat2;
|
||||
|
||||
float4 _PCCenter;
|
||||
float4 _TWParameter;
|
||||
float _TWStrength;
|
||||
@@ -109,8 +136,35 @@
|
||||
half4 _Dissolve_Vec2;
|
||||
|
||||
half4 _ColorBlendMap_ST;
|
||||
half2 _ColorBlendMapOffset;
|
||||
float4 _ColorBlendMapOffset;
|
||||
half4 _ColorBlendColor;
|
||||
half4 _ColorBlendVec;
|
||||
|
||||
half4 _RampColor0;
|
||||
half4 _RampColor1;
|
||||
half4 _RampColor2;
|
||||
half4 _RampColor3;
|
||||
half4 _RampColor4;
|
||||
half4 _RampColor5;
|
||||
half4 _RampColorAlpha0;
|
||||
half4 _RampColorAlpha1;
|
||||
half4 _RampColorAlpha2;
|
||||
uint _RampColorCount;
|
||||
half4 _RampColorBlendColor;
|
||||
float4 _RampColorMapOffset;
|
||||
half4 _RampColorMap_ST;
|
||||
|
||||
half4 _DissolveRampColor0;
|
||||
half4 _DissolveRampColor1;
|
||||
half4 _DissolveRampColor2;
|
||||
half4 _DissolveRampColor3;
|
||||
half4 _DissolveRampColor4;
|
||||
half4 _DissolveRampColor5;
|
||||
half4 _DissolveRampAlpha0;
|
||||
half4 _DissolveRampAlpha1;
|
||||
half4 _DissolveRampAlpha2;
|
||||
uint _DissolveRampCount;
|
||||
|
||||
|
||||
half3 _VertexOffset_Vec;
|
||||
half3 _VertexOffset_CustomDir;
|
||||
@@ -136,6 +190,8 @@
|
||||
|
||||
uint _UVModeFlag0;
|
||||
|
||||
uint _W9ParticleShaderColorChannelFlag;
|
||||
|
||||
CBUFFER_END
|
||||
|
||||
|
||||
@@ -173,6 +229,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SamplerState sampler_linear_repeat;
|
||||
SamplerState sampler_linear_clamp;
|
||||
SamplerState sampler_linear_RepeatU_ClampV;
|
||||
@@ -241,6 +298,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
half GetColorChannel(half4 color, int bitPos)
|
||||
{
|
||||
uint bits = _W9ParticleShaderColorChannelFlag >> bitPos;
|
||||
bits = bits & 3;
|
||||
if (bits == 0) return color.x;
|
||||
if (bits == 1) return color.y;
|
||||
if (bits == 2) return color.z;
|
||||
return color.w;
|
||||
}
|
||||
|
||||
|
||||
#include "../HLSL/EffectFlags.hlsl"
|
||||
@@ -264,11 +330,25 @@
|
||||
Texture2D _MaskMap;
|
||||
Texture2D _MaskMap2;
|
||||
Texture2D _MaskMap3;
|
||||
#ifdef _NORMALMAP
|
||||
Texture2D _BumpTex;
|
||||
#endif
|
||||
|
||||
#ifdef _FX_LIGHT_MODE_SIX_WAY
|
||||
Texture2D _RigRTBk;
|
||||
Texture2D _RigLBtF;
|
||||
Texture2D _SixWayEmissionRamp;
|
||||
#endif
|
||||
|
||||
#ifdef _SCREEN_DISTORT_MODE
|
||||
Texture2D _ScreenColorCopy1;
|
||||
#endif
|
||||
|
||||
#ifdef _MATCAP
|
||||
|
||||
#endif
|
||||
Texture2D _MatCapTex;
|
||||
|
||||
// Pre-multiplied alpha helper
|
||||
#if defined(_ALPHAPREMULTIPLY_ON) //if( blend: One OneMinusSrcAlpha)
|
||||
#define ALBEDO_MUL albedo
|
||||
@@ -292,6 +372,10 @@
|
||||
Texture2D _ColorBlendMap;
|
||||
#endif
|
||||
|
||||
#ifdef _COLOR_RAMP
|
||||
Texture2D _RampColorMap;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
half4 tex2D_TryLinearizeWithoutAlphaFX(sampler2D tex, float2 uv)
|
||||
@@ -568,6 +652,8 @@
|
||||
float2 colorBlendUV;
|
||||
float2 noiseMapUV;
|
||||
float2 noiseMaskMapUV;
|
||||
float2 bumpTexUV;
|
||||
float2 colorRampMapUV;
|
||||
};
|
||||
|
||||
BaseUVs ProcessBaseUVs(float4 meshTexcoord0, float2 specialUVInTexcoord3,float4 VaryingsP_Custom1,float4 VaryingsP_Custom2,float3 postionOS)
|
||||
@@ -657,6 +743,7 @@
|
||||
#ifdef _SCREEN_DISTORT_MODE
|
||||
particleUVs.mainTexUV = screenUV;
|
||||
#else
|
||||
_BaseMapUVRotation += time * _BaseMapUVRotationSpeed;
|
||||
baseMapUV = Rotate_Radians_float(baseMapUV, half2(0.5, 0.5), _BaseMapUVRotation); //主贴图旋转
|
||||
UNITY_BRANCH
|
||||
if(CheckLocalFlags(FLAG_BIT_PARTICLE_UIEFFECT_ON) & !CheckLocalFlags1(FLAG_BIT_PARTICLE_1_UIEFFECT_BASEMAP_MODE))
|
||||
@@ -680,6 +767,20 @@
|
||||
particleUVs.mainTexUV = UVOffsetAnimaiton(particleUVs.mainTexUV,_BaseMapMaskMapOffset.xy);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
if (CheckLocalFlags1(FLAG_BIT_PARTICLE_1_BUMP_TEX_UV_FOLLOW_MAINTEX))
|
||||
{
|
||||
particleUVs.bumpTexUV = particleUVs.mainTexUV;
|
||||
}
|
||||
else
|
||||
{
|
||||
float2 bumpTexUV = GetUVByUVMode(_UVModeFlag0,FLAG_BIT_UVMODE_POS_0_BUMPTEX,baseUVs);
|
||||
bumpTexUV = TRANSFORM_TEX(bumpTexUV, _BumpTex);
|
||||
particleUVs.bumpTexUV = bumpTexUV;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(_MASKMAP_ON)
|
||||
@@ -706,6 +807,7 @@
|
||||
if(CheckLocalFlags1(FLAG_BIT_PARTICLE_1_MASK_MAP2))
|
||||
{
|
||||
float2 maskMap2UV = GetUVByUVMode(_UVModeFlag0,FLAG_BIT_UVMODE_POS_0_MASKMAP_2,baseUVs);
|
||||
maskMap2UV = Rotate_Radians_float(maskMap2UV,half2(0.5,0.5),_MaskMapVec.y);
|
||||
maskMap2UV = maskMap2UV * _MaskMap2_ST.xy + _MaskMap2_ST.zw;
|
||||
|
||||
maskMap2UV = UVOffsetAnimaiton(maskMap2UV,_MaskMapOffsetAnition.zw);
|
||||
@@ -716,6 +818,8 @@
|
||||
if(CheckLocalFlags1(FLAG_BIT_PARTICLE_1_MASK_MAP3))
|
||||
{
|
||||
float2 maskMap3UV = GetUVByUVMode(_UVModeFlag0,FLAG_BIT_UVMODE_POS_0_MASKMAP_3,baseUVs);
|
||||
maskMap3UV = Rotate_Radians_float(maskMap3UV,half2(0.5,0.5),_MaskMapVec.z);
|
||||
|
||||
maskMap3UV = maskMap3UV* _MaskMap3_ST.xy + _MaskMap3_ST.zw;
|
||||
|
||||
maskMap3UV = UVOffsetAnimaiton(maskMap3UV,_MaskMap3OffsetAnition.xy);
|
||||
@@ -724,9 +828,17 @@
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_EMISSION)
|
||||
if (CheckLocalFlags(FLAG_BIT_PARTICLE_EMISSION_FOLLOW_MAINTEX_UV))
|
||||
{
|
||||
particleUVs.emissionUV = particleUVs.mainTexUV;
|
||||
}
|
||||
else
|
||||
{
|
||||
float2 emissionUV = GetUVByUVMode(_UVModeFlag0,FLAG_BIT_UVMODE_POS_0_EMISSION_MAP,baseUVs);
|
||||
particleUVs.emissionUV = ParticleUVCommonProcess(emissionUV,_EmissionMap_ST,_EmissionMapUVOffset.xy,_EmissionMapUVRotation);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_DISSOLVE)
|
||||
@@ -762,10 +874,21 @@
|
||||
#endif
|
||||
|
||||
#ifdef _COLORMAPBLEND
|
||||
if (CheckLocalFlags(FLAG_BIT_PARTICLE_COLOR_BLEND_FOLLOW_MAINTEX_UV))
|
||||
{
|
||||
particleUVs.colorBlendUV = particleUVs.mainTexUV;
|
||||
}
|
||||
else
|
||||
{
|
||||
float2 colorBlendUV = GetUVByUVMode(_UVModeFlag0,FLAG_BIT_UVMODE_POS_0_COLOR_BLEND_MAP,baseUVs);
|
||||
particleUVs.colorBlendUV = ParticleUVCommonProcess(colorBlendUV,_ColorBlendMap_ST,_ColorBlendMapOffset.xy);
|
||||
|
||||
particleUVs.colorBlendUV = ParticleUVCommonProcess(colorBlendUV,_ColorBlendMap_ST,_ColorBlendMapOffset.xy,_ColorBlendVec.w);
|
||||
}
|
||||
#endif
|
||||
#ifdef _COLOR_RAMP
|
||||
float2 colorRampMapUV = GetUVByUVMode(_UVModeFlag0,FLAG_BIT_UVMODE_POS_0_RAMP_COLOR_MAP,baseUVs);
|
||||
particleUVs.colorRampMapUV = ParticleUVCommonProcess(colorRampMapUV,_RampColorMap_ST,_RampColorMapOffset.xy,_RampColorMapOffset.w);
|
||||
#endif
|
||||
|
||||
half cum_noise = 0;
|
||||
|
||||
//TODO
|
||||
@@ -784,6 +907,9 @@
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Texture2D _VertexOffset_Map;
|
||||
@@ -985,4 +1111,236 @@
|
||||
|
||||
return finalTexCoords;
|
||||
}
|
||||
|
||||
//--------------MatCap------------------
|
||||
|
||||
//-
|
||||
|
||||
struct AttributesParticle//即URP语境下的appdata
|
||||
{
|
||||
float4 vertex: POSITION;
|
||||
float3 normalOS: NORMAL;
|
||||
half4 color: COLOR;
|
||||
#if defined(_FLIPBOOKBLENDING_ON)
|
||||
float4 texcoords: TEXCOORD0; //texcoords.zw就是粒子那边新建的UV2
|
||||
float3 texcoordBlend: TEXCOORD3;//注意,假如需要UI支持,則Canvas要開放相關Channel
|
||||
#else
|
||||
float4 texcoords: TEXCOORD0;
|
||||
#endif
|
||||
|
||||
#if defined(_PARALLAX_MAPPING) || defined(_NORMALMAP) || defined(_FX_LIGHT_MODE_SIX_WAY)
|
||||
float4 tangentOS : TANGENT;
|
||||
#endif
|
||||
|
||||
float4 Custom1: TEXCOORD1;
|
||||
float4 Custom2: TEXCOORD2;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VaryingsParticle//即URP语境下的v2f
|
||||
{
|
||||
float4 clipPos: SV_POSITION;
|
||||
|
||||
half4 color: COLOR;
|
||||
float4 texcoord: TEXCOORD0; // 主帖图 和 mask
|
||||
|
||||
#if defined (_EMISSION) || defined(_COLORMAPBLEND)
|
||||
float4 emissionColorBlendTexcoord: TEXCOORD1; // 流光
|
||||
#endif
|
||||
|
||||
#ifdef _NOISEMAP
|
||||
float4 noisemapTexcoord:TEXCOORD2;//Noise
|
||||
#endif
|
||||
|
||||
#if defined(_DISSOLVE)
|
||||
|
||||
float4 dissolveTexcoord:TEXCOORD15;
|
||||
float4 dissolveNoiseTexcoord: TEXCOORD5;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
float4 positionWS: TEXCOORD3;
|
||||
float4 positionOS: TEXCOORD12;
|
||||
|
||||
float4 texcoord2AndSpecialUV: TEXCOORD6; // UV2和SpecialUV
|
||||
|
||||
float4 positionNDC: TEXCOORD7;
|
||||
|
||||
|
||||
float4 VaryingsP_Custom1: TEXCOORD8;
|
||||
float4 VaryingsP_Custom2: TEXCOORD9;
|
||||
|
||||
|
||||
float4 normalWSAndAnimBlend: TEXCOORD10;
|
||||
|
||||
float3 fresnelViewDir :TEXCOORD11;
|
||||
|
||||
float3 viewDirWS :TEXCOORD13;
|
||||
float4 texcoordMaskMap2 : TEXCOORD14;
|
||||
|
||||
#ifdef _PARALLAX_MAPPING
|
||||
half3 tangentViewDir : TEXCOORD16;
|
||||
#endif
|
||||
|
||||
#ifndef _FX_LIGHT_MODE_UNLIT
|
||||
half3 vertexSH :TEXCOORD17;
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half3 vertexLight :TEXCOORD18;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_NORMALMAP) || defined(_FX_LIGHT_MODE_SIX_WAY)
|
||||
half4 tangentWS : TEXCOOR19;
|
||||
#endif
|
||||
#if defined (_NORMALMAP) || defined(_COLOR_RAMP)
|
||||
float4 bumpTexAndColorRampMapTexcoord : TEXCOOR20;
|
||||
#endif
|
||||
|
||||
#ifdef _FX_LIGHT_MODE_SIX_WAY
|
||||
half3 bakeDiffuseLighting0 :TEXCOOR21;
|
||||
half3 bakeDiffuseLighting1 :TEXCOOR22;
|
||||
half3 bakeDiffuseLighting2 :TEXCOOR23;
|
||||
half3 backBakeDiffuseLighting0 :TEXCOOR24;
|
||||
half3 backBakeDiffuseLighting1 :TEXCOOR25;
|
||||
half3 backBakeDiffuseLighting2 :TEXCOOR26;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
bool isProcessUVInFrag()
|
||||
{
|
||||
if(CheckLocalFlags(FLAG_BIT_PARTICLE_POLARCOORDINATES_ON) || CheckLocalFlags(FLAG_BIT_PARTICLE_UTWIRL_ON))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#if defined(_DEPTH_DECAL) || defined(_PARALLAX_MAPPING) || defined(_SCREEN_DISTORT_MODE)
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef _FX_LIGHT_MODE_UNLIT
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
|
||||
|
||||
void InitializeInputData(VaryingsParticle input, half3 normalTS, out InputData inputData)
|
||||
{
|
||||
inputData = (InputData)0;
|
||||
|
||||
#if defined(REQUIRES_WORLD_SPACE_POS_INTERPOLATOR)
|
||||
inputData.positionWS = input.positionWS;
|
||||
#endif
|
||||
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(input.positionWS);
|
||||
#if defined(_NORMALMAP) || defined(_DETAIL)
|
||||
float sgn = input.tangentWS.w; // should be either +1 or -1
|
||||
float3 bitangent = sgn * cross(input.normalWSAndAnimBlend.xyz, input.tangentWS.xyz);
|
||||
half3x3 tangentToWorld = half3x3(input.tangentWS.xyz, bitangent.xyz, input.normalWSAndAnimBlend.xyz);
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
inputData.tangentToWorld = tangentToWorld;
|
||||
#endif
|
||||
inputData.normalWS = TransformTangentToWorld(normalTS, tangentToWorld);
|
||||
#else
|
||||
inputData.normalWS = input.normalWSAndAnimBlend.xyz;
|
||||
#endif
|
||||
|
||||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS);
|
||||
inputData.viewDirectionWS = viewDirWS;
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
inputData.shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
inputData.shadowCoord = TransformWorldToShadowCoord(inputData.positionWS);
|
||||
#else
|
||||
inputData.shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS, 1.0), input.fogFactorAndVertexLight.x);
|
||||
inputData.vertexLighting = input.fogFactorAndVertexLight.yzw;
|
||||
#else
|
||||
inputData.fogCoord = InitializeInputDataFog(float4(input.positionWS.xyz, 1.0), input.positionWS.w);
|
||||
#endif
|
||||
|
||||
// #if defined(DYNAMICLIGHTMAP_ON)
|
||||
// inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.dynamicLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
// #else
|
||||
// inputData.bakedGI = SAMPLE_GI(input.staticLightmapUV, input.vertexSH, inputData.normalWS);
|
||||
// #endif
|
||||
|
||||
inputData.bakedGI = SampleSHPixel(input.vertexSH, inputData.normalWS);
|
||||
|
||||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.clipPos);
|
||||
inputData.shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
|
||||
|
||||
#if defined(DEBUG_DISPLAY)
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
inputData.dynamicLightmapUV = input.dynamicLightmapUV;
|
||||
#endif
|
||||
#if defined(LIGHTMAP_ON)
|
||||
inputData.staticLightmapUV = input.staticLightmapUV;
|
||||
#else
|
||||
inputData.vertexSH = input.vertexSH;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int2 GetGradientIndex(half timeArr[6], int arrCount, half gradientTime)
|
||||
{
|
||||
|
||||
// 边界情况处理
|
||||
if (gradientTime < timeArr[0]) {
|
||||
return int2(-1, 0); // 小于最小值
|
||||
}
|
||||
if (gradientTime >= timeArr[arrCount - 1]) {
|
||||
return int2(arrCount - 1, arrCount); // 大于等于最大值
|
||||
}
|
||||
|
||||
// 顺序查找第一个大于X的元素索引
|
||||
[unroll]
|
||||
for (int i = 0; i < arrCount; i++) {
|
||||
if (timeArr[i] > gradientTime) {
|
||||
return int2(i - 1, i); // 返回区间索引
|
||||
}
|
||||
}
|
||||
return int2(-1, 0); // 理论上不会执行此处
|
||||
}
|
||||
half GetGradientIndexInterval(half timeArr[6],int arrCount,int2 indexes,half gradientTime)
|
||||
{
|
||||
//超出范围的直接在外面就判断好。
|
||||
// half smallVal = indexes.x < 0 ? 0:timeArr[indexes.x];
|
||||
half smallVal = timeArr[indexes.x];
|
||||
// half bigVal = indexes.y >= arrCount ? 1 : timeArr[indexes.y];
|
||||
half bigVal = timeArr[indexes.y];
|
||||
return (gradientTime - smallVal) / (bigVal - smallVal);
|
||||
}
|
||||
|
||||
half3 GetGradientColorValue(half3 colorArr[6],half timeArr[6], int arrCount,half gradientTime)
|
||||
{
|
||||
int2 indexes = GetGradientIndex(timeArr, arrCount, gradientTime);
|
||||
if (indexes.x < 0) return colorArr[0];
|
||||
if (indexes.y >= arrCount ) return colorArr[arrCount - 1];
|
||||
half interval = GetGradientIndexInterval(timeArr, arrCount, indexes, gradientTime);
|
||||
interval = SmoothStep01(interval);
|
||||
return lerp(colorArr[indexes.x], colorArr[indexes.y], interval);
|
||||
}
|
||||
|
||||
half GetGradientAlphaValue(half alphaArr[6],half timeArr[6], int arrCount,half gradientTime)
|
||||
{
|
||||
int2 indexes = GetGradientIndex(timeArr, arrCount, gradientTime);
|
||||
if (indexes.x < 0) return alphaArr[0];
|
||||
if (indexes.y >= arrCount ) return alphaArr[arrCount - 1];
|
||||
half interval = GetGradientIndexInterval(timeArr, arrCount, indexes, gradientTime);
|
||||
interval = SmoothStep01(interval);//TODO:消耗很大,如何避免?
|
||||
half alpha = lerp(alphaArr[indexes.x], alphaArr[indexes.y], interval);
|
||||
alpha *= alpha;//Make Alpha Smoother
|
||||
return alpha ;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user