shader_type spatial; render_mode unshaded; // Cosmetic terrain texture uniform sampler2D terrain_tex: source_color, repeat_enable; // Province shape texture uniform sampler2D province_tex: source_color, repeat_enable; // Position of the mouse over the map mesh in UV coords uniform vec2 hover_pos; // Position in UV coords of a pixel belonging to the currently selected province uniform vec2 selected_pos; const vec3 NULL_COLOUR = vec3(0.0); void fragment() { vec3 terrain_colour = texture(terrain_tex, UV).rgb; vec3 prov_colour = texture(province_tex, UV).rgb; vec3 hover_colour = texture(province_tex, hover_pos).rgb; vec3 selected_colour = texture(province_tex, selected_pos).rgb; // Boost prov_colour's contribution if it matches hover_colour or selected_colour float mix_val = float(prov_colour == hover_colour) * 0.3 + float(prov_colour == selected_colour) * 0.5; // Set to 0 if the province has NULL colour mix_val *= 1.0 - float(prov_colour == NULL_COLOUR); ALBEDO = mix(terrain_colour, prov_colour, mix_val); }