I am trying to build a shader (my first one) which will require feedback. Before trying to implement what I need I decided to build the simplest possible feedback shader based on Mr.Benedikt example “difference_textures” copying the feedback trick from his other example “game_of_life”.
I created a new technique which simply does a bypass based on the feedback texture and much to my surprise the result is a dissolving scroll moving down and to the right.
First I thought the problem was related to the scale applied to the Shader and tried to tweak its value without success.
Now I rest clueless looking at the feedbacked texture scroll and dissolve into something useless for my purposes.
Here attached I send the patch, shader and textures. The technique I created is called “feedback”.
What am I doing wrong? how to make a feedback which results in a stable image?
this is a half pixel default shift by a your graphicscard. you fix it either in the advanced options of your video driver (called ‘alternate pixel centers’ or so) or by translating the texture by a half pixel.
i wouldnt use the advanced options, as you would need to set it on any computer where you need to run your patch. and on any computer where this flag is set, all correct patches would show the scrolling effect. so its a good thing graphic card vendors hide this option deeper and deeper in the control panals…
Hi, thank you all for the replies. Also, Mr. Benedikt replied directly sending me a example patch and suggesting that I could correct this by adding a small offset to the calculations outside and/or inside the shader, like tonfilm had suggested.
Actually none of this really worked. But I found the solution (I guess by chance) in another of Mr.Benedikt’s example: Game Of Life.
Having added feedback to this example I noticed that unlike the others, this one was immediately stable. Comparing the code I found out that the way the “sampler” was declared was different:
To be honest I still didn’t investigate on what each of these mean, but I tried to change it and found out that if MagFilter is set to Point instead of LINEAR the feedback is immediately stable.
So, now, having set MagFilter to Point, everything works fine.