algorithmic modeling for Rhino
Summary:
This is a learning exercise. (and perhaps too long of a problem statement, apologies in advance).
I've been trying to brush up on some python stuff recently and started down a particluar path, based on some awesome work that has already been done by Guilo, (compiled component here):
http://www.food4rhino.com/app/4d-noise
And trying to expand on what has already been expermented with here:
Jake Hibbert
https://www.youtube.com/watch?v=Kyi_K85Gsm4&list=PL5Up_u-XkWgP7...
I wanted to see how to recreate guilo's component in python.
First off, as far as I know, IronPython currently does not have a noise class/function. If it does, please feel free to let me know. As a "work around", I have used this:
https://pypi.python.org/pypi/noise/
grabbed perlin.py and set a path to it for the use of this exercise.
Now, onto the problem at hand:
I can't figure out how to compute something similar to "t". In this case, t = "some domain that will be consirded time", (or for the after effects/trapcode people, perhaps evolution, or flow is a better word).
The process of applying perlin noise, (or simplex noise more accurately), to a given point is relatively straight forward using the attached perlin.py module, as shown below. result of Guilo's component in blue, result of my exercise python component in pink.
I can't figure out the approach to map/compute t? I tried "shift list" type options, (pop), but that didn't yield the effect I was hoping for. Below is what "t" in Guilio's component does.
Here is my stab at it, but I just cant' figure out how to approach t? If anyone has any suggestions, it would be greatly appreciated!
import Rhino as r
import perlin as p
sn = p.SimplexNoise()
pVals = []
for pt in pts: #trying to figure out how to implement t.....offset x/y/z scale somehow?
if t < 0:
noise = sn.noise3(pt.X*scl, pt.Y*scl, pt.Z*scl)
else:
noise = sn.noise3(pt.X*scl, pt.Y*scl, pt.Z*scl)#what's the approach?
pVals.append(noise)
b = pVals
I am attaching perlin.py, (easiest is to place it in a folder in a path specified in your rhino python editor options, module paths), and the gh files.
(also...how do you post/format code blocks in posts?)
Tags:
This discussion is also posted on discourse:
https://discourse.mcneel.com/t/python-implementation-of-perlin-nois...
Thanks Giulio! I'll pick up the discussion over there!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by