+2
Under review

Screen Position node output

jcarpay 10 years ago updated by Frank Schoeman 9 years ago 16
Setting up a texture node that uses screen position as UV input results in jittering pixels when the object where the shader is applied to is being moved.
Quality has 'Per-pixel screen coordinates' enabled.
Strange, it seems to work fine for me. How does the node tree look?
The node tree is very simple. Just link a Screenpos node to the UV input of a Texture2D node. Attached a sample image of the result of both SF and SSE.
Strange - could you send me the compiled SSE .shader?
Not that I can see, where did you send it to?
webmaster@acegikmo.com
Perhaps your spam filter is blocking the message. Email has been resent from an alternative address.
Let me know if you've received the file.
I got it :)
(Also, the SSE code is rather messy, I thought it would be a bit cleaner)
Yeah, that's why there's ShaderForge ;)
Haha, thanks <3

So I'm not seeing any major difference at the moment. Are you using * 2 - 1 after the screenpos in the SF shader?
Actually, why am I asking you? I have both shaders. Just a sec
Are you 100% sure you had per-pixel screen coords checked?
I can't reproduce this without unchecking it from what I can see
Per pixel screen coords are checked.
Upon further investigation it appears to jitter only when filtering of the texture is set to 'point'. SSE works correctly with any filter mode.
If it helps, I can send you a sample scene.

Edit: It seems screenPos with surface shaders ignores the filtering method of a texture and is always pixel precise while SF takes filtering into account.
@Joachim You will see the jitter if you view the shader in a Unity viewport and rotate the camera. It only happens in point filtering and when the wrap mode is on repeat. The problem is much more obvious if you use a small 2x2 or 4x4 texture and divide it over the width of the screen.

edit: Just found out that it doesn't actually happen at runtime. It's just the #scene work viewport that shows the jitter.
I suddenly don't have this issue anymore at all. I don't know what changed.