0

This is my first post, I am not advanced in math so please be patient with me, I hope I can explain myself :) I am using a software called Substance Designer. It has a tool called pixel processor which allows to apply a function to every pixel of a image to obtain visual representations.

If I create a graph where each pixel x, y has a grayscale value equal to atan 2 (x,y), I obtain an angular gradient like this. This is also the angle of any point of a circle centered in the origin with any given ray r.

When a point lies at 1/4 of the circle circumference the angle is pi/2 or 180 degrees When a point lies at 1/8 of the circle circumference the angle is pi/4 or 90 degrees When a point lies at 1/16 of the circle circumference the angle is pi/8 or 45 degrees and so on. There is a direct conection between the circle circumference and the angle.

Now the question: If I have an ellipse centered on the origin with semiaxis a and b Is there a way to create a graph where each pixel x, y has a grayscale value so that When a point lies at 1/4 of the ellipse circumference the angle is pi/2 or 180 degrees When a point lies at 1/8 of the ellipse circumference the angle is pi/4 or 90 degrees When a point lies at 1/16 of the ellipse circumference the angle is pi/8 or 45 degrees and so on? So that there is a direct connection between the ellipse circumference and the angle.

The software has no access to integrals (and I don't know how to use them sadly, but I am ok with trigonometry)

I hope it is not confusing. The image linked here below should show what I am trying to obtain. Any help which I can get will be massively appreciated. Thanks!

Visual explenation

At the moment what I am doing is atan2 (x/a, y/b + t) where t is a number that I need to adjust every time by eye.I am trying to know what "t" is in general :), if such a thing is even possible. Here below I made a picture showing why atan2 (x/a, y/b) by itself is not working. This is simply squashing the circle into the ellipse scaling the x and y axis values so they fit the boundaries of the ellipse, but 1/8 of a circle circumference is different from 1/8 of an ellipse circumference. The gradient obtained with atan2 (x/a, y/b) does not have the correct pixel values. Why atan2 (x/a, y/b) is not working

Paolo_G
  • 35
  • Elliptic arc length is a difficult problem. Unless you have a pressing reason not to, I suggest you use the angle as your parameter instead. – TonyK Apr 06 '20 at 11:40
  • I have seen that it requires integrals usually. I was hoping that "gamma correcting" the gradient on the y axis of a specific number would have done the trick. Because at 0, 90 and 180 and 270 the gradient will have the same values, it is the mid values that needs to be moved I guess. The reason why I need such a gradient is to create a UV distortion of a square texture on an elliptical arch. – Paolo_G Apr 06 '20 at 11:44
  • At the moment what I am doing is atan2 (x/a, y/b + t) where t is a number that I need to adjust every time.I am trying to know what "t" is in general :), if such a thing is even possible – Paolo_G Apr 06 '20 at 12:15
  • I don't understand why atan2 (x/a, y/b) isn't good enough. – TonyK Apr 06 '20 at 12:50
  • Because this is simply squashing the circle into the ellipse scaling the x and y axis, but 1/8 of a circle circumference is different from 1/8 of an ellipse circumference. The gradient obtained with atan2 (x/a, y/b) does not have the correct pixel values. – Paolo_G Apr 06 '20 at 20:20
  • Yes, but why is it so important to have the correct pixel values? It's not something that people will notice, is it? – TonyK Apr 06 '20 at 22:09
  • This gradient will become the U coordinate of a UV map used to deform a texture around an ellipse. If the pixel value is not correct the UV distortion will come out uneven. https://i.stack.imgur.com/XIj1c.jpg – Paolo_G Apr 07 '20 at 00:00
  • Then I think you have a problem, assuming that Substance Designer doesn't know about incomplete elliptic integrals. – TonyK Apr 07 '20 at 00:19
  • I see. Thanks Tony for the link! Is good to have it so well explained :) The software does not have the capability to calculate Integrals I am afraid. If there is no way to calculate an approximation I am afraid the problem is without solution :/. – Paolo_G Apr 07 '20 at 00:44

0 Answers0