Skip to content

Commit c489dc8

Browse files
Tatamiclaude
andcommitted
Fix critical FlipBook feature integration issues
Fixed multiple integration issues that would have prevented FlipBook functionality from working correctly: • Fixed Flow Map processing: Added missing _TINT_MAP_MODE_2D_ARRAY condition to ensure Flow Map effects apply to FlipBook textures • Fixed Parallax Map processing: Added missing _TINT_MAP_MODE_2D_ARRAY condition to ensure Parallax Map effects apply to FlipBook textures • Optimized tintEmissionUV definition: Added proper conditional compilation in DepthNormals to avoid unnecessary TEXCOORD usage • Optimized progress calculations: Consolidated redundant variable assignments into single-line operations • Updated TintMapProgress method calls: Replaced deprecated TintMapProgress with FlipBookBlendingProgress for consistency • Fixed display names: Corrected "Base Map Slice Count" to "Tint Map Slice Count" in UIParticlesUberLit.shader • Enhanced DepthNormals UV access: Added TintColor keywords to _USE_BASE_MAP_UV to prevent compilation errors These fixes ensure FlipBook feature works correctly with Flow Map, Parallax Map, and all shader passes while maintaining optimal performance. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ab8f20f commit c489dc8

6 files changed

Lines changed: 27 additions & 27 deletions

File tree

Assets/Nova/Runtime/Core/Shaders/ParticlesUber.hlsl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,6 @@ SamplerState GetEmissionMapSamplerState()
446446
#define SAMPLE_SPECULAR_MAP(uv, progress) SAMPLE_TEXTURE3D_LOD(_SpecularMap3D, GetSpecularMapSamplerState(), float3(uv, progress), 0);
447447
#endif
448448

449-
// Returns the progress of the 2DArray/3d tint map.
450-
half TintMapProgress(in half progress)
451-
{
452-
half offset = 1.0 / _TintMapSliceCount * 0.5;
453-
progress += offset;
454-
return progress;
455-
}
456449

457450
// Sample the tint map.
458451
#ifdef _TINT_MAP_ENABLED

Assets/Nova/Runtime/Core/Shaders/ParticlesUberDepthNormalsCore.hlsl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77

88
// If defined _ALPHATEST_ENABLED or _NORMAL_MAP_ENABLED, base map uv is enabled.
9-
#if defined( _ALPHATEST_ENABLED ) || defined(_NORMAL_MAP_ENABLED)
9+
// Also enabled if TintColor FlipBook or 3D features are used.
10+
#if defined( _ALPHATEST_ENABLED ) || defined(_NORMAL_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED)
1011
#define _USE_BASE_MAP_UV
1112
#endif
1213

@@ -93,7 +94,9 @@ struct VaryingsDrawDepth
9394

9495
#ifdef _ALPHATEST_ENABLED // This attributes is not used for opaque objects.
9596
float4 color : COLOR;
97+
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED) || defined(_EMISSION_AREA_MAP)
9698
float4 tintEmissionUV : TEXCOORD4; // xy: TintMap UV, zw: EmissionMap UV
99+
#endif
97100
float3 transitionEmissionProgresses : TEXCOORD5;
98101
// x: TransitionMap Progress, y: EmissionMap Progress, z: Fog Factor
99102
#ifdef FRAGMENT_USE_VIEW_DIR_WS
@@ -232,16 +235,17 @@ VaryingsDrawDepth vert(AttributesDrawDepth input)
232235
#endif
233236

234237
// Tint Map UV
235-
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_3D_ENABLED)
238+
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED)
236239
output.tintEmissionUV.xy = TRANSFORM_TINT_MAP(input.texcoord.xy);
237240
output.tintEmissionUV.x += GET_CUSTOM_COORD(_TintMapOffsetXCoord);
238241
output.tintEmissionUV.y += GET_CUSTOM_COORD(_TintMapOffsetYCoord);
239242
#endif
240243

241244
// Tint Map Progress
242-
#ifdef _TINT_MAP_3D_ENABLED
243-
output.baseMapUVAndProgresses.w = _TintMap3DProgress + GET_CUSTOM_COORD(_TintMap3DProgressCoord);
244-
output.baseMapUVAndProgresses.w = TintMapProgress(output.baseMapUVAndProgresses.w);
245+
#ifdef _TINT_MAP_MODE_2D_ARRAY
246+
output.baseMapUVAndProgresses.w = FlipBookProgress(_TintMapProgress + GET_CUSTOM_COORD(_TintMapProgressCoord), _TintMapSliceCount);
247+
#elif _TINT_MAP_3D_ENABLED
248+
output.baseMapUVAndProgresses.w = FlipBookBlendingProgress(_TintMap3DProgress + GET_CUSTOM_COORD(_TintMap3DProgressCoord), _TintMapSliceCount);
245249
#endif
246250

247251
// Transition Map Progress
@@ -344,7 +348,11 @@ half4 frag(VaryingsDrawDepth input) : SV_Target
344348
rim = GetRimValue(rim, tintRimProgress, tintRimSharpness, _InverseTintRim);
345349
tintBlendRate *= _TintBlendRate * rim;
346350
#endif
351+
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED)
347352
ApplyTintColor(color, input.tintEmissionUV.xy, input.baseMapUVAndProgresses.w, tintBlendRate);
353+
#else
354+
ApplyTintColor(color, half2( 0, 0 ), input.baseMapUVAndProgresses.w, tintBlendRate);
355+
#endif
348356
#endif
349357

350358
// Alpha Transition

Assets/Nova/Runtime/Core/Shaders/ParticlesUberLit.shader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Shader "Nova/Particles/UberLit"
7171
_TintMap3DProgressCoord("Tint Map 3D Progress Coord", Float) = 0.0
7272
_TintMapProgress("Tint Map Progress", Range(0, 1)) = 0.0
7373
_TintMapProgressCoord("Tint Map Progress Coord", Float) = 0.0
74-
_TintMapSliceCount("Base Map Slice Count", Float) = 4.0
74+
_TintMapSliceCount("Tint Map Slice Count", Float) = 4.0
7575
_TintMapOffsetXCoord("Tint Map Offset X Coord", Float) = 0.0
7676
_TintMapOffsetYCoord("Tint Map Offset Y Coord", Float) = 0.0
7777
_TintBlendRate("Tint Blend Rate", Range(0.0, 1.0)) = 1.0

Assets/Nova/Runtime/Core/Shaders/ParticlesUberShadowCaster.hlsl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct Varyings
3333
#if defined(_FLOW_MAP_ENABLED) || defined(_FLOW_MAP_TARGET_BASE) || defined(_FLOW_MAP_TARGET_TINT) || defined(_FLOW_MAP_TARGET_EMISSION) || defined(_FLOW_MAP_TARGET_ALPHA_TRANSITION) || defined(_FADE_TRANSITION_ENABLED) || defined(_DISSOLVE_TRANSITION_ENABLED)
3434
float4 flowTransitionUVs : TEXCOORD3; // xy: FlowMap UV, zw: TransitionMap UV
3535
#endif
36-
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_3D_ENABLED)
36+
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED)
3737
float2 tintUV : TEXCOORD4; // xy: TintMap UV, zw: EmissionMap UV
3838
#endif
3939
float transitionProgress : TEXCOORD5;
@@ -129,16 +129,17 @@ Varyings ShadowPassVertex(Attributes input)
129129
#endif
130130

131131
// Tint Map UV
132-
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_3D_ENABLED)
132+
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED)
133133
output.tintUV = TRANSFORM_TINT_MAP(input.texcoord.xy);
134134
output.tintUV.x += GET_CUSTOM_COORD(_TintMapOffsetXCoord);
135135
output.tintUV.y += GET_CUSTOM_COORD(_TintMapOffsetYCoord);
136136
#endif
137137

138138
// Tint Map Progress
139-
#ifdef _TINT_MAP_3D_ENABLED
140-
output.baseMapUVAndProgresses.w = _TintMap3DProgress + GET_CUSTOM_COORD(_TintMap3DProgressCoord);
141-
output.baseMapUVAndProgresses.w = TintMapProgress(output.baseMapUVAndProgresses.w);
139+
#ifdef _TINT_MAP_MODE_2D_ARRAY
140+
output.baseMapUVAndProgresses.w = FlipBookProgress(_TintMapProgress + GET_CUSTOM_COORD(_TintMapProgressCoord), _TintMapSliceCount);
141+
#elif _TINT_MAP_3D_ENABLED
142+
output.baseMapUVAndProgresses.w = FlipBookBlendingProgress(_TintMap3DProgress + GET_CUSTOM_COORD(_TintMap3DProgressCoord), _TintMapSliceCount);
142143
#endif
143144

144145
// Flow Map UV
@@ -203,7 +204,7 @@ half4 ShadowPassFragment(Varyings input) : SV_TARGET
203204
#endif
204205

205206
#ifdef _FLOW_MAP_TARGET_TINT
206-
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_3D_ENABLED)
207+
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED)
207208
input.tintUV += flowMapUvOffset;
208209
#endif
209210
#endif
@@ -224,7 +225,7 @@ half4 ShadowPassFragment(Varyings input) : SV_TARGET
224225
if (_ShadowCasterAlphaAffectedByTintColor)
225226
{
226227
half tintBlendRate = _TintBlendRate + GET_CUSTOM_COORD(_TintBlendRateCoord);
227-
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_3D_ENABLED)
228+
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED)
228229
ApplyTintColor(color, input.tintUV, input.baseMapUVAndProgresses.w, tintBlendRate);
229230
#else
230231
ApplyTintColor(color, half2( 0, 0 ), input.baseMapUVAndProgresses.w, tintBlendRate);

Assets/Nova/Runtime/Core/Shaders/ParticlesUberUnlit.hlsl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,9 @@ Varyings vertUnlit(Attributes input, out float3 positionWS, uniform bool useEmis
171171

172172
// Tint Map Progress
173173
#ifdef _TINT_MAP_MODE_2D_ARRAY
174-
output.baseMapUVAndProgresses.w = _TintMapProgress + GET_CUSTOM_COORD(_TintMapProgressCoord);
175-
output.baseMapUVAndProgresses.w = FlipBookProgress(output.baseMapUVAndProgresses.w, _TintMapSliceCount);
174+
output.baseMapUVAndProgresses.w = FlipBookProgress(_TintMapProgress + GET_CUSTOM_COORD(_TintMapProgressCoord), _TintMapSliceCount);
176175
#elif _TINT_MAP_3D_ENABLED
177-
output.baseMapUVAndProgresses.w = _TintMap3DProgress + GET_CUSTOM_COORD(_TintMap3DProgressCoord);
178-
output.baseMapUVAndProgresses.w = TintMapProgress(output.baseMapUVAndProgresses.w);
176+
output.baseMapUVAndProgresses.w = FlipBookBlendingProgress(_TintMap3DProgress + GET_CUSTOM_COORD(_TintMap3DProgressCoord), _TintMapSliceCount);
179177
#endif
180178

181179
// Flow Map UV
@@ -274,7 +272,7 @@ half4 fragUnlit(in out Varyings input, uniform bool useEmission)
274272
#endif
275273

276274
#ifdef _FLOW_MAP_TARGET_TINT
277-
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_3D_ENABLED)
275+
#if defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED)
278276
input.tintEmissionUV.xy += flowMapUvOffset;
279277
#endif
280278
#endif
@@ -299,7 +297,7 @@ half4 fragUnlit(in out Varyings input, uniform bool useEmission)
299297
input.baseMapUVAndProgresses.xy += parallaxOffset;
300298
#endif
301299

302-
#if defined(_PARALLAX_MAP_TARGET_TINT) && (defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_3D_ENABLED))
300+
#if defined(_PARALLAX_MAP_TARGET_TINT) && (defined(_TINT_MAP_ENABLED) || defined(_TINT_MAP_MODE_2D_ARRAY) || defined(_TINT_MAP_3D_ENABLED))
303301
input.tintEmissionUV.xy += parallaxOffset;
304302
#endif
305303

Assets/Nova/Runtime/Core/Shaders/UIParticlesUberLit.shader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Shader "Nova/UIParticles/UberLit"
7777
_TintMap3DProgressCoord("Tint Map 3D Progress Coord", Float) = 0.0
7878
_TintMapProgress("Tint Map Progress", Range(0, 1)) = 0.0
7979
_TintMapProgressCoord("Tint Map Progress Coord", Float) = 0.0
80-
_TintMapSliceCount("Base Map Slice Count", Float) = 4.0
80+
_TintMapSliceCount("Tint Map Slice Count", Float) = 4.0
8181
_TintMapOffsetXCoord("Tint Map Offset X Coord", Float) = 0.0
8282
_TintMapOffsetYCoord("Tint Map Offset Y Coord", Float) = 0.0
8383
_TintBlendRate("Tint Blend Rate", Range(0.0, 1.0)) = 1.0

0 commit comments

Comments
 (0)