Why is SceneTextureSize different from ViewportSize?

I’m trying to implement Radial Blur.At first I use ViewportUV to Sample SceneTexture. I find that the effect was wrong.
Then I get answer with Google. SampleUV=ViewportUV*View.SizeSizeAndInvSize.xy*View.BufferSizeAndInvSize.zw; But I don’t know why.

1 Like

Hi I think I was having your same problem, But thank you I realized how fix it.
For the future pp looking for this:

My material post process effect, was kinda clamped and offsetted, In my case I used same function I think Xuzshe found online about the spiral blur to Blur SceneTexture:Postprocess 0 and SceneTexture:CustomStencil. (See below)

Btw, I had to change something a bit, such exposed the “int.” value to choose which SceneTexture to use.

In the end “Scenetexture PostProcess0” was actually working fine, but the Stencil One had the problem I described above.

I Fixed exposing the “BaseUV” (actually you dont need expose the parameter) and instead of using the “MaterialFloat2(ScreenAlignedPosition(Parameters.ScreenPosition).xy);”

I used your formula but I think you had this wrong, for this reason maybe it didnt work for you, It should be:

BaseUV= ViewportUV * View_ViewSizeAndInvSize / View.BufferSizeAndInvSize.xy

Im Using 5.1 so I changed a bit the code
View.SizeSizeAndInvSize.xy Its View_ViewSizeAndInvSize
and
View.BufferSizeAndInvSize.xy Its View.BufferSizeAndInvSize.zw


Im not coder I just did some test and It worked, hope It’ll help more people
Bye