Window Width and Height with aspect ratio in material editor

Hello,

I am trying to draw a texture over the screen that has the same resolution as the screen, It has to cover the entire screen, so I am using the ScreenAlignedUVs node in the material editor. However this does not work if I put any kind of aspect-ratio on the camera.

The node returns (0,0) at the top of the window (green line), but I need to have it start at the top of the view (blue line)
I want it to be dynamic so I can change the width and height of the window.

Is it a bug? Or am I looking in the wrong place.
I can calculate the offset but I have to be able to get the window size somewhere, and I can not find this node. A custom node with Frame.RenderTargetSize returns some kind of buffer size that does not grow smaller only bigger and that is not usefull in my case…

I hope there is an easy fix :slight_smile:

,
Elias

Bump, In my image I marked the green line with screenposition, but I meant ScreenAlignedUVs, the node that is pasted on top :slight_smile:

Hi PasteDog,

Thank you for submitting a bug report. I have reproduced this issue and logged a report for it here: Unreal Engine Issues and Bug Tracker (UE-38404)

You can track the report’s status as the issue is reviewed by our development staff.

Cheers,

Hey thank you for looking in to this.

Could you maybe point me in the right direction to fix this issue? Or do you maybe have a workaround for this? For example the way I can get the window size in the material editor? Any help is greatly appreciated! :slight_smile:

Currently the only workaround I can think of is to use a panner to push the texture coordinates to the right and down so that you account for the letter box (black bars).

If you use a static number in the time input the panner wont scroll over time so you can just change the speed x and speed y accordingly to match your screen. Speed x and Speed y aren’t exposed in 4.12 though they are in 4.13.

To get around this you may need to use two panners and in the first set speed x to 1 and speed y to 0. Then attach a scalar parameter to time so you can control the x position. For the next node do the same for y.

I hope that helps,

Ed

If anyone is interested, I was actually able to get the effect I wanted by changing the Mapping in the Screenposition node from SceneTextureUV to ViewportUV

117442-fix.png