# Incorrect screenSize uniform when using a node material

**URL:** <https://forum.babylonjs.com/t/incorrect-screensize-uniform-when-using-a-node-material/21348>\
**Category:** Bugs\
**Tags:** nme\
**Created:** [June 2, 2021, 3:47pm UTC](https://forum.babylonjs.com/t/incorrect-screensize-uniform-when-using-a-node-material/21348 "2021-06-02T15:47:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![laurent](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/laurent/32/51107_2.png) [@laurent](https://forum.babylonjs.com/u/laurent)\
**Post date:** [June 2, 2021, 3:47pm UTC](https://forum.babylonjs.com/t/incorrect-screensize-uniform-when-using-a-node-material/21348/1 "2021-06-02T15:47:29Z")

</div>

Hi,

I am using a ScreenSize block in NME and the screenSize uniform provided to the shader is (width x width) instead of (with x height).

Step to reproduce :

1. Open the following playground [https://playground.babylonjs.com/#C2ETM4#8](https://playground.babylonjs.com/#C2ETM4#8).
2. Ensure that the 3D window size is not a square for instance 894x951
3. Run the inspector and check the drawElements call on the canvas frame buffer. You will see that the screenSize uniform is 894x894 :  
 ![inspector](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/8/2/8276dcca73e3c7cb257b29bbada0aa1a838ab0e4.png)

The playground scenario may not be the simplest one but I haven’t found a better one !

I first draw a sphere in red to a render target and then I render again the sphere and I project the render target on it using screen space coordinates. You will notice that the spheres don’t match except when the 3D window is a square. If the uniform was width x height, the red sphere image should match exactly the 3D sphere.

Thanks !

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [June 2, 2021, 4:15pm UTC](https://forum.babylonjs.com/t/incorrect-screensize-uniform-when-using-a-node-material/21348/2 "2021-06-02T16:15:38Z")

</div>

adding @sebavan

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 2, 2021, 4:40pm UTC](https://forum.babylonjs.com/t/incorrect-screensize-uniform-when-using-a-node-material/21348/3 "2021-06-02T16:40:55Z")

</div>

I ll fix it ASAP, thanks for the nice report

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 2, 2021, 5:13pm UTC](https://forum.babylonjs.com/t/incorrect-screensize-uniform-when-using-a-node-material/21348/4 "2021-06-02T17:13:08Z")

</div>

This was simply a typo and I love that it is only this 🙂

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/4/340fd62d395e023ad61e7538f3f597b79f8b7549.png)

The fix will be in the next nightly : [Fix Screen size block in NME by sebavan · Pull Request #10448 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/10448)

---

<div class="post-metadata">

**Author:** ![laurent](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/laurent/32/51107_2.png) [@laurent](https://forum.babylonjs.com/u/laurent)\
**Post date:** [June 2, 2021, 5:34pm UTC](https://forum.babylonjs.com/t/incorrect-screensize-uniform-when-using-a-node-material/21348/5 "2021-06-02T17:34:37Z")

</div>

Thanks for the fast correction !
