Hello, I’m newish to unity and want to allow the player to upload an image and then edit it. I’m trying to figure out how to apply convolutions to the texture2D for the image for certain effects but I’m not seeing anywhere how this is doable without shaders. Does anyone here know if it’s possible to use a unity library to apply convolutions to an image in an efficient way? Thanks
This isn’t a 2D question, texture2D is the basis for nearly all graphics in Unity so it’s a graphics/shader question and should be asked on those forums: https://forum.unity.com/categories/graphics.75/
I’ll move your post.
What kind of ‘convolutions’? That’s a very broad question.
Hello thanks for responding. I mean applying a kernel to an image. I’m specifically trying to create a 3x3 matrix that represents a Sobel filter which I can then convolve with the texture2D represented as a matrix.
The most obvious way might be Texture2D.SetPixel/GetPixel/ or GetPixelData SetPixelData
That’s what I’ve been using so far to access the pixels but I’d have to code up a function to apply the convolution to the matrix if those are the only tools available. I figured there might be a way to do common matrix operations without turning everything into compute shaders but I was unable to find a commonly used way online.