# Central spherical projection of vertically cropped image

I would like to use @Secrop’s spherical projection node tree on a vertically cropped image (so now it has less than 90 degrees latitude north and south) I know what my maximum latitude is but I don’t know how to implement it in his node tree so that the image gets projected properly.

Are the north latitude and the south latitude the same, or do you want two different inputs?

they are the same

Don’t know if i should post here or in the other old thread, but since your question is a bit more specific…

ps… this is intended to work on a sphere… it might fail in other meshes.

Isn’t this a tube projection? With a spherical projection, if I scale the sphere in edit mode, the texture shouldn’t change (just like with your sphere projection). In this case the texture keeps its vertical size, as if it was projected from a vertical axis rather than a single point. I hope I didn’t get you confused with my previous topic about the cylindrical projection, this is a new problem.

It’s just a simple spherical projection, very similar to that in the older post, but with a better math. It’s also very similar to the one I posted in your previous topic…

If this isn’t what you want, then I totally missed the point. Can you post some illustration of what you really need?

Sorry for my lack of clarity. From now on, I think we should use these terms to not get confused:

• central projection: the texture is projected from a single point
• axial projection: the texture is projected from an axis
• spherical projection: the texture is meant to be projected onto a sphere object
• cylindrical projection: the texture is meant to be projected onto a cylinder object

Does it seem better to you?

What I’m trying to achieve is a central spherical projection. The node tree you just provided is an axial spherical projection. I’m making a screen capture to show it more clearly.

Central projection:

Axial projection:

perhaps it’s better to use terms that are commonly used in mapping projections… for example an ‘axial spherical projection’ makes little sense to me…

EDIT… after seeing the capture… just normalize the Object coordinates before the ‘Separate XYZ’… this way no matter which scale the sphere has, it will remain the same projection. Or use ‘Generated’, scale them by 2 and shift them by -1.

The problem with the terms listed in this page is that they explain how rays are projected to get an image while what we are doing is project rays from an image onto a 3D shape (which can be any solid we want) so we have to separate the rays behavior from the end shape in our terms, otherwise it gets confusing.

For example you can use an equirectangular image and project it either from a point or an axis in Blender and obtain the same result on a sphere, even if the process to obtain the image in the first place is solely to project rays from an axis.

Does this make sense to you?

Normalizing works, I’m not clear why yet but thank you!

No it won’t. It will look the same near the equator of that axis, but the texture will shrink in the poles.

The normalize, just make the coordinates fixed in the direction… it’s almost as just turning them into normal vectors from a central point… (if that makes any sense ).
If you scale the object in edit mode, the object coordinates will also scale; and for my setup to work you need an normalized coordinate system, where each pole stays at [0,0,1] and [0,0,-1].
By normalizing any coordinate will become a normal vector (length=1) in the center-outwards direction, no matter how distant the coordinate is from the center.

Ok great so it becomes a central projection!

If you apply a vertical transformation you can get the same result, yet the rays are still projected differently.

Some time ago i posted a nodegroup on the devtalk forum for spherical projection with custom angle input.
A huge mess of a nodegroup because i lack the math but hey, it worked for the project i was using it for ^^

I hope this thread on the devtalk forum gets some more attention in the future. Would be great for the time the asset manager gets included into blender 2.81 (hopefully).

A vertical transformation is what makes a cylindrical projection different from a equirectangular projection… In the first, the vertical scale is related to the sine of an angle, and in the second, it’s related to the angle itself… (in your previous topic, it was related to the Tangent of the angle, which is an even more exotic projection)
Here both examples side by side:

We now have the ability to use custom Python nodes in Cycles/Eevee/Compositor… I’m still writing the code to make it easier to register/unregister nodes, and to add/remove them from the add_menu, but once it’s done, we’ll be able to install new nodes just by placing the python modules in a specific folder. These nodes are just created at runtime, so this is perhaps better, than to have all nodegroups in the scene data (as it’s currently the way they work), even if we don’t plan to use any of them.

Whooot? That sounds perfect!

# Secrop

that sounds interesting
is there some doc, tut , wiki or links on how to use these new custom nodes ?

depends how flexible this allow to do things !
i mean will that give access to all python / Numpy commands ?

thanks
happy bl

@RickyBlender, I haven’t wrote any documentation yet. You can look up for the old NodeCustomGroup in the API manual, as the interface is very similar… thought now there are two more classes in the API, a ShaderNodeCustomGroup and a CompositorNodeCustomGroup.

It’s possible to use python and numpy to change a node’s behaviour and the structure/settings of the internal nodetree… This however doesn’t mean you can really create things like a new shader node, etc. They are very similar to nodegroups, although you can use python and events to build/modify them, or even change the node’s interface automatically.

I did some python nodes which could be added in the material panel
but this did not allow to make modif ounce it is added.
could be possible but would require to go into edit mode for the new node in the node tree - and that is a lot more coding

this was more like adding a primitive material

so not certain if it will be more flexible !
hope you can show some sample file with such a new nodes for 2.8

thanks
happy bl