How could I blending a float type buffer texture(hdr texture) using 8-bit textures(jpg/png)

hello there, I’m trying to render a scene using lightMap without any light source. but there are some problem I have to solve.

I use hdr files as input texture and a single 32-bit texture as output for lightMap. it works fine in modern devices which support ‘EXT_float_blend’ extension.

I find out that there are many devices support ‘color_buffer_float’ but not support ‘EXT_float_blend’.In other words. those devices support 8-bit texture as input and 32-bit(float buffer) as output but not support for 32-bit textures as input and 32-bit texture as output.

so is there some way that I can change hdr file to 4 or maybe more 8-bit textures(png or jpg) but those pictures can store the all the data that hdr file has. and then using these 8-bit textures to rebuild a same 32-bit float buffer texture as hdr did?

here is difference between hdr blending (32-bit texture, left) and jpg blending(8-bit texture, right)

live demo jpg vs hdr

here is difference between use hdr as input but different output type(left Unsigned byte type, right Float type)

live demo different type

here is what it look like in my project but till now it not work on devices which don’t support ‘EXT_float_blend’

solved by myself 11-29 2019

2 Likes

solution, first change hdr file to 4 8-bit textures and save as single png file, 8-bit data for each texture and together there are 32-bit. then rebuid a 8-bit texture using texture mapping using exposure(intensity) and/or temperature as uniforms.


left bottom from 1 to 8 bit, left top from 9 to 16 bit, right top from 17 to 24bit, right bottom from 25 to 32 bit.
right texture : rebuilded texture

2 Likes