# Window Width and Height with aspect ratio in material editor

**URL:** <https://forums.unrealengine.com/t/window-width-and-height-with-aspect-ratio-in-material-editor/375648>\
**Category:** Asset Creation\
**Tags:** aspect-ratio, unreal-engine, question\
**Created:** [November 7, 2016, 9:30pm UTC](https://forums.unrealengine.com/t/window-width-and-height-with-aspect-ratio-in-material-editor/375648 "2016-11-07T21:30:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PasteDog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasteDog](https://forums.unrealengine.com/u/PasteDog)\
**Post date:** [November 7, 2016, 9:30pm UTC](https://forums.unrealengine.com/t/window-width-and-height-with-aspect-ratio-in-material-editor/375648/1 "2016-11-07T21:30:58Z")

</div>

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.

 ![114074-screen.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/9/a790e8fc65da880e87fe5bf77ddf3e45cdfecb6c.jpeg)

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 🙂

,  
Elias

---

<div class="post-metadata">

**Author:** ![PasteDog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasteDog](https://forums.unrealengine.com/u/PasteDog)\
**Post date:** [November 9, 2016, 11:25am UTC](https://forums.unrealengine.com/t/window-width-and-height-with-aspect-ratio-in-material-editor/375648/2 "2016-11-09T11:25:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0c62419a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0c62419a](https://forums.unrealengine.com/u/anonymous_user_0c62419a)\
**Post date:** [November 9, 2016, 3:42pm UTC](https://forums.unrealengine.com/t/window-width-and-height-with-aspect-ratio-in-material-editor/375648/3 "2016-11-09T15:42:56Z")

</div>

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)](https://issues.unrealengine.com/issue/UE-38404)

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

Cheers,

---

<div class="post-metadata">

**Author:** ![PasteDog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasteDog](https://forums.unrealengine.com/u/PasteDog)\
**Post date:** [November 10, 2016, 5:20pm UTC](https://forums.unrealengine.com/t/window-width-and-height-with-aspect-ratio-in-material-editor/375648/4 "2016-11-10T17:20:39Z")

</div>

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! 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0c62419a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0c62419a](https://forums.unrealengine.com/u/anonymous_user_0c62419a)\
**Post date:** [November 11, 2016, 1:38pm UTC](https://forums.unrealengine.com/t/window-width-and-height-with-aspect-ratio-in-material-editor/375648/5 "2016-11-11T13:38:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PasteDog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasteDog](https://forums.unrealengine.com/u/PasteDog)\
**Post date:** [December 5, 2016, 10:31am UTC](https://forums.unrealengine.com/t/window-width-and-height-with-aspect-ratio-in-material-editor/375648/6 "2016-12-05T10:31:46Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/e/87e5798cad2752db6e1222a7dc6aa37df14e6977.png)
