Meanwhile I have overcome many hurdles in my project. Now I found a new one. I would like to read out 16 bit image pixels. Why do I need this?
For depth values. I have a grayscale image and in gimp the pixels have decimal places as I want them. For example 12.7
How can I read out 16 bit image data?
“getImageData” is limited to 8 bits
//my 8 bit imageData read function
GetOffscreenImageData: function(image) {
const canvas = new OffscreenCanvas(image.width, image.height);
const context = canvas.getContext('2d');
context.drawImage( image, 0, 0 );
return context.getImageData( 0, 0, image.width, image.height );
}
I don’t know if the textureLoader already makes reductions. So I thought to start all from the scretch. Starting with the imageloading:
const arrayBuffer = await((await fetch('./resources/maps/depth/depthtest1.png')).arrayBuffer());
But before I do unnecessary work I would like to ask if anyone has experience reading 16 bit greyscale image pixel values