I’m quite new to shaders and not really sure how to get the col of the next pixel on the screen, please help me!!!
If by “screen” you mean the target where you are rendering (the screen buffer or other renderTexture), you can’t access that directly in the shader. The only part of the pipeline that accesses it is the blending stage.
If you really need some effect that requires information from the target (eg. some distortion), you can use unity’s GrabPass, but it’s quite costly. It will basically capture the screen content into a separate texture and provide your shader with that.
It’s different in post-processing, where the previous target content is already provided in the MonoBehaviour’s OnRenderImage method.
It depends how you use your shader. If you use it as a post-processing effect (with Graphics.Blit on a RenderTexture), you can actually get the surrounding pixels’ color with some offset.
It kinda works like this : float2 offset = 1.0 / _ScreenParams.xy; float4 rightPixel = tex2D(_MainTex, i.uv + float2(offset.x, 0.0));
Inside rightPixel, you’ll find the RGBA values of the pixel. Of course, you can access all 8 pixels around the current pixel. It works for fragment shaders, I use it in a Demosaicing shader.
I hope it helped you ^^