Fix T63789: Precision issues in glsl noise texture

There is a significant precision loss when converting large float values to int.
This commit is contained in:
Germano Cavalcante 2019-05-04 16:44:44 -03:00
parent c68c81a870
commit d32a103d53
Notes: blender-bot 2023-05-31 04:43:10 +02:00
Referenced by issue #63789, Generated noise texture is not infinite / looped
1 changed files with 3 additions and 2 deletions

View File

@ -1162,8 +1162,9 @@ vec3 cellnoise_color(vec3 p)
float floorfrac(float x, out int i)
{
i = floor_to_int(x);
return x - i;
float x_floor = floor(x);
i = int(x_floor);
return x - x_floor;
}
/* bsdfs */