I’m loading of bunch of scientific datas (around 100Mo with quite a high dynamic range) into the alpha channel of a texture…
So the actual value of the pixel displayed will be controlled
if I understood correctly by
Problem is, when I want to change the gain (often), I do have to call glTexSubImage2D again which can take a significant amount of time… to have the new pixel transfer settings applied…
I thought I could overcome that with shaders…
I transfer the pixels with low gain (to prevent clipping of my datas) and then tweak the gain in the shaders
something like that (fragment shader excerpt):
lkup = texture2D(texture, uv.xy); pente1 = tan(pisur4 + scaling); intensity = pente1 * lkup.a + (0.5 - pente1*0.5); gl_FragColor = texture1D(lut, clamp(intensity, 0.0, 1.0))*gl_Color;
by artificially playing with scaling I can affect the value of my data texture lookup before looking up for color values into my color map texture…
this seems to work at first sight but when ramping up the gain quickly precision issues mess everything up… (you end up looking up on only a few pixels of your color map)
Is there any way around all this?
thx for any thoughts!