2
$\begingroup$

I would like to use an image to adjust geometry of a sphere. I am using an icosphere to avoid the loss of resolution near the equator.

In the shader node this is accomplished with this setup.

enter image description here

In geometry nodes you can achieve "generated" but there is no option to change the image texture to Sphere.

enter image description here

Thus the geometry is messed up

enter image description here

There must be some kind of transformation to get the image into Sphere mode right? How would I go about that?

$\endgroup$

1 Answer 1

5
$\begingroup$

Sphere Projection uses the Spherical coordinate system:

  • radial distance $r$ (or $ρ$) is not used, because it’s a projection,
  • azimuth $\varphi$ (also known as a polar coordinate) is translated to $x$ in the texture,
  • inclination (elevation) $θ$ is translated to $y$ in the texture.

There are some aliasing problems visible on the azimuth seam and from far away in the Difference blending, and even when zooming some differences can still be spotted – maybe the algorithm could be improved by e.g. changing the orders of calculations, so the float errors are reduced?

In geometry nodes you don’t have the Generated coordinate system, but you don’t need it, and in fact, using the Object coordinate system is simpler, because you can remove the first Vector Math, which makes sure the center of sphere is in the origin:

Math: Arctan2 node outputs a value in range $-90°..+90°$, but expressed in radians (in memory in Blender angles are always represented as radians, though by default displayed as degrees, with the degree ° symbol) $=-{π\over 2} .. +{π \over 2}$ so from $-1.57…$ to $+1.57…$. The UV space however is normalized in $0..1$ range, so this node is a more performant way of a Map Range like so:

Explaining using Python: (keep in mind _ means the result of last operation, previously displayed)

>>> radians(90)  # what is the range -90deg .. +90deg expressed in radians?
1.5707963267948966  # range from -1.57... to +1.57...

>>> 0.5 / _  # a * b = 0.5, therefore b = 0.5 / a (div both sides by a)
0.3183098861837907

>>> radians(90) * _  # obtained number, times the range gives -0.5..+0.5
0.5

>>> # and -0.5 .. +0.5 , can be normalized to 0..1 by adding 0.5

To further clarify, in the 2nd operation's comment, I mean that we have a range $-a .. +a$, and we want to multiply it by some number $b$, so that the range is $-0.5 .. +0.5$ (when normalizing a symmetric range, always first convert it to 0.5 on either side, and then add 0.5). To find this number $b$, just transform the formula describing the problem.

$\endgroup$
3
  • $\begingroup$ Very nice. Thanks my guy. $\endgroup$
    – TheJeran
    Commented Nov 27, 2022 at 14:16
  • $\begingroup$ I keep coming back to this because it's helped me so many times. But I was wondering. What Multiply + Add node do with the 0.318 and 0.5 values respectively? $\endgroup$
    – TheJeran
    Commented Jul 21, 2023 at 11:10
  • 1
    $\begingroup$ @TheJeran If you look around the node, you will see a hint: i.imgur.com/5OA56bw.png see the update. $\endgroup$ Commented Jul 21, 2023 at 12:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .