You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Guys,
I've been now using gpujs to create a complex image processing pipeline and been wondering what is the best way to pass an array of images/textures to a shader?
The naive approach of just passing an array of images is not supported
I see couple alternative solutions eg. draw all images side by side and then do some index fiddling:
constsumKernel=gpu.createKernelfunction(image: number[][][],len: number,weights: number[]){letsums=[0,0,0,0];for(letk=0;k<4;++k){for(leti=0;i<len;++i){sums[k]+=weights[i]*images[this.thread.y][this.thread.x+i*this.output.width][k]// assuming all images have same dimensions}}this.color(sums[0],sums[1],sums[2],sums[3]);})sumKernel([image1,image2],2,[0.5,0.5);
What is best practice?
The text was updated successfully, but these errors were encountered:
nikhedonia
changed the title
processing arrays of images with gpu-shader
How to process arrays of images with gpu-shader
Sep 18, 2023
Hey Guys,
I've been now using gpujs to create a complex image processing pipeline and been wondering what is the best way to pass an array of images/textures to a shader?
The naive approach of just passing an array of images is not supported
I see couple alternative solutions eg. draw all images side by side and then do some index fiddling:
What is best practice?
The text was updated successfully, but these errors were encountered: