Artifacting on highlight shader

We’re encountering an artifact issue on a highlight shader we’re using. It’s only reproducible on MAC M1/M2 chip processors. MAC intel processors work fine without any artifacting. Not sure if it’s a rendering issue or shader issue but any help is much appreciated!

I found similar artifacts with M1/M2 GPUs with depth priming and had to disable that feature because of it, until we can get Apple to figure out the issue. It has something to do with depth precision since the artifacts are very much like depth fighting artifacts. I don’t know if this exactly what you’re getting, but it does look similar. Unfortunately I don’t have a good easy solution for you, but it reminds me to ping Apple about this issue again.

That helped push me in the right direction! We were dealing with z-fighting going on with the base material and our highlight material. The solution to our specific problem was to include these three lines of code in our shader:

ZWrite On Blend SrcAlpha OneMinusSrcAlpha Offset -1, -1

Thanks again for the help!

1 Like

This typically happens when there is more than one pass with slightly different functionality. The compiler ends up applying different optimizations, and the Z value is not exactly the same as a result.
The solution to this is to use the precise qualifier on the data than needs to match between passes no matter what. See Variable syntax - Win32 apps | Microsoft Learn for details.

That’d make sense as to why it’s happening on certain processors. Thanks for supplying the information as well!