4

1) Scale the texture coordinates from [0,1]x[0,1] -> [0,3]x[0,3]. It works with higher integer scales as well. This creates an imaginary 3x3 tiles grid. st *= 3.; 2) Split the upscaled texture coordinates into the integer part and its float reminder. vec2 i_st = floor(st); //the tile coords of the fragment - an integer pair {0,1,2}x{0,1,2} vec2 f_st = ...


Only top voted, non community-wiki answers of a minimum length are eligible