HighMap library (C++)
Loading...
Searching...
No Matches
coherent_noise.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  hmap
 
namespace  hmap::gpu
 

Enumerations

enum  hmap::VoronoiReturnType : int {
  hmap::F1_SQUARED , hmap::F2_SQUARED , hmap::F1TF2_SQUARED , hmap::F1DF2_SQUARED ,
  hmap::F2MF1_SQUARED , hmap::EDGE_DISTANCE_EXP , hmap::EDGE_DISTANCE_SQUARED , hmap::CONSTANT ,
  hmap::CONSTANT_F2MF1_SQUARED
}
 Selects the value returned by the Voronoi evaluation. More...
 

Functions

Array hmap::dendry (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, Array &control_function, float eps=0.05, int resolution=1, float displacement=0.075, int primitives_resolution_steps=3, float slope_power=2.f, float noise_amplitude_proportion=0.01, bool add_control_function=true, float control_function_overlap=0.5f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, int subsampling=1)
 Dendry is a locally computable procedural function that generates branching patterns at various scales (see [Gaillard2019]).
 
Array hmap::dendry (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, NoiseFunction &noise_function, float noise_function_offset=0.f, float noise_function_scaling=1.f, float eps=0.05, int resolution=1, float displacement=0.075, int primitives_resolution_steps=3, float slope_power=2.f, float noise_amplitude_proportion=0.01, bool add_control_function=true, float control_function_overlap=0.5f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 
Array hmap::diffusion_limited_aggregation (glm::ivec2 shape, float scale, std::uint32_t seed, float seeding_radius=0.4f, float seeding_outer_radius_ratio=0.2f, float slope=8.f, float noise_ratio=0.2f)
 Generates a diffusion-limited aggregation (DLA) pattern.
 
Array hmap::diffusion_limited_aggregation_trimesh (glm::ivec2 shape, std::uint32_t seed, size_t control_points_count=5000, glm::vec2 seed_position={0.5f, 0.5f}, float ratio=0.98f, float stop_proba=1.f, float slope=16.f, InterpolationMethod2D interpolation_method=InterpolationMethod2D::ITP2D_DELAUNAY_GRADIENT, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr)
 
Array hmap::gabor_noise (glm::ivec2 shape, float kw, float angle, int width, float density, std::uint32_t seed)
 Return a sparse Gabor noise.
 
Array hmap::noise (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence noise.
 
Array hmap::noise_fbm (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence fbm noise.
 
Array hmap::noise_iq (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, float gradient_scale=0.05f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence fbm noise.
 
Array hmap::noise_jordan (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, float warp0=0.4f, float damp0=1.f, float warp_scale=0.4f, float damp_scale=1.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence fbm noise.
 
Array hmap::noise_parberry (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, float mu=1.02f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherent fbm Parberry variant of Perlin noise.
 
Array hmap::noise_pingpong (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence fbm pingpong noise.
 
Array hmap::noise_ridged (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, float k_smoothing=0.1f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence fbm ridged noise.
 
Array hmap::noise_swiss (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, float warp_scale=0.1f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence fbm swiss noise.
 
Array hmap::worley_double (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float ratio=0.5f, float k=0.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with the maximum of two Worley (cellular) noises.
 
Array hmap::gpu::gabor_wave (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, const Array &angle, float angle_spread_ratio=1.f, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence Gabor noise.
 
Array hmap::gpu::gabor_wave (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float angle=0.f, float angle_spread_ratio=1.f, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 
Array hmap::gpu::gabor_wave_fbm (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, const Array &angle, float angle_spread_ratio=1.f, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence Gabor noise.
 
Array hmap::gpu::gabor_wave_fbm (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float angle=0.f, float angle_spread_ratio=1.f, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 
Array hmap::gpu::gavoronoise (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, const Array &angle, float amplitude=0.05f, float angle_spread_ratio=1.f, glm::vec2 kw_multiplier={4.f, 4.f}, float slope_strength=1.f, float branch_strength=2.f, float z_cut_min=0.2f, float z_cut_max=1.f, int octaves=8, float persistence=0.4f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Generates a 2D array using the GavoroNoise algorithm, which is a procedural noise technique for terrain generation and other applications.
 
Array hmap::gpu::gavoronoise (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float angle=0.f, float amplitude=0.05f, float angle_spread_ratio=1.f, glm::vec2 kw_multiplier={4.f, 4.f}, float slope_strength=1.f, float branch_strength=2.f, float z_cut_min=0.2f, float z_cut_max=1.f, int octaves=8, float persistence=0.4f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 
Array hmap::gpu::gavoronoise (const Array &base, glm::vec2 kw, std::uint32_t seed, float amplitude=0.05f, glm::vec2 kw_multiplier={4.f, 4.f}, float slope_strength=1.f, float branch_strength=2.f, float z_cut_min=0.2f, float z_cut_max=1.f, int octaves=8, float persistence=0.4f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 
Array hmap::gpu::noise (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, glm::ivec2 period={0, 0})
 See hmap::noise. period sets the tiling period in lattice cells. For the heightmap to be periodic with respect to the full domain, period must be equal to the wavenumber kw, i.e. period = {round(kw.x), round(kw.y)}; a smaller period makes the pattern repeat within the domain. A component <= 0 disables wrapping on that axis (default {0, 0}: non-periodic). Tiling is exact only for lattice noise types with integer kw; simplex is never wrapped.
 
Array hmap::gpu::noise_fbm (NoiseType noise_type, glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, glm::ivec2 period={0, 0})
 See hmap::noise_fbm. period sets the tiling period in lattice cells for the base octave. For the heightmap to be periodic with respect to the full domain, period must be equal to the wavenumber kw, i.e. period = {round(kw.x), round(kw.y)}; a smaller period makes the pattern repeat within the domain. A component <= 0 disables wrapping on that axis (default {0, 0}: non-periodic). Seamless tiling additionally requires an integer lacunarity (the default 2); simplex is never wrapped.
 
Array hmap::gpu::phasor (PhasorProfile phasor_profile, glm::ivec2 shape, float kp_global, std::uint32_t seed, float angle_shift=0.f, int n_kernel_samples=8, const glm::vec2 jitter={1.f, 1.f}, float delta=0.01f, float phase_smoothing=10.f, const Array *p_angle=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Generates a procedural phasor-based pattern.
 
Array hmap::gpu::phasor_fbm (PhasorProfile phasor_profile, glm::ivec2 shape, float kp_global, std::uint32_t seed, float angle_shift=0.f, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, int n_kernel_samples=8, const glm::vec2 jitter={1.f, 1.f}, float delta=0.01f, float phase_smoothing=10.f, const Array *p_angle=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Generates a multi-octave (fBm) phasor-based pattern.
 
Array hmap::gpu::vorolines (glm::ivec2 shape, float density, std::uint32_t seed, float k_smoothing=0.f, float exp_sigma=0.f, float alpha=0.f, float alpha_span=M_PI, VoronoiReturnType return_type=VoronoiReturnType::F1_SQUARED, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, glm::vec4 bbox_points={0.f, 1.f, 0.f, 1.f})
 Generates a Voronoi-based pattern where cells are defined by proximity to random lines.
 
Array hmap::gpu::vorolines_fbm (glm::ivec2 shape, float density, std::uint32_t seed, float k_smoothing=0.f, float exp_sigma=0.f, float alpha=0.f, float alpha_span=M_PI, VoronoiReturnType return_type=VoronoiReturnType::F1_SQUARED, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, glm::vec4 bbox_points={0.f, 1.f, 0.f, 1.f})
 Generates a Voronoi-based pattern using distances to lines defined by random points and angles, with additional fractal Brownian motion (fBm) noise modulation.
 
Array hmap::gpu::voronoi (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, glm::vec2 jitter={0.5f, 0.5f}, float k_smoothing=0.f, float exp_sigma=0.f, VoronoiReturnType return_type=VoronoiReturnType::F1_SQUARED, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Generates a Voronoi diagram in a 2D array with configurable properties.
 
Array hmap::gpu::voronoi_fbm (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, glm::vec2 jitter={0.5f, 0.5f}, float k_smoothing=0.f, float exp_sigma=0.f, VoronoiReturnType return_type=VoronoiReturnType::F1_SQUARED, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Generates a Voronoi diagram in a 2D array with configurable properties.
 
Array hmap::gpu::voronoi_edge_distance (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, glm::vec2 jitter={0.5f, 0.5f}, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Computes the Voronoi edge distance.
 
Array hmap::gpu::voronoise (glm::ivec2 shape, glm::vec2 kw, float u_param, float v_param, std::uint32_t seed, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Generates a 2D Voronoi noise array.
 
Array hmap::gpu::voronoise_fbm (glm::ivec2 shape, glm::vec2 kw, float u_param, float v_param, std::uint32_t seed, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Return an array filled with coherence Voronoise.
 
Array hmap::gpu::vororand (glm::ivec2 shape, float density, float variability, std::uint32_t seed, float k_smoothing=0.f, float exp_sigma=0.f, VoronoiReturnType return_type=VoronoiReturnType::F1_SQUARED, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, glm::vec4 bbox_points={0.f, 1.f, 0.f, 1.f})
 Generates a 2D Voronoi-based scalar field using OpenCL.
 
Array hmap::gpu::vororand (glm::ivec2 shape, const std::vector< float > &xp, const std::vector< float > &yp, float k_smoothing=0.f, float exp_sigma=0.f, VoronoiReturnType return_type=VoronoiReturnType::F1_SQUARED, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 
Array hmap::gpu::wavelet_noise (glm::ivec2 shape, glm::vec2 kw, std::uint32_t seed, float kw_multiplier=2.f, float vorticity=0.f, float density=1.f, int octaves=8, float weight=0.7f, float persistence=0.5f, float lacunarity=2.f, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
 Generates 2D wavelet noise using an OpenCL kernel.
 

Detailed Description

Author
Otto Link (otto..nosp@m.link.nosp@m..bv@g.nosp@m.mail.nosp@m..com)