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