#version 430 // Input from vertex shader flat in int v_instance_id; // Output: Object ID encoded as RGB color out vec4 fragColor; void main() { // Encode instance ID into RGB channels // R = low byte, G = high byte, B = 0, A = 1 int low_byte = v_instance_id & 0xFF; int high_byte = (v_instance_id >> 8) & 0xFF; fragColor = vec4( float(low_byte) / 255.0, float(high_byte) / 255.0, 0.0, 1.0 ); }