Skip to content

Commit b318d11

Browse files
authored
Merge pull request #156 from CyberAgentGameEntertainment/fix/tatami/random-row-progress
fix: Resolve texture bleeding issue in Texture2D Array mode for Random Row Selection
2 parents 4e37ee4 + 91b8d5f commit b318d11

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,17 @@ half2 GetFlowMapUvOffset(TEXTURE2D_PARAM(flowMap, sampler_flowMap),
166166
#endif
167167
}
168168

169-
// Returns the progress for flip-book.
169+
// Returns the progress for flip-book (Texture2D Array).
170+
// Returns an integer frame index to prevent texture bleeding.
170171
half FlipBookProgress(in half progress, in half sliceCount)
171172
{
172-
float result = progress;
173-
result = clamp(result, 0, 0.999);
174-
result = frac(result);
175-
result *= sliceCount;
176-
result -= 0.5;
177-
return result;
173+
// Clamp progress to [0, 0.999) range
174+
half clampedProgress = clamp(progress, 0.0, 0.999);
175+
176+
// Calculate frame index and floor to integer
177+
// This prevents texture bleeding in Texture2D Array sampling
178+
half frameIndex = clampedProgress * sliceCount;
179+
return floor(frameIndex);
178180
}
179181

180182
// Returns the progress for flip-book blending.

0 commit comments

Comments
 (0)