UV coordinates -> XYZ coordinates?


#1

Hello vvvvlers,

My question is how to get xyz(uvw) coordinates from a texture that is mapped on a sphere.

I try to explain my setup as good I can:
I have a videoIn(cv) node and a contour(cv) node which gives me the the XY coordinates from the brightest pixels from the video. This XY coordinates I use to spawn particles(dx11). It works fine, but now I have to map the videoIn texture on a sphere(PhongDirectional) and I need to transform the contour pixel data from XY space on the sphere coordinates. So that I can spawn the particles on the sphere.

I think about two options:

  1. There is a vvvv node (or combination) that can give me the uv coordinates after I mapped the texture on a sphere.
  2. I have to write kind of a shader to calculate the mapping of my pixel on a sphere by hand.

I’m new too vvvv and hope that I explained it right. Any ideas how to solve this thing?

Best regards
neoshaman


#2

Hey neoshaman,

I gave it a try. It’s a little bit hacky, but could work for your use case:
uv_to_3d_question.zip (8.2 KB)

You will recognize that you will get often more than one point, depending on the Epsilon and the resolution of the sphere.

Maybe someone else here in the forum has a more straightforward approach. Will also think about another solution with a uniqe conversion. But maybe this helps already.


#4

Thanks a lot mate, will try it out asap.


#5

hej,

think about it as a worldmap: if you have XY on the map, you have also latitude and longitude, since you happen to know how the sphere is projected on the flat surface - how the flat texture is wrapped on the sphere and since you probably know the radius of the sphere, you have the exact mathematical solution.

so for your case of a sphere you can use the Cartesian and 2 map nodes, voilà

see attacheduv_question.v4p (20.3 KB)


#6

this might also clear things up:


#7

In case you will only need a solution for a sphere (as you’ve wrote…), Woeis approach is the way to go.

I’ve thought one step further / complicated by searching for a solution with any mesh UV to XYZ conversion. Still wondering what could be a cleaner way to do so.


#8

DOPE! Thanks a lot guys!!!

The sketch from woei is perfect, never thought that it would be that easy, just one node. The only thing I don’t understand is the MapRange of x and y?

I couldn’t transform the sketch form timpernagel to my needs, don’t know exactly why. Maybe because of my very basic beginner knowledge in vvvv. Anyway, thanks a lot for the help!

Peace and Lovvvve
neoshaman


#9

@neoshaman:

the xy mapping is needed, since the random points are between -1|-1 … 1|1 (in the renderer) this texture covers the whole sphere. spherical coordinates however, range between -90 and 90 for latitude and -180 to 180 for longitude (and in vvvv it’s converted to cycles where 360° == 1 cycle).
so x becomes longitude becomes Yaw from the range of -1x … 1x to 1 … 0 (=360°)
and y becomes latitude becomes Pitch from the range of -1y … 1y to 0.75 … 0.25 (=180°)


#10

<3
Thanks mate!!! The things getting clearer in my head.

Cheers


#11

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.