Description
TextureUtils.createGradient() accepts a size parameter (default 256). When size <= 1, the denominators in the gradient calculation become zero, producing Infinity values that propagate through the color lerp and result in NaN pixel values.
- Horizontal/vertical:
t = x / (size - 1) → 0 / 0 = NaN
- Radial:
t = Math.sqrt(...) / (size / 2) → 0 / 0 = NaN
Steps to reproduce
TextureUtils.createGradient(1) // or size 0
// Result: texture filled with NaN pixels
Expected behavior
Textures with size <= 1 should produce at least a 2x2 gradient, or at minimum not crash with NaN.
Description
TextureUtils.createGradient()accepts asizeparameter (default 256). Whensize <= 1, the denominators in the gradient calculation become zero, producingInfinityvalues that propagate through the color lerp and result inNaNpixel values.t = x / (size - 1)→0 / 0 = NaNt = Math.sqrt(...) / (size / 2)→0 / 0 = NaNSteps to reproduce
Expected behavior
Textures with
size <= 1should produce at least a 2x2 gradient, or at minimum not crash with NaN.