Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying Perlin noise to plane multiple times/ sphere. #479

Open
mhueppe opened this issue Aug 10, 2021 · 1 comment
Open

Applying Perlin noise to plane multiple times/ sphere. #479

mhueppe opened this issue Aug 10, 2021 · 1 comment

Comments

@mhueppe
Copy link

mhueppe commented Aug 10, 2021

Description

Hey!
I have some questions regarding the Perlin noise and the pv.sample_function in general.

  1. How would you go about applying Perlin noise to a sphere? I would like to have a little bit disformed sphere.
  2. Can you apply Perlin noise to a mesh (sphere/plane) multiple times? I would like to have a plane with some rough 'waves' and high detailed noise on top of them (thus having big waves with little waves in them).
  3. What exactly does the third parameter in the frequency do? After playing around with some values I haven't noticed how it affected the noise.

Example Code

These are the two different frequencies/Perlin noises that I would like to apply to one plane. Additionally, it shows the plane they respectively create.


def smooth_and_plot(sampled : pv.core.grid.UniformGrid):
    mesh = sampled.warp_by_scalar('scalars')
    mesh = mesh.extract_surface()

    # clean and smooth a little to reduce perlin noise artifacts
    mesh = mesh.smooth(n_iter=100, inplace=True, relaxation_factor=0.07)
    mesh.plot()


def gravel_plane():
    freq = [180, 180, 50]
    noise = pv.perlin_noise(0.2, freq, (0, 0, 0))
    sampled = pv.sample_function(noise,
                                 bounds=(-10, 2, -10, 10, -10, 10),
                                 dim=(500, 500, 1))

    smooth_and_plot(sampled)


def bumpy_plane():
    freq = [0.5, 0.7, 0]
    noise = pv.perlin_noise(0.5, freq, (-10, -10, -10))
    sampled = pv.sample_function(noise,
                                 bounds=(-10, 2, -10, 10, -10, 10),
                                 dim=(500, 500, 1))

    smooth_and_plot(sampled)
@mhueppe
Copy link
Author

mhueppe commented Aug 15, 2021

My problem was kindly answered by Andras Deak on SO: https://stackoverflow.com/questions/68729394/applying-perlin-noise-to-plane-multiple-times-sphere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant