Quantcast
Channel: Questions in topic: "hlsl"
Viewing all articles
Browse latest Browse all 206

Find position of pixel that's currently being calculated in shadergraph custom function

$
0
0
I am creating a shader with a custom function that highlights edges on a 2D texture. For my calculations I need to know which pixel is currently being calculated. There are two ways to do this:
- Use shadergraph to input the position ***on the texture*** (not in object space) into the custom function.
- Keep a count of how many pixels of the texture have been calculated and then calculate which pixel is the current pixel. This method requires a variable either in the Unity editor or in the custom function that holds it's value across pixels. There is no documentation for interacting with variables in the Unity editor from a custom function. Everything that I have tried in the custom function gets deleted and recreated for each pixel.
I need a solution to either of these problems. Either getting the location on the texture, or holding a static variable.

Viewing all articles
Browse latest Browse all 206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>