diff --git a/Assets/Nova/Runtime/Core/Shaders/ParticlesUber.hlsl b/Assets/Nova/Runtime/Core/Shaders/ParticlesUber.hlsl index 793d773..e1e3ffd 100644 --- a/Assets/Nova/Runtime/Core/Shaders/ParticlesUber.hlsl +++ b/Assets/Nova/Runtime/Core/Shaders/ParticlesUber.hlsl @@ -507,10 +507,10 @@ half GetTransitionAlphaImpl(half4 map, uint channel, half transitionProgress, fl } #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) -half GetTransitionAlpha(half2 transitionMapUv, half transitionMapProgress, half transitionProgress, half2 transitionMapSecondUv, half transitionProgressSecond) +half GetTransitionAlpha(half2 transitionMapUv, half transitionMapProgress, half transitionProgress, half2 transitionMapSecondUv, half transitionMapProgressSecond, half transitionProgressSecond) { half4 mainTexMap = SAMPLE_ALPHA_TRANSITION_MAP(transitionMapUv, transitionMapProgress); - half4 secondTexMap = SAMPLE_ALPHA_TRANSITION_MAP_SECOND(transitionMapSecondUv, transitionMapProgress); + half4 secondTexMap = SAMPLE_ALPHA_TRANSITION_MAP_SECOND(transitionMapSecondUv, transitionMapProgressSecond); half mainTexAlpha = GetTransitionAlphaImpl(mainTexMap, (uint)_AlphaTransitionMapChannelsX, transitionProgress, _DissolveSharpness); half secondTexAlpha = GetTransitionAlphaImpl(secondTexMap, (uint)_AlphaTransitionMapSecondTextureChannelsX, transitionProgressSecond, _DissolveSharpnessSecondTexture); diff --git a/Assets/Nova/Runtime/Core/Shaders/ParticlesUberDepthNormalsCore.hlsl b/Assets/Nova/Runtime/Core/Shaders/ParticlesUberDepthNormalsCore.hlsl index 7ab437e..fb02006 100644 --- a/Assets/Nova/Runtime/Core/Shaders/ParticlesUberDepthNormalsCore.hlsl +++ b/Assets/Nova/Runtime/Core/Shaders/ParticlesUberDepthNormalsCore.hlsl @@ -107,6 +107,7 @@ struct VaryingsDrawDepth #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) float4 flowTransitionSecondUVs : TEXCOORD8; // xy: FlowMap UV, zw: TransitionMap UV + float2 transitionEmissionProgressesSecond : TEXCOORD9; // x: TransitionMap Progress, y: EmissionMap Progress #endif UNITY_VERTEX_INPUT_INSTANCE_ID @@ -232,20 +233,24 @@ VaryingsDrawDepth vert(AttributesDrawDepth input) #endif // Transition Map Progress - #if defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) || defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) - #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) - float transitionMapProgress = _AlphaTransitionMapSecondTextureProgress + GET_CUSTOM_COORD(_AlphaTransitionMapSecondTextureProgressCoord); - float sliceCount = _AlphaTransitionMapSecondTextureSliceCount; - #else + #if defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) || defined(_ALPHA_TRANSITION_MAP_MODE_3D) float transitionMapProgress = _AlphaTransitionMapProgress + GET_CUSTOM_COORD(_AlphaTransitionMapProgressCoord); float sliceCount = _AlphaTransitionMapSliceCount; - #endif - #ifdef _ALPHA_TRANSITION_MAP_MODE_2D_ARRAY output.transitionEmissionProgresses.x = FlipBookProgress(transitionMapProgress, sliceCount); #elif _ALPHA_TRANSITION_MAP_MODE_3D output.transitionEmissionProgresses.x = FlipBookBlendingProgress(transitionMapProgress, sliceCount); #endif + + #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) + float transitionMapProgressSecond = _AlphaTransitionMapSecondTextureProgress + GET_CUSTOM_COORD(_AlphaTransitionMapSecondTextureProgressCoord); + float sliceCountSecond = _AlphaTransitionMapSecondTextureSliceCount; + #ifdef _ALPHA_TRANSITION_MAP_MODE_2D_ARRAY + output.transitionEmissionProgressesSecond.x = FlipBookProgress(transitionMapProgressSecond, sliceCountSecond); + #elif _ALPHA_TRANSITION_MAP_MODE_3D + output.transitionEmissionProgressesSecond.x = FlipBookBlendingProgress(transitionMapProgressSecond, sliceCountSecond); + #endif + #endif #endif // Emission Map UV @@ -337,7 +342,7 @@ half4 frag(VaryingsDrawDepth input) : SV_Target #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) half alphaTransitionProgressSecondTexture = _AlphaTransitionProgressSecondTexture + GET_CUSTOM_COORD(_AlphaTransitionProgressCoordSecondTexture); ModulateAlphaTransitionProgress(alphaTransitionProgressSecondTexture, input.color.a); - color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionEmissionProgresses.x, alphaTransitionProgress, input.flowTransitionSecondUVs.zw, alphaTransitionProgressSecondTexture); + color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionEmissionProgresses.x, alphaTransitionProgress, input.flowTransitionSecondUVs.zw, input.transitionEmissionProgressesSecond.x, alphaTransitionProgressSecondTexture); #else color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionEmissionProgresses.x, alphaTransitionProgress); #endif diff --git a/Assets/Nova/Runtime/Core/Shaders/ParticlesUberShadowCaster.hlsl b/Assets/Nova/Runtime/Core/Shaders/ParticlesUberShadowCaster.hlsl index 0109334..8e77a9b 100644 --- a/Assets/Nova/Runtime/Core/Shaders/ParticlesUberShadowCaster.hlsl +++ b/Assets/Nova/Runtime/Core/Shaders/ParticlesUberShadowCaster.hlsl @@ -39,6 +39,7 @@ struct Varyings float transitionProgress : TEXCOORD5; #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) float4 flowTransitionSecondUVs : TEXCOORD6; // xy: FlowMap UV, zw: TransitionMap UV + float transitionProgressSecond : TEXCOORD7; #endif UNITY_VERTEX_INPUT_INSTANCE_ID }; @@ -149,23 +150,26 @@ Varyings ShadowPassVertex(Attributes input) #endif // Transition Map Progress - #if defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) || defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) - #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) - float transitionMapProgress = _AlphaTransitionMapSecondTextureProgress + GET_CUSTOM_COORD(_AlphaTransitionMapSecondTextureProgressCoord); - float sliceCount = _AlphaTransitionMapSecondTextureSliceCount; - #else + #if defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) || defined(_ALPHA_TRANSITION_MAP_MODE_3D) float transitionMapProgress = _AlphaTransitionMapProgress + GET_CUSTOM_COORD(_AlphaTransitionMapProgressCoord); float sliceCount = _AlphaTransitionMapSliceCount; - #endif - #ifdef _ALPHA_TRANSITION_MAP_MODE_2D_ARRAY output.transitionProgress = FlipBookProgress(transitionMapProgress, sliceCount); #elif _ALPHA_TRANSITION_MAP_MODE_3D output.transitionProgress = FlipBookBlendingProgress(transitionMapProgress, sliceCount); #endif + + #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) + float transitionMapProgressSecond = _AlphaTransitionMapSecondTextureProgress + GET_CUSTOM_COORD(_AlphaTransitionMapSecondTextureProgressCoord); + float sliceCountSecond = _AlphaTransitionMapSecondTextureSliceCount; + #ifdef _ALPHA_TRANSITION_MAP_MODE_2D_ARRAY + output.transitionProgressSecond = FlipBookProgress(transitionMapProgressSecond, sliceCountSecond); + #elif _ALPHA_TRANSITION_MAP_MODE_3D + output.transitionProgressSecond = FlipBookBlendingProgress(transitionMapProgressSecond, sliceCountSecond); + #endif + #endif #endif #endif - return output; } @@ -226,7 +230,7 @@ half4 ShadowPassFragment(Varyings input) : SV_TARGET #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) half alphaTransitionProgressSecondTexture = _AlphaTransitionProgressSecondTexture + GET_CUSTOM_COORD(_AlphaTransitionProgressCoordSecondTexture); ModulateAlphaTransitionProgress(alphaTransitionProgressSecondTexture, input.color.a); - color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionProgress, alphaTransitionProgress, input.flowTransitionSecondUVs.xy, alphaTransitionProgressSecondTexture); + color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionProgress, alphaTransitionProgress, input.flowTransitionSecondUVs.zw, input.transitionProgressSecond, alphaTransitionProgressSecondTexture); #else color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionProgress, alphaTransitionProgress); #endif diff --git a/Assets/Nova/Runtime/Core/Shaders/ParticlesUberUnlit.hlsl b/Assets/Nova/Runtime/Core/Shaders/ParticlesUberUnlit.hlsl index 822a621..fce33c5 100644 --- a/Assets/Nova/Runtime/Core/Shaders/ParticlesUberUnlit.hlsl +++ b/Assets/Nova/Runtime/Core/Shaders/ParticlesUberUnlit.hlsl @@ -48,6 +48,7 @@ struct Varyings #endif #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) float4 flowTransitionSecondUVs : TEXCOORD11; // xy: FlowMap UV, zw: TransitionMap UV + float2 transitionEmissionProgressesSecond : TEXCOORD12; // x: TransitionMap Progress, y: EmissionMap Progress #endif UNITY_VERTEX_INPUT_INSTANCE_ID }; @@ -177,20 +178,24 @@ Varyings vertUnlit(Attributes input, out float3 positionWS, uniform bool useEmis #endif // Transition Map Progress - #if defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) || defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) - #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) - float transitionMapProgress = _AlphaTransitionMapSecondTextureProgress + GET_CUSTOM_COORD(_AlphaTransitionMapSecondTextureProgressCoord); - float sliceCount = _AlphaTransitionMapSecondTextureSliceCount; - #else + #if defined(_ALPHA_TRANSITION_MAP_MODE_2D_ARRAY) || defined(_ALPHA_TRANSITION_MAP_MODE_3D) float transitionMapProgress = _AlphaTransitionMapProgress + GET_CUSTOM_COORD(_AlphaTransitionMapProgressCoord); float sliceCount = _AlphaTransitionMapSliceCount; - #endif - #ifdef _ALPHA_TRANSITION_MAP_MODE_2D_ARRAY output.transitionEmissionProgresses.x = FlipBookProgress(transitionMapProgress, sliceCount); #elif _ALPHA_TRANSITION_MAP_MODE_3D output.transitionEmissionProgresses.x = FlipBookBlendingProgress(transitionMapProgress, sliceCount); #endif + + #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) + float transitionMapProgressSecond = _AlphaTransitionMapSecondTextureProgress + GET_CUSTOM_COORD(_AlphaTransitionMapSecondTextureProgressCoord); + float sliceCountSecond = _AlphaTransitionMapSecondTextureSliceCount; + #ifdef _ALPHA_TRANSITION_MAP_MODE_2D_ARRAY + output.transitionEmissionProgressesSecond.x = FlipBookProgress(transitionMapProgressSecond, sliceCountSecond); + #elif _ALPHA_TRANSITION_MAP_MODE_3D + output.transitionEmissionProgressesSecond.x = FlipBookBlendingProgress(transitionMapProgressSecond, sliceCountSecond); + #endif + #endif #endif if (useEmission) @@ -303,7 +308,7 @@ half4 fragUnlit(in out Varyings input, uniform bool useEmission) #if defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE) || defined(_ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY) half alphaTransitionProgressSecondTexture = _AlphaTransitionProgressSecondTexture + GET_CUSTOM_COORD(_AlphaTransitionProgressCoordSecondTexture); ModulateAlphaTransitionProgress(alphaTransitionProgressSecondTexture, input.color.a); - color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionEmissionProgresses.x, alphaTransitionProgress, input.flowTransitionSecondUVs.zw, alphaTransitionProgressSecondTexture); + color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionEmissionProgresses.x, alphaTransitionProgress, input.flowTransitionSecondUVs.zw, input.transitionEmissionProgressesSecond.x, alphaTransitionProgressSecondTexture); #else color.a *= GetTransitionAlpha(input.flowTransitionUVs.zw, input.transitionEmissionProgresses.x, alphaTransitionProgress); #endif