We are about to switch to a new forum software. Until then we have removed the registration on this forum.
How should I proceed to create a spherical flow field based on a perlin noise? I know how to create a 2d flo field, but how should I turn into a 3d flo field?! Do I need to determinate the angles (Y, Z) values according to a perlin noise before and then use the polar coordinates formula?! thanks in advance for your help!
Answers
"Spherical flow field"? What is that supposed to be? Do you simple mean a 3D flow field (that is simple, just use a third parameter to
noise()
), or something else?Hi Lord of Galaxy, thanks for answering, no I mean to use a 3d flow field on a sphere (to give it polar coordinates), it would look like a sun with circumvolutions on its surface!
I see. This is more maths than programming though.
Not really since I ask myself if I could begin to apply a noise to my angle values and then draw my particles in polar coordinates or if I should do the opposite?! I can post a code to be more accurate...
I'd recommend polar.
I really is more maths, if you have a mathematical model of what you want, programming it is simple enough.
I have the basic programm, but it's quite long, even if the problem is the mathematical model vs the noiseScale/noiseStrength size I guess. Can I post it ?
Sure, why not? If it's less than 1000 lines, it'll do.
like this ?!
Hi kfrajer, are you still around?! Anyway when you have time please have a look at the code and keep me posted. I don't manage to find a way to get a fluid animation where particles move smoothly in different directions...
I have removed the comments with the un-formatted code and the comments regarding how to format the code to make the discussion easier to follow.
Please note that it is possible to edit your comments to format your code rather than re-posting it. But if you do edit your comments please read this first.
ok, thanks quark, I don't use often the forum so I still make some msitakes...
@lolonulu
You don't get many replies because you have a convoluted code. Right now you code is doing something and you want to change its behavior which you have explained initially. However, where to implement all these changes? You need to step back and come up with a simple sketch where you show what you can do, what you have done/tried and then what you would like to do next. A sketch of 30 lines is more manageable than a sketch of 300. Perlin noise is fun as well. I have seen it myself but I haven't explored it in full detail.
Your question is two folded: spherical coordinates and integration with perlin noise. I have a feeling you can handle the second part so we can leave it out of the question for now.
For the first part of the question, have a look at the following post: https://forum.processing.org/two/discussion/comment/92227/#Comment_92227 if you have any question, just continue here so to avoid disturbing disturb previous OPs 8-X
You should consider adding peasycam: http://mrfeinberg.com/peasycam/
It will slow down the animation but at least you will see the whole effect in 3D. Follow these instructions:
Global scope:
Add next lines in setup:
Modify this part of draw to reflect the next changes:
Finally, you need to set the next line in setupGUI:
controlP5.setAutoDraw(false);
Unfortunately, every time you drag any of the sliders, it will move your scene. You can always disable it if that is inconvenient.
Kf
Dear Kf, Thank you very much for your message and help. I have added Peasy, thanks a lot. I think my problem with spherical coordinates is solved (but the link to the post was helpful anyway, thanks), now I have some trouble with the parameters of the perlin noise... Here in the agent class, what should I change to get particles moving in many different directions and not almost in the same direction like now ?! I hope I am clear enough. Not far from this :
Ooooops here is the link missing in the previous comment, it's an example not far from what I'd like to do :
Dear kfrajer, I hope my previous post is clear enough and the code short enough I still haven't found a solution :((
This is implementing perlin using the code quoted on my prev post above. Notice that there are two functions available at the end of draw(). Perlin based on xyz "Cartesian coordinates" and a spherical version. For both, the noise is fed along each dimension independently. Notice that the noise using xyz has the same behavior as the spherical.
In spherical, if you fix zz, you get perlin on a spherical shell aka. movement on a surface of a sphere as defined by the fixed value zz. I believe you already implemented this behavior in your code.
However, I am not sure how to implement the perlin noise as in the video, since it is working with points defining a surface. Would you create a variation of parameters for each point?
Notice in the demo code below I have the ttime variable offset by a non-zero value in some spots. I did this on purpose to force the perlin noise to be "more" different along each dimension. In a long run, this could cause more of a semi-random noise (not truly random ) as variation along each dimensions will be correlated by these values. If I do not offset by these values, then the stepping along each dimension would vary very slow at the chosen running tstep of 0.002. In other words, movement will be along one dimension instead of shifting around the whole volume.
Kf
if you are trying to wrap two meshes or a spiral triangle strip into a sphere for mapping 2d noise, you might consider point spheres.
Related videos:
Other languages:
The Cinder Creative Coding Cookbook has a section (written in C++) on "Creating a spherical flow field with Perlin noise" if you are looking for a brief discussion of principles.
There are also some discussions in Unity forums:
Dear KF, Thank you very much for your message. I miss time now to check out but what you wrote will really help me for sure! Will tell you.
Dear Jeremy, Thank you very much for your message and for the very clear code about point spheres. You are definitely true, I'll go back to the begining a point spheres and then apply the noise in 3D. By the way the 3rd video you've sent is really close to what I am looking for... Thanks