0
Terminé

atan2 without discontinuity

TheMasonX il y a 9 ans mis à jour il y a 9 ans 8
Not technically a bug, as it's a part of the atan2 output, but when I try to use polar coordinates, or turn the position into a UV coordinate, I get a nasty pixel wide error along the -x axis due to the discontinuity. I can't seem to find any info on avoiding this, especially in a shader, and I was wondering if you could help. I'm out of places to turn, and I need this to work for my job. Thank you very much in advance.

Solution

+1
Solution
Terminé
Found the issue.
This isn't a problem in atan2, this is a problem in how the GPU finds which MIP level to use in the texture. If you connect the MIP input of the Texture 2D node, the artifact goes away :)
+1
À l'étude
I've wondered this as well recently, I'll look into it
Wow, thanks for the lightning fast feedback! I just want to say that I love Shader Forge by the way, it has made making custom shaders the best part of my day, as I can get amazing results with minimal work, and can focus on the creative bits and fun math rather than trying to setup all the dependencies and figure out why things aren't compiling correctly.
My image didn't show up. The problem, and the code that's generating it.


+1
Solution
Terminé
Found the issue.
This isn't a problem in atan2, this is a problem in how the GPU finds which MIP level to use in the texture. If you connect the MIP input of the Texture 2D node, the artifact goes away :)
Awesome! Thank you so much! :)
+1
I did update ArcTan2 now for 1.18 though - you can now select between these:



I saw that, good job! Saves a few nodes of setup and clutter for doing something fairly common. Love all the new nodes and fixes too; my coworker and I have been going over them and what we plan to do with the stencil buffer all morning, it's like Christmas in August :)