Sample Function: Perlin Noise in 3D¶
Here we use
pyvista.core.imaging.sample_function() to sample
Perlin noise over a region to generate random terrain.
Video games like Minecraft use Perlin noise to create terrain. Here, we create a voxelized mesh similar to a Minecraft “cave”.
import pyvista as pv
Generate Perlin Noise over a 3D StructuredGrid¶
Feel free to change the values of
freq to change the shape of
the “caves”. For example, lowering the frequency will make the
caves larger and more expansive, while a higher frequency in any
direction will make the caves appear more “vein-like” and less open.
Change the threshold to reduce or increase the percent of the terrain that is open or closed
color limits without blue
Total running time of the script: ( 0 minutes 0.167 seconds)