Is it possible to add a vortex or a swirl effect on a sphere?

unreal

#1

I want to add a vortex effect that goes to the inside of a sphere not on its surface.Kinda like this
images
Is it possible or can you only do it on a 2d plane?


#2

Hmm,
So a swirl is technicaly the combined transformation of a vector pointing to the center and a tangent.
in 2d thats easy, there is only one possible tangent, but in 3d your tangent is a plane.
So where in that plane would you expect that tangent?


#3

i want the tangent to be vertical and face the camera


#4

Ah, in that case.

Pixelworldspace - Camera position gives you your camera direction
normalise that camera direction.

Pixelworldspace - sphere centerposition gives you a vector pointing to the center in worldspace.
also normalize that.

cross(camera direction vector, center pointing vector) is the tangent.
cross(planar identifier, camera direction vector) gives you a vector pointing to the inside of the circle that your sphere projects on the screen.

Then just use that tangent and the projected center pointing vector to make your swirl like you would in 2d :smiley:


#5

how can i get the sphere centerposition?


#6

Do you mean object position or particle position?


#7

i mean object position


#8

Well, you euh, you get to decide yourself where you put the sphere right?
Just, that vector,…


#9

What development environment?

Theoretically you shouldn’t need the object position if you know it’s a perfect sphere.
Are you making a shader or a particle system?

If this is a sphere with a shader, your swirl is a panner with the offset accelerated by distance along v.


#10

im making a shader and i want to pan a texture to the center of the sphere without it just panning over the surface of it


#11

i want an effect like this
Screenshot_4
but on a sphere in a shader


#12

What is your dev environment. Unreal?
If it is, then you can set your sphere mesh up such that it always faces the camera. And then you can worry about your UV layout.


#13

and how do i set it up? sorry but i havent worked much with materials


#14

I am confused; How do you envision this texture after ~3 rotations, won’t your texture be unrecognizable from the twirling distortion?

are we just talking about static rotation? or a vortex?what I am getting at is i only see vortex’s doable with flow map

as for projecting the texture onto a sphere – I’d just project 1:1 on UV’s and worry about cam facing geo (not screenspace texturing) but if that’s not your goal perhaps we need to have your goals clarified


#15

Do you mean something like that? It’s made on sphere. Comination of 2 textures one with polarized screen space uv’s and second is just normal texture panning upwards.
vortex


#16

What exactly are polarized screen space UVs? How do you set such things up? I was trying to achieve a similar effect this weekend.


#17

Is this a polar coordinate node right? as in Cartesian -> Polar co-ordinates > filter Photoshop

unreal CartesianToPolar

unity version


#18

Yes that is the effect i want and maybe add a rotator to the polarized texture or a 4 way chaos function to the panning texture


#19

@Torbach yeah, unreal has node that does that too, it’s named VectorToRadial

@DaNuVeu I believe @Kashaar had posted on twitter graph for screen space uv’s with distance scaling. Maybe he will link it if he sees it ;), or you can dig it up yourself.

When you have it, you need to offset it back with add (-0.5,-0.5) node and plug output into vectortoradial node. That goes into panner in which you can rotate texture or pan it inwards/outwards to the center.

Right now I am in travel and will be back home in about 5 hours, so if you will still need help I can post whole graph then.

Edit:
So this is the setup for polarized screen space UV’s.
Inside MF_ScreenSpaceUV is graph from @Kashaar tweet. Make sure to use the updated version with distance scaling.


#20

Sorry for the extremely late response but how can i expose the switch parameters inside the function since i cant find any function input for switch parameters?