shader_type canvas_item; uniform float tile_count; const int chunk_size = 32; uniform int tiles[chunk_size*chunk_size]; uniform int items[chunk_size*chunk_size]; uniform sampler2DArray tile_texture : filter_nearest_mipmap; uniform sampler2DArray item_texture : filter_nearest; void fragment() { float item_id = float(items[int(floor(float(chunk_size) * UV.x) + float(chunk_size) * floor(float(chunk_size) * UV.y))]); COLOR = texture(item_texture, vec3(mod(UV.x * float(chunk_size), 1.0), mod(UV.y * float(chunk_size), 1.0), float(item_id)) // map ); if (COLOR == vec4(0,0,0,0)){ float tile_id = float(tiles[int(floor(float(chunk_size) * UV.x) + float(chunk_size) * floor(float(chunk_size) * UV.y))]); COLOR = texture(tile_texture, vec3(mod(UV.x * float(chunk_size), 1.0), mod(UV.y * float(chunk_size), 1.0), float(tile_id)) // map ); } }