2

In this topic Quellenform explains nicely how to get the UVmap from a curve to mesh. On the internet there are also other ways, for example with the use of a spline factor, to get the U and V values for the UVmap.

In most cases I'm using round caps instead of the original caps. I normaly make these with a half UV-sphere and instance them on the start and end position with an Endpoint Selection. The UV-sphere has a built-in UV Map.

I thought it was possible to add the UV-vectors and combine them to one UV-vector.

So far I have not been able to combine the UV map of both the curve and the round caps. Is there a way to do this?

Update:

I've implemented spherical coordinates in the geometry node tree and think I'm almost there. Maybe someone can help me to solve the last piece.

In the figure below you can see how the round caps are generated:

enter image description here

The uv_caps are generated with cartesian to spherical coordinate and the spherical coordinate to cartesian groups. Cartesian to spherical coordinate group has the following node tree:

enter image description here

Spherical coordinate to cartesian group has the next node tree:

enter image description here

However, even though I think I'm close now, I still can't get the right UV map. The pattern isn't matching the curve. I can't get it right, no matter what variables I turn. Some of the results:

enter image description here

enter image description here

I think it should be like this (quick photoshop draw):

enter image description here

This is my blend file (made in Blender 4.1 alpha but also usable in previous versions):

EwSa
  • 585
  • 3
  • 10
  • 1
    You can study this to learn spherical coordinates, then assuming you cut along equator ($0$ elevation), you can set the the polar coordinate (azimuth) to the same UV map coordinate as the one depending on the length of the curve profile, and use elevation as an extension of the same coordinate as the one depending on the length of the main curve. Keep in mind you have to realize caps instances and adjust the latter coordinate depending on curve length. – Markus von Broady Jan 14 '24 at 22:36
  • Tnx a lot! I will study this solution. – EwSa Jan 15 '24 at 05:09
  • @MarkusvonBroady what does they really have to do with this? if it has a uv already, make sure it's lined up properly (so U matches curves') and add some to the curve uv and end according to where the uv ends off and also scale it to it matches up with the curve uv (the radius might be useful for this)..., I think. – shmuel Jan 15 '24 at 23:16
  • @shmuel you're right, the default UV Sphere already is unwrapped like this, so all you need is to scale based on radius. The geonodes primitive node "UV Sphere" also has such UV, though rotated and flipped: https://i.imgur.com/3ki84iz.gif – Markus von Broady Jan 16 '24 at 10:47
  • @MarkusvonBroady: I've made an update (see original question). Maybe you can take a look? – EwSa Jan 20 '24 at 17:14
  • Your 2nd last screenshot is almost good, it's just that you need to rotate one UV by 90°… One way do do this is when you generate the UV for the curve without caps, swap U with V, that is if your U moved along the main curve, and V along the profile curve, make it so the V moves along the main curve, and U along the profile curve. Then there will be just a matter of scaling the caps to match the radius of the sphere and offsetting one cap to start before 0 to fit the beginning of the curve, and offsetting the other based on length of the curve... – Markus von Broady Jan 20 '24 at 18:14
  • @MarkusvonBroady: switching the U and V gives the same result of the UV map of the main curve. I've also tried the built-in UV output of the icosphere as an input of the Cartesian to spherical coordinate group instead of the position input node. This gives a nice checker texture, almost the same as my last screenshot, but again rotated 90 degrees. – EwSa Jan 21 '24 at 13:38

1 Answers1

2

I'm unfortunately short on time, which is why I can only respond briefly for now, but I would still like to share the blend file with you...

If you want to use the hemispheres with their existing UVs, you would simply have to scale them accordingly (and possibly rotate them), as already mentioned in the comments.

Depending on what exactly you want to do with them and which parameters should remain flexible, you can solve this by multiplying $U$ by the circle resolution and $V$ by the number of rings/3 of your hemisphere, for example:

PS: Also note that in your setup you only instantiate the hemispheres at the end points and not at every point of the curve.


(Blender 4.0.2+)

quellenform
  • 35,177
  • 10
  • 50
  • 133
  • Thank you so much! This is exactly what I was looking for, and a very easy approach :) If you have some time, can you explain me why to divide the number of rings by 3? Finally, If I would like to rotate the UV of the hemispheres, I can simply flip the U and V coördinates. Why can't this be done when mapping the UV coordinates in your setup: https://blender.stackexchange.com/questions/258246/curve-to-mesh-with-uvs-in-blender-3-x ? – EwSa Jan 23 '24 at 19:45