Screen coords using shader graph out of bounds

Hi guys, we’re trying to set up a pretty simple vertial screen-space gradient as a background. The shader was authored in shader graph and basically only uses the Screen Position (set to Default) and Blend node.

It works but is dependent on the display scaling and/or browser scaling.

So if both is 100%, all is good, but e.g. 150% display or browser scaling leads to a scaled gradient (it shrinks) as the blend operation gets now fed with values <0 and >1.

Also on a more general note, it is currently much guesswork which nodes might work – e.g. we had to get rid of the Remap node as it silently got stripped by the exporter :confused:

Dead link as usual :slight_smile:

1 Like

Sorry. Yeah we upgraded the AI to a supposedly better model but it’s back at hallucinating links… we’re aware.

Regarding shaders:

  • screen position not taking browser scaling or DPI into account would be a bug, would you mind reporting a bug project with a simple repro scene?
  • “we had to get rid of the Remap node as it silently got stripped by the exporter” – this is also not clear to me, we’re not stripping anything, we’re only postprocessing Unity’s WebGL shader compiler output. Are you sure this is the case?

I can quickly send you the shadergraph if that’s of any worth?

Hmm strange. The remapping was working in unity and in webgl it was always just passing through output. I did not investigate too much though. I’ll check.

Project via bug reporter would be easier for me as it lands in our task system with all the files/project ready, but if you don’t have time for that feel free to drop the graph here

Regarding the scaling – I just poked around and saw the exported shader uses _ScaledScreenParams which is computed the same way as _ScreenParams in src\engine\extensions\NEEDLE_techniques_webgl.ts LL294
Maybe that’s the culprit?

I’ve just uploaded a bug report.

Here’s a bonus screenshot with 125% display scaling:

Btw: The remap node exports fine, so strike that :blush:

1 Like

Any progress with the scaling bug? Can you repro with the provided report?

Hi @hybridherbst, any progress so far?

Hi, on OSX I can’t reproduce the issue.

I’ve tried both adjusting device pixel ratio using the browser emulator and changing my display scale. In all cases the line is perfectly centered and looks like in Unity.

Have you tried running your scene again using the latest Needle Engine version?

Also your shader is not using ScreenParams (at least not as a uniform)

Unity

Chrome

Chrome DPR set to 3

OS display resolution smaller

OS display resolution larger

Chrome zoomed to 200%

Maybe it behaves differently on windows scale but can not try this right now.

Interesting. Thanks for taking your time to investigate.

Could you send me the report so I can test the same thing on my windows machine please?

Nevermind, found it :slight_smile:

I’ve upgraded to NE 4.11.3 and exported, the problem persists.

Windows’ DPR is set to 1.5. I’m zooming the browser windows using ctrl+ and ctrl-.

Firefox:

Chrome: