# How to translate plane coordinates to equirectangular?

(Korchy) #1

I have a procedural texture with a circle made by formula X ** 2 + Y ** 2 < R ** 2. It looks like a circle on a plane. But if I try to use this formula in the World environment - the circle is distorted.

How to convert XY coordinates in the formula to the equirectangular coordinates to have the clear circle in the environment?

It’s not about especially for the circle, I need to have the formula to translate any procedurally generated plane texture to equirectangular.

(Secrop) #2

If you want a perfect circle in the equirectangular space, you need to draw it with the inverse transformation in the XY plane. In other words, a perfect circle in a 2D plane gets always distorted after the transformation to ER projection.

For something simple as a circle, it’s better to draw it directly in the 3D coordinate space, than to do it as a 2D texture. Other textures might be harder to do.

(Korchy) #3

I understand this. But I can’t find the formula for that transformation.

(Secrop) #4

But for a simple circle, it’s easier to just do vector math in 3D space… Where dot(N, center) returns the cosine of the angle between a Normal and the (normalized) center of your circle. If the dot product is 1, then N=center and theta=0.

(Korchy) #5

I tried to recreate this formula with nodes, but with no success ((

Here is the blend-file with my efforts. Maybe I do something wrong?

untitled_1.blend (845.0 KB)

(Secrop) #6

Here’s a node group that converts XY coordinates to Polar Coordinates… X and Y go from 0 to 1.

And here’s an example to draw a circle in the Background:

As you can see, I only transform the coordinate for the center of the circle… The rest is drawned in the 3D space.

(Korchy) #7

You made the circle by normal and dot. But this is very single case. What about any other procedural textures? For example checker texture, can I put in on the environment without distortion?

(Secrop) #8

The enviroment is a Sphere. So you can create any procedural texture that works in a spherical coordinate system.
The checker is a 2D texture, and it will always distort on curved surfaces…
You can, however, write your own checker (or any other type) texture to work in a spherical surface.

(Korchy) #9

I know only one way to do that - uv. But there is no uv on the environment scphere (
My idea was to draw the distorted checker (or any other texture) first and so after thranslation to the equirectangle projection it becomes proper, the distortion comes out.
But my efforts was fail (

(Secrop) #10

You can build one procedurally… The default coordinate system for the environment is the Normal, which is a normalized 3D vector. You can transform this coordinate system into anything else, even an equirectangular (the math is in the node group I posted above)…
I personally prefer to use specific coordinate systems for specific texture types.

(Korchy) #11

Unsuccess again (

the blend-file

untitled_2.blend (871.5 KB)

(Secrop) #12

Here the same equirectangular coordinates used inside the EnviromentTexture node:

the radial gradient is the same as a atan2… (recent builds of blender already have this function in the Math node)

(Korchy) #13

Great! I think that this is it!
I will try to understand it and continue experiments.
Big thanks!