Convert display [min, max] range to shader intensity (gain) and offset.
The shader computes: final_color = clamp(color * intensity + offset, 0, 1) We want displayMin → 0 and displayMax → 1: intensity = 1 / (max - min) offset = -min / (max - min)
final_color = clamp(color * intensity + offset, 0, 1)
displayMin → 0
displayMax → 1
Convert display [min, max] range to shader intensity (gain) and offset.
The shader computes:
final_color = clamp(color * intensity + offset, 0, 1)We wantdisplayMin → 0anddisplayMax → 1: intensity = 1 / (max - min) offset = -min / (max - min)