Incorrect screenSize uniform when using a node material


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
  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 :

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 !

adding @sebavan

I ll fix it ASAP, thanks for the nice report

1 Like

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

The fix will be in the next nightly : Fix Screen size block in NME by sebavan · Pull Request #10448 · BabylonJS/Babylon.js · GitHub

1 Like

Thanks for the fast correction !