HighMap library (C++)
|
Functions | |
Array | blend_gradients (const Array &array1, const Array &array2, int ir=4) |
See hmap::blend_gradients. | |
Array | blend_poisson_bf (const Array &array1, const Array &array2, const int iterations=500, const Array *p_mask=nullptr) |
Blends two arrays using Poisson blending with a brute-force solver. | |
Array | transfer (const Array &source, const Array &target, int ir, float amplitude, bool target_prefiltering=false) |
See hmap::transfer. | |
Array | accumulation_curvature (const Array &z, int ir) |
See hmap::accumulation_curvature. | |
Array | curvature_horizontal_cross_sectional (const Array &z, int ir) |
See hmap::curvature_horizontal_cross_sectional. | |
Array | curvature_horizontal_plan (const Array &z, int ir) |
See hmap::curvature_horizontal_plan. | |
Array | curvature_horizontal_tangential (const Array &z, int ir) |
See hmap::curvature_horizontal_tangential. | |
Array | curvature_ring (const Array &z, int ir) |
See hmap::curvature_ring. | |
Array | curvature_rotor (const Array &z, int ir) |
See hmap::curvature_rotor. | |
Array | curvature_vertical_longitudinal (const Array &z, int ir) |
See hmap::curvature_vertical_longitudinal. | |
Array | curvature_vertical_profile (const Array &z, int ir) |
See hmap::curvature_vertical_profile. | |
Array | shape_index (const Array &z, int ir) |
See hmap::shape_index. | |
Array | unsphericity (const Array &z, int ir) |
See hmap::unsphericity. | |
void | hydraulic_particle (Array &z, int nparticles, int seed, Array *p_bedrock=nullptr, Array *p_moisture_map=nullptr, Array *p_erosion_map=nullptr, Array *p_deposition_map=nullptr, float c_capacity=10.f, float c_erosion=0.05f, float c_deposition=0.05f, float c_inertia=0.3f, float drag_rate=0.001f, float evap_rate=0.001f, bool post_filtering=false) |
See hmap::hydraulic_particle. | |
void | hydraulic_particle (Array &z, Array *p_mask, int nparticles, int seed, Array *p_bedrock=nullptr, Array *p_moisture_map=nullptr, Array *p_erosion_map=nullptr, Array *p_deposition_map=nullptr, float c_capacity=10.f, float c_erosion=0.05f, float c_deposition=0.05f, float c_inertia=0.3f, float drag_rate=0.001f, float evap_rate=0.001f, bool post_filtering=false) |
See hmap::hydraulic_particle. | |
void | hydraulic_schott (Array &z, int iterations, const Array &talus, float c_erosion=1.f, float c_thermal=0.1f, float c_deposition=0.2f, float flow_acc_exponent=0.8f, float flow_acc_exponent_depo=0.8f, float flow_routing_exponent=1.3f, float thermal_weight=1.5f, float deposition_weight=2.5f, Array *p_flow=nullptr) |
Simulates hydraulic erosion and deposition on a heightmap using the Schott method. | |
void | hydraulic_schott (Array &z, int iterations, const Array &talus, Array *p_mask, float c_erosion=1.f, float c_thermal=0.1f, float c_deposition=0.2f, float flow_acc_exponent=0.8f, float flow_acc_exponent_depo=0.8f, float flow_routing_exponent=1.3f, float thermal_weight=1.5f, float deposition_weight=2.5f, Array *p_flow=nullptr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | hydraulic_stream_log (Array &z, float c_erosion, float talus_ref, int deposition_ir=32, float deposition_scale_ratio=1.f, float gradient_power=0.8f, float gradient_scaling_ratio=1.f, int gradient_prefilter_ir=16, float saturation_ratio=1.f, Array *p_bedrock=nullptr, Array *p_moisture_map=nullptr, Array *p_erosion_map=nullptr, Array *p_deposition_map=nullptr, Array *p_flow_map=nullptr) |
See hmap::hydraulic_stream_log. | |
void | hydraulic_stream_log (Array &z, float c_erosion, float talus_ref, Array *p_mask, int deposition_ir=32, float deposition_scale_ratio=1.f, float gradient_power=0.8f, float gradient_scaling_ratio=1.f, int gradient_prefilter_ir=16, float saturation_ratio=1.f, Array *p_bedrock=nullptr, Array *p_moisture_map=nullptr, Array *p_erosion_map=nullptr, Array *p_deposition_map=nullptr, Array *p_flow_map=nullptr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | rifts (Array &z, const Vec2< float > &kw, float angle, float amplitude, uint seed, float elevation_noise_shift=0.f, float k_smooth_bottom=0.05f, float k_smooth_top=0.05f, float radial_spread_amp=0.2f, float elevation_noise_amp=0.1f, float clamp_vmin=0.f, float remap_vmin=0.f, bool apply_mask=true, bool reverse_mask=false, float mask_gamma=1.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_mask=nullptr, const Vec2< float > ¢er={0.5f, 0.5f}, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f}) |
Applies a "rift" deformation effect to a heightmap array. | |
void | strata (Array &z, float angle, float slope, float gamma, uint seed, bool linear_gamma=true, float kz=1.f, int octaves=4, float lacunarity=2.f, float gamma_noise_ratio=0.5f, float noise_amp=0.4f, const Vec2< float > &noise_kw={4.f, 4.f}, const Vec2< float > &ridge_noise_kw={4.f, 1.2f}, float ridge_angle_shift=45.f, float ridge_noise_amp=0.5f, float ridge_clamp_vmin=0.f, float ridge_remap_vmin=0.f, bool apply_elevation_mask=true, bool apply_ridge_mask=true, float mask_gamma=0.4f, const Array *p_mask=nullptr, const Vec4< float > &bbox={0.f, 1.f, 0.f, 1.f}) |
Applies stratification to a heightfield using directional noise and multiscale gamma transformations. | |
void | thermal (Array &z, const Array &talus, int iterations=10, Array *p_bedrock=nullptr, Array *p_deposition_map=nullptr) |
See hmap::thermal. | |
void | thermal (Array &z, Array *p_mask, const Array &talus, int iterations=10, Array *p_bedrock=nullptr, Array *p_deposition_map=nullptr) |
See hmap::thermal. | |
void | thermal (Array &z, float talus, int iterations=10, Array *p_bedrock=nullptr, Array *p_deposition_map=nullptr) |
See hmap::thermal. | |
void | thermal_auto_bedrock (Array &z, const Array &talus, int iterations=10, Array *p_deposition_map=nullptr) |
See hmap::thermal_auto_bedrock. | |
void | thermal_auto_bedrock (Array &z, Array *p_mask, const Array &talus, int iterations=10, Array *p_deposition_map=nullptr) |
See hmap::thermal_auto_bedrock. | |
void | thermal_auto_bedrock (Array &z, float, int iterations=10, Array *p_deposition_map=nullptr) |
See hmap::thermal_auto_bedrock. | |
void | thermal_inflate (Array &z, const Array &talus, int iterations=10) |
Apply thermal weathering erosion to give a scree like effect. | |
void | thermal_inflate (Array &z, const Array *p_mask, const Array &talus, int iterations=10) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | thermal_rib (Array &z, int iterations, Array *p_bedrock=nullptr) |
See hmap::thermal_rib. | |
void | thermal_ridge (Array &z, const Array &talus, int iterations=10, Array *p_deposition_map=nullptr) |
Apply thermal weathering erosion to give a ridge like effect. | |
void | thermal_ridge (Array &z, const Array *p_mask, const Array &talus, int iterations=10, Array *p_deposition_map=nullptr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | thermal_scree (Array &z, const Array &talus, const Array &zmax, int iterations=10, bool talus_constraint=true, Array *p_deposition_map=nullptr) |
Performs thermal scree erosion on a heightmap. | |
void | thermal_scree (Array &z, const Array *p_mask, const Array &talus, const Array &zmax, int iterations=10, bool talus_constraint=true, Array *p_deposition_map=nullptr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Array | local_median_deviation (const Array &array, int ir) |
See hmap::local_median_deviation. | |
Array | mean_local (const Array &array, int ir) |
See hmap::mean_local. | |
Array | relative_elevation (const Array &array, int ir) |
See hmap::relative_elevation. | |
Array | ruggedness (const Array &array, int ir) |
See hmap::ruggedness. | |
Array | rugosity (const Array &z, int ir, bool convex=true) |
See hmap::rugosity. | |
Array | std_local (const Array &array, int ir) |
See hmap::std_local. | |
Array | z_score (const Array &array, int ir) |
See hmap::z_score. | |
void | expand (Array &array, int ir, int iterations=1) |
See hmap::expand. | |
void | expand (Array &array, int ir, const Array *p_mask, int iterations=1) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | expand (Array &array, const Array &kernel, int iterations=1) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | expand (Array &array, const Array &kernel, const Array *p_mask, int iterations=1) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | gamma_correction_local (Array &array, float gamma, int ir, float k=0.1f) |
See hmap::gamma_correction_local. | |
void | gamma_correction_local (Array &array, float gamma, int ir, const Array *p_mask, float k=0.1f) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | laplace (Array &array, float sigma=0.2f, int iterations=3) |
See hmap::laplace. | |
void | laplace (Array &array, const Array *p_mask, float sigma=0.2f, int iterations=3) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Array | maximum_local (const Array &array, int ir) |
See hmap::maximum_local. | |
Array | maximum_local_disk (const Array &array, int ir) |
See hmap::maximum_local_disk. | |
Array | mean_shift (const Array &array, int ir, float talus, int iterations=1, bool talus_weighted=true) |
See hmap::mean_shift. | |
Array | mean_shift (const Array &array, int ir, float talus, const Array *p_mask, int iterations=1, bool talus_weighted=true) |
void | median_3x3 (Array &array) |
See hmap::median_3x3. | |
void | median_3x3 (Array &array, const Array *p_mask) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Array | median_pseudo (const Array &array, int ir) |
See hmap::median_pseudo. | |
Array | minimum_local (const Array &array, int ir) |
See hmap::minimum_local. | |
Array | minimum_local_disk (const Array &array, int ir) |
See hmap::minimum_local_disk. | |
void | normal_displacement (Array &array, float amount=0.1f, int ir=0, bool reverse=false) |
See hmap::normal_displacement. | |
void | normal_displacement (Array &array, const Array *p_mask, float amount=0.1f, int ir=0, bool reverse=false) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | plateau (Array &array, const Array *p_mask, int ir, float factor) |
See hmap::plateau. | |
void | plateau (Array &array, int ir, float factor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | shrink (Array &array, int ir, int iterations=1) |
See hmap::shrink. | |
void | shrink (Array &array, int ir, const Array *p_mask, int iterations=1) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | shrink (Array &array, const Array &kernel, int iterations=1) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | shrink (Array &array, const Array &kernel, const Array *p_mask, int iterations=1) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | smooth_cpulse (Array &array, int ir) |
See hmap::smooth_cpulse. | |
void | smooth_cpulse (Array &array, int ir, const Array *p_mask) |
See hmap::smooth_cpulse. | |
void | smooth_cpulse_edge_removing (Array &array, float talus, float talus_width, int ir) |
See hmap::smooth_cpulse_edge_removing. | |
void | smooth_fill (Array &array, int ir, float k=0.1f, Array *p_deposition_map=nullptr) |
See hmap::smooth_fill. | |
void | smooth_fill (Array &array, int ir, const Array *p_mask, float k=0.1f, Array *p_deposition_map=nullptr) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | smooth_fill_holes (Array &array, int ir) |
See hmap::smooth_fill_holes. | |
void | smooth_fill_holes (Array &array, int ir, const Array *p_mask) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | smooth_fill_smear_peaks (Array &array, int ir) |
See hmap::smooth_fill_smear_peaks. | |
void | smooth_fill_smear_peaks (Array &array, int ir, const Array *p_mask) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Array | gradient_norm (const Array &array) |
See hmap::gradient_norm. | |
Array | flow_direction_d8 (const Array &z) |
See hmap::flow_direction_d8. | |
Array | generate_riverbed (const Path &path, Vec2< int > shape, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, bool bezier_smoothing=false, float depth_start=0.01f, float depth_end=1.f, float slope_start=64.f, float slope_end=32.f, float shape_exponent_start=1.f, float shape_exponent_end=10.f, float k_smoothing=0.5f, int post_filter_ir=0, Array *p_noise_x=nullptr, Array *p_noise_y=nullptr, Array *p_noise_r=nullptr) |
See hmap::generate_riverbed. | |
void | interpolate_array_bicubic (const Array &source, Array &target) |
void | interpolate_array_bicubic (const Array &source, Array &target, const Vec4< float > &bbox_source, const Vec4< float > &bbox_target) |
void | interpolate_array_bilinear (const Array &source, Array &target) |
void | interpolate_array_bilinear (const Array &source, Array &target, const Vec4< float > &bbox_source, const Vec4< float > &bbox_target) |
void | interpolate_array_lagrange (const Array &source, Array &target, int order) |
void | interpolate_array_nearest (const Array &source, Array &target) |
void | interpolate_array_nearest (const Array &source, Array &target, const Vec4< float > &bbox_source, const Vec4< float > &bbox_target) |
Array | border (const Array &array, int ir) |
See hmap::border. | |
Array | closing (const Array &array, int ir) |
See hmap::closing. | |
Array | dilation (const Array &array, int ir) |
See hmap::dilation. | |
Array | dilation_expand_border_only (const Array &array, int ir) |
See hmap::dilation_expand_border_only. | |
Array | erosion (const Array &array, int ir) |
See hmap::erosion. | |
Array | morphological_black_hat (const Array &array, int ir) |
See hmap::morphological_black_hat. | |
Array | morphological_gradient (const Array &array, int ir) |
See hmap::morphological_gradient. | |
Array | morphological_top_hat (const Array &array, int ir) |
See hmap::morphological_top_hat. | |
Array | opening (const Array &array, int ir) |
See hmap::opening. | |
Array | relative_distance_from_skeleton (const Array &array, int ir_search, bool zero_at_borders=true, int ir_erosion=1) |
See hmap::relative_distance_from_skeleton. | |
Array | skeleton (const Array &array, bool zero_at_borders=true) |
See hmap::skeleton. | |
void | helper_bind_optional_buffer (clwrapper::Run &run, const std::string &id, const Array *p_array) |
bool | init_opencl () |
Array | badlands (Vec2< int > shape, Vec2< float > kw, uint seed, int octaves=8, float rugosity=0.2f, float angle=30.f, float k_smoothing=0.1f, float base_noise_amp=0.2f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a synthetic "badlands" terrain heightmap. | |
Array | basalt_field (Vec2< int > shape, Vec2< float > kw, uint seed, float warp_kw=4.f, float large_scale_warp_amp=0.2f, float large_scale_gain=6.f, float large_scale_amp=0.2f, float medium_scale_kw_ratio=3.f, float medium_scale_warp_amp=1.f, float medium_scale_gain=7.f, float medium_scale_amp=0.08f, float small_scale_kw_ratio=10.f, float small_scale_amp=0.1f, float small_scale_overlay_amp=0.002f, float rugosity_kw_ratio=1.f, float rugosity_amp=1.f, bool flatten_activate=true, float flatten_kw_ratio=1.f, float flatten_amp=0.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a synthetic procedural terrain resembling basaltic landforms. | |
Array | gabor_wave (Vec2< int > shape, Vec2< float > kw, uint seed, const Array &angle, float angle_spread_ratio=1.f, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Return an array filled with coherence Gabor noise. | |
Array | gabor_wave (Vec2< int > shape, Vec2< float > kw, uint seed, float angle=0.f, float angle_spread_ratio=1.f, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Array | gabor_wave_fbm (Vec2< int > shape, Vec2< float > kw, uint 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Return an array filled with coherence Gabor noise. | |
Array | gabor_wave_fbm (Vec2< int > shape, Vec2< float > kw, uint 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Array | gavoronoise (Vec2< int > shape, Vec2< float > kw, uint seed, const Array &angle, float amplitude=0.05f, float angle_spread_ratio=1.f, Vec2< float > 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, Vec4< float > 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 | gavoronoise (Vec2< int > shape, Vec2< float > kw, uint seed, float angle=0.f, float amplitude=0.05f, float angle_spread_ratio=1.f, Vec2< float > 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Array | gavoronoise (const Array &base, Vec2< float > kw, uint seed, float amplitude=0.05f, Vec2< float > 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Array | mountain_inselberg (Vec2< int > shape, uint seed, float scale=1.f, int octaves=8, float rugosity=0.2f, float angle=45.f, float gamma=1.1f, bool round_shape=false, bool add_deposition=true, float bulk_amp=0.2f, float base_noise_amp=0.2f, float k_smoothing=0.1f, Vec2< float > center={0.5f, 0.5f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a synthetic mountain-like inselberg (isolated hill) heightmap. | |
Array | mountain_range_radial (Vec2< int > shape, Vec2< float > kw, uint seed, float half_width=0.2f, float angle_spread_ratio=0.5f, float core_size_ratio=1.f, Vec2< float > center={0.5f, 0.5f}, 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_angle=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a heightmap representing a radial mountain range. | |
Array | mountain_stump (Vec2< int > shape, uint seed, float scale=1.f, int octaves=8, float peak_kw=6.f, float rugosity=0.f, float angle=45.f, float k_smoothing=0.f, float gamma=0.25f, bool add_deposition=true, float ridge_amp=0.75f, float base_noise_amp=0.1f, Vec2< float > center={0.5f, 0.5f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a mountain-like heightmap with a flattened (stump-shaped) peak. | |
Array | mountain_tibesti (Vec2< int > shape, uint seed, float scale=1.f, int octaves=8, float peak_kw=20.f, float rugosity=0.f, float angle=30.f, float angle_spread_ratio=0.25f, float gamma=1.f, bool add_deposition=true, float bulk_amp=1.f, float base_noise_amp=0.1f, Vec2< float > center={0.5f, 0.5f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a synthetic "Tibesti" mountain heightmap. | |
Array | noise (NoiseType noise_type, Vec2< int > shape, Vec2< float > kw, uint seed, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
See hmap::noise. | |
Array | noise_fbm (NoiseType noise_type, Vec2< int > shape, Vec2< float > kw, uint 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
See hmap::noise_fbm. | |
Array | polygon_field (Vec2< int > shape, Vec2< float > kw, uint seed, float rmin=0.05f, float rmax=0.8f, float clamping_dist=0.1f, float clamping_k=0.1f, int n_vertices_min=3, int n_vertices_max=16, float density=0.5f, hmap::Vec2< float > jitter={0.5f, 0.5f}, float shift=0.1f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_noise_distance=nullptr, const Array *p_density_multiplier=nullptr, const Array *p_size_multiplier=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a scalar field representing the signed distance to randomly generated polygons. | |
Array | polygon_field_fbm (Vec2< int > shape, Vec2< float > kw, uint seed, float rmin=0.05f, float rmax=0.8f, float clamping_dist=0.1f, float clamping_k=0.1f, int n_vertices_min=3, int n_vertices_max=16, float density=0.1f, hmap::Vec2< float > jitter={0.5f, 0.5f}, float shift=0.1f, int octaves=8, float persistence=0.5f, float lacunarity=2.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_noise_distance=nullptr, const Array *p_density_multiplier=nullptr, const Array *p_size_multiplier=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a scalar field representing the signed distance to randomly generated polygons combined with fractal Brownian motion (fBm) noise modulation. | |
Array | shattered_peak (Vec2< int > shape, uint seed, float scale=1.f, int octaves=8, float peak_kw=4.f, float rugosity=0.f, float angle=30.f, float gamma=1.f, bool add_deposition=true, float bulk_amp=0.3f, float base_noise_amp=0.1f, float k_smoothing=0.f, Vec2< float > center={0.5f, 0.5f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a synthetic "shattered peak" terrain heightmap. | |
Array | vorolines (Vec2< int > shape, float density, uint 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, Vec4< float > 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 | vorolines_fbm (Vec2< int > shape, float density, uint 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, Vec4< float > 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 | voronoi (Vec2< int > shape, Vec2< float > kw, uint seed, Vec2< float > 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a Voronoi diagram in a 2D array with configurable properties. | |
Array | voronoi_fbm (Vec2< int > shape, Vec2< float > kw, uint seed, Vec2< float > 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a Voronoi diagram in a 2D array with configurable properties. | |
Array | voronoi_edge_distance (Vec2< int > shape, Vec2< float > kw, uint seed, Vec2< float > jitter={0.5f, 0.5f}, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Computes the Voronoi edge distance. | |
Array | voronoise (Vec2< int > shape, Vec2< float > kw, float u_param, float v_param, uint seed, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Generates a 2D Voronoi noise array. | |
Array | voronoise_fbm (Vec2< int > shape, Vec2< float > kw, float u_param, float v_param, uint 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Return an array filled with coherence Voronoise. | |
Array | vororand (Vec2< int > shape, float density, float variability, uint 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, Vec4< float > bbox_points={0.f, 1.f, 0.f, 1.f}) |
Generates a 2D Voronoi-based scalar field using OpenCL. | |
Array | vororand (Vec2< int > 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, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}) |
Array | maximum_smooth (const Array &array1, const Array &array2, float k=0.2f) |
See hmap::maximum_smooth. | |
Array | minimum_smooth (const Array &array1, const Array &array2, float k=0.2f) |
See hmap::minimum_smooth. | |
Array | sdf_2d_polyline (const Path &path, Vec2< int > shape, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr) |
See hmap::sdf_2d_polyline. | |
Array | sdf_2d_polyline_bezier (const Path &path, Vec2< int > shape, Vec4< float > bbox={0.f, 1.f, 0.f, 1.f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr) |
See hmap::sdf_2d_polyline_bezier. | |
Array | select_valley (const Array &z, int ir, bool zero_at_borders=true, bool ridge_select=false) |
See hmap::select_valley. | |
void | rotate (Array &array, float angle, bool zoom_in=true) |
See hmap::rotate. | |
void | warp (Array &array, const Array *p_dx, const Array *p_dy) |
See hmap::warp. | |
Vec4< float > | helper_transform_bbox (const Vec4< float > &bbox_source, const Vec4< float > &bbox_target) |
void | helper_bind_optional_buffers (clwrapper::Run &run, const Array *p_noise_x, const Array *p_noise_y) |
Array hmap::gpu::blend_poisson_bf | ( | const Array & | array1, |
const Array & | array2, | ||
const int | iterations = 500 , |
||
const Array * | p_mask = nullptr |
||
) |
Blends two arrays using Poisson blending with a brute-force solver.
This function performs Poisson blending between array1
and array2
over a specified number of iterations. Optionally, a mask can be provided to control the blending regions.
array1 | The first input array. |
array2 | The second input array. |
iterations | The number of iterations for the blending process (default: 500). |
p_mask | Optional pointer to an array defining the blending mask. If null, blending is applied globally. |
Example
Result
Array hmap::gpu::transfer | ( | const Array & | source, |
const Array & | target, | ||
int | ir, | ||
float | amplitude, | ||
bool | target_prefiltering = false |
||
) |
See hmap::transfer.
See hmap::curvature_ring.
See hmap::shape_index.
See hmap::unsphericity.
void hmap::gpu::hydraulic_particle | ( | Array & | z, |
int | nparticles, | ||
int | seed, | ||
Array * | p_bedrock = nullptr , |
||
Array * | p_moisture_map = nullptr , |
||
Array * | p_erosion_map = nullptr , |
||
Array * | p_deposition_map = nullptr , |
||
float | c_capacity = 10.f , |
||
float | c_erosion = 0.05f , |
||
float | c_deposition = 0.05f , |
||
float | c_inertia = 0.3f , |
||
float | drag_rate = 0.001f , |
||
float | evap_rate = 0.001f , |
||
bool | post_filtering = false |
||
) |
void hmap::gpu::hydraulic_particle | ( | Array & | z, |
Array * | p_mask, | ||
int | nparticles, | ||
int | seed, | ||
Array * | p_bedrock = nullptr , |
||
Array * | p_moisture_map = nullptr , |
||
Array * | p_erosion_map = nullptr , |
||
Array * | p_deposition_map = nullptr , |
||
float | c_capacity = 10.f , |
||
float | c_erosion = 0.05f , |
||
float | c_deposition = 0.05f , |
||
float | c_inertia = 0.3f , |
||
float | drag_rate = 0.001f , |
||
float | evap_rate = 0.001f , |
||
bool | post_filtering = false |
||
) |
void hmap::gpu::hydraulic_schott | ( | Array & | z, |
int | iterations, | ||
const Array & | talus, | ||
float | c_erosion = 1.f , |
||
float | c_thermal = 0.1f , |
||
float | c_deposition = 0.2f , |
||
float | flow_acc_exponent = 0.8f , |
||
float | flow_acc_exponent_depo = 0.8f , |
||
float | flow_routing_exponent = 1.3f , |
||
float | thermal_weight = 1.5f , |
||
float | deposition_weight = 2.5f , |
||
Array * | p_flow = nullptr |
||
) |
Simulates hydraulic erosion and deposition on a heightmap using the Schott method.
This function performs hydraulic erosion on the given heightmap z
over a specified number of iterations. It includes parameters for controlling erosion, deposition, and flow routing. Optional flow accumulation can also be computed and stored in the p_flow
array.
[in,out] | z | The heightmap array to be modified. Heights are updated in-place. |
[in] | iterations | The number of iterations for the hydraulic erosion process. |
[in] | talus | An array defining the slope threshold for erosion. |
[in] | c_erosion | Erosion coefficient (default: 1.0f). |
[in] | c_thermal | Thermal erosion coefficient (default: 0.1f). |
[in] | c_deposition | Deposition coefficient (default: 0.2f). |
[in] | flow_acc_exponent | Exponent controlling the influence of flow accumulation on erosion (default: 0.8f). |
[in] | flow_acc_exponent_depo | Exponent controlling the influence of flow accumulation on deposition (default: 0.8f). |
[in] | flow_routing_exponent | Exponent controlling flow routing behavior (default: 1.3f). |
[in] | thermal_weight | Weight of thermal erosion effects (default: 1.5f). |
[in] | deposition_weight | Weight of deposition effects (default: 2.5f). |
[out] | p_flow | Optional pointer to an array for storing flow accumulation data. If null, flow data is not returned (default: nullptr). |
Example
Result
void hmap::gpu::hydraulic_schott | ( | Array & | z, |
int | iterations, | ||
const Array & | talus, | ||
Array * | p_mask, | ||
float | c_erosion = 1.f , |
||
float | c_thermal = 0.1f , |
||
float | c_deposition = 0.2f , |
||
float | flow_acc_exponent = 0.8f , |
||
float | flow_acc_exponent_depo = 0.8f , |
||
float | flow_routing_exponent = 1.3f , |
||
float | thermal_weight = 1.5f , |
||
float | deposition_weight = 2.5f , |
||
Array * | p_flow = nullptr |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::hydraulic_stream_log | ( | Array & | z, |
float | c_erosion, | ||
float | talus_ref, | ||
int | deposition_ir = 32 , |
||
float | deposition_scale_ratio = 1.f , |
||
float | gradient_power = 0.8f , |
||
float | gradient_scaling_ratio = 1.f , |
||
int | gradient_prefilter_ir = 16 , |
||
float | saturation_ratio = 1.f , |
||
Array * | p_bedrock = nullptr , |
||
Array * | p_moisture_map = nullptr , |
||
Array * | p_erosion_map = nullptr , |
||
Array * | p_deposition_map = nullptr , |
||
Array * | p_flow_map = nullptr |
||
) |
void hmap::gpu::hydraulic_stream_log | ( | Array & | z, |
float | c_erosion, | ||
float | talus_ref, | ||
Array * | p_mask, | ||
int | deposition_ir = 32 , |
||
float | deposition_scale_ratio = 1.f , |
||
float | gradient_power = 0.8f , |
||
float | gradient_scaling_ratio = 1.f , |
||
int | gradient_prefilter_ir = 16 , |
||
float | saturation_ratio = 1.f , |
||
Array * | p_bedrock = nullptr , |
||
Array * | p_moisture_map = nullptr , |
||
Array * | p_erosion_map = nullptr , |
||
Array * | p_deposition_map = nullptr , |
||
Array * | p_flow_map = nullptr |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::rifts | ( | Array & | z, |
const Vec2< float > & | kw, | ||
float | angle, | ||
float | amplitude, | ||
uint | seed, | ||
float | elevation_noise_shift = 0.f , |
||
float | k_smooth_bottom = 0.05f , |
||
float | k_smooth_top = 0.05f , |
||
float | radial_spread_amp = 0.2f , |
||
float | elevation_noise_amp = 0.1f , |
||
float | clamp_vmin = 0.f , |
||
float | remap_vmin = 0.f , |
||
bool | apply_mask = true , |
||
bool | reverse_mask = false , |
||
float | mask_gamma = 1.f , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
const Array * | p_mask = nullptr , |
||
const Vec2< float > & | center = {0.5f, 0.5f} , |
||
const Vec4< float > & | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Applies a "rift" deformation effect to a heightmap array.
This function modifies the given heightmap by introducing linear or radial "rift-like" noise patterns. The deformation can be controlled by several parameters such as direction, amplitude, noise shifts, and optional external noise arrays. Optionally, the effect can be masked using a power-based blending function.
z | Reference to the heightmap array to be modified in-place. |
kw | Frequency vector (kx, ky) scaling the deformation in X and Y directions. |
angle | Orientation of the rift in degrees (0° = horizontal, 90° = vertical). |
amplitude | Strength of the rift deformation applied to the heightmap. |
seed | Random seed used for deterministic noise generation. |
elevation_noise_shift | Vertical offset applied to the base noise to shift elevation influence. |
k_smooth_bottom | Lower smoothing factor for Voronoi-based noise computation. |
k_smooth_top | Upper smoothing factor for Voronoi-based noise computation. |
radial_spread_amp | Amplitude controlling radial spreading away from the rift axis. |
elevation_noise_amp | Amplitude scaling the influence of the heightmap's initial values as noise input. |
clamp_vmin | Minimum clamp value for the Voronoi noise before remapping. |
remap_vmin | Minimum remap value for scaling noise output. |
apply_mask | If true, applies a power-based blending mask instead of a direct overwrite. |
mask_gamma | Gamma exponent used when applying the mask to control blending. |
p_noise_x | Optional pointer to an external noise array for X-offset perturbation (nullptr if unused). |
p_noise_y | Optional pointer to an external noise array for Y-offset perturbation (nullptr if unused). |
center | 2D vector specifying the central point around which the rift effect is computed. |
bbox | Bounding box (xmin, xmax, ymin, ymax) defining the spatial domain of the heightmap. |
Example
Result
void hmap::gpu::strata | ( | Array & | z, |
float | angle, | ||
float | slope, | ||
float | gamma, | ||
uint | seed, | ||
bool | linear_gamma = true , |
||
float | kz = 1.f , |
||
int | octaves = 4 , |
||
float | lacunarity = 2.f , |
||
float | gamma_noise_ratio = 0.5f , |
||
float | noise_amp = 0.4f , |
||
const Vec2< float > & | noise_kw = {4.f, 4.f} , |
||
const Vec2< float > & | ridge_noise_kw = {4.f, 1.2f} , |
||
float | ridge_angle_shift = 45.f , |
||
float | ridge_noise_amp = 0.5f , |
||
float | ridge_clamp_vmin = 0.f , |
||
float | ridge_remap_vmin = 0.f , |
||
bool | apply_elevation_mask = true , |
||
bool | apply_ridge_mask = true , |
||
float | mask_gamma = 0.4f , |
||
const Array * | p_mask = nullptr , |
||
const Vec4< float > & | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Applies stratification to a heightfield using directional noise and multiscale gamma transformations.
This function modifies the input heightfield z
by simulating geological strata patterns. It combines directional shifts, fractal noise, and ridge-based perturbations to produce layered structures in the data. The MUST BE NORMALIZED in [0, 1].
z | Reference to the heightfield array to modify, MUST BE NORMALIZED in [0, 1]. |
angle | Horizontal orientation of the strata in degrees. |
slope | Vertical slope of the strata. |
gamma | Gamma exponent for the non-linear remapping (e.g., 0.5 for smoothing, 1.5 for sharpening). |
seed | Seed for deterministic noise generation. |
linear_gamma | If true, applies sharp linear gamma mapping; if false, uses smooth gamma mapping. |
kz | Base scaling factor for the stratification frequency. |
octaves | Number of iterative stratification passes (multiscale detail). |
lacunarity | Frequency multiplier applied at each octave for fractal scaling. |
gamma_noise_ratio | Ratio controlling how noise influences gamma variation (0 = no noise, 1 = full influence). |
noise_amp | Amplitude of the base Perlin noise used to modulate the strata. |
noise_kw | Frequency vector for the base Perlin noise along X and Y axes. |
ridge_noise_kw | Frequency vector for the Voronoi ridge noise (x = main frequency, y = directional frequency). |
ridge_angle_shift | Additional angular shift (in degrees) for the ridge direction, relative to angle . |
ridge_noise_amp | Amplitude of the ridge noise modulation. |
ridge_clamp_vmin | Minimum clamp value for ridge noise response. |
ridge_remap_vmin | Minimum remap value for ridge modulation (used for reverse remapping). |
apply_mask | If true, applied an elevation mask on the effect. |
mask_gamma | Gamma applied to the mask used for blending original and stratified values for the elevation mask. |
p_mask | Optional filter mask, expected in the range [0, 1]. |
bbox | Bounding box of the domain as {xmin, xmax, ymin, ymax} . |
linear_gamma
to false
produces smoother transitions, while true
creates sharper layer boundaries.octaves
adds multiscale detail but also increases computational cost.Example
Result
void hmap::gpu::thermal | ( | Array & | z, |
const Array & | talus, | ||
int | iterations = 10 , |
||
Array * | p_bedrock = nullptr , |
||
Array * | p_deposition_map = nullptr |
||
) |
See hmap::thermal.
void hmap::gpu::thermal | ( | Array & | z, |
Array * | p_mask, | ||
const Array & | talus, | ||
int | iterations = 10 , |
||
Array * | p_bedrock = nullptr , |
||
Array * | p_deposition_map = nullptr |
||
) |
See hmap::thermal.
void hmap::gpu::thermal | ( | Array & | z, |
float | talus, | ||
int | iterations = 10 , |
||
Array * | p_bedrock = nullptr , |
||
Array * | p_deposition_map = nullptr |
||
) |
See hmap::thermal.
Apply thermal weathering erosion to give a scree like effect.
z | Input array. |
talus | Talus limit. |
p_deposition_map | [out] Reference to the deposition map, provided as an output field. |
iterations | Number of iterations. |
Example
Result
void hmap::gpu::thermal_inflate | ( | Array & | z, |
const Array * | p_mask, | ||
const Array & | talus, | ||
int | iterations = 10 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
See hmap::thermal_rib.
void hmap::gpu::thermal_ridge | ( | Array & | z, |
const Array & | talus, | ||
int | iterations = 10 , |
||
Array * | p_deposition_map = nullptr |
||
) |
Apply thermal weathering erosion to give a ridge like effect.
z | Input array. |
talus | Talus limit. |
p_deposition_map | [out] Reference to the deposition map, provided as an output field. |
iterations | Number of iterations. |
Example
Result
void hmap::gpu::thermal_ridge | ( | Array & | z, |
const Array * | p_mask, | ||
const Array & | talus, | ||
int | iterations = 10 , |
||
Array * | p_deposition_map = nullptr |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::thermal_scree | ( | Array & | z, |
const Array & | talus, | ||
const Array & | zmax, | ||
int | iterations = 10 , |
||
bool | talus_constraint = true , |
||
Array * | p_deposition_map = nullptr |
||
) |
Performs thermal scree erosion on a heightmap.
This function applies a thermal erosion process that redistributes material from steeper slopes to flatter areas, simulating talus formation. The process iterates a given number of times to achieve a more stable terrain profile.
[out] | z | The heightmap to be modified in-place by the erosion process. |
[in] | talus | The threshold slope angles that determine where material is moved. |
[in] | zmax | The maximum allowed elevation for erosion effects. |
[in] | iterations | The number of erosion iterations to apply (default: 10). |
[in] | talus_constraint | Whether to enforce a constraint on the talus slope (default: true). |
[out] | p_deposition_map | Optional pointer to an array that stores the deposited material per cell. |
void hmap::gpu::thermal_scree | ( | Array & | z, |
const Array * | p_mask, | ||
const Array & | talus, | ||
const Array & | zmax, | ||
int | iterations = 10 , |
||
bool | talus_constraint = true , |
||
Array * | p_deposition_map = nullptr |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
See hmap::mean_local.
See hmap::ruggedness.
See hmap::rugosity.
See hmap::std_local.
See hmap::z_score.
void hmap::gpu::expand | ( | Array & | array, |
int | ir, | ||
int | iterations = 1 |
||
) |
See hmap::expand.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::expand | ( | Array & | array, |
const Array & | kernel, | ||
const Array * | p_mask, | ||
int | iterations = 1 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::gamma_correction_local | ( | Array & | array, |
float | gamma, | ||
int | ir, | ||
const Array * | p_mask, | ||
float | k = 0.1f |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
See hmap::laplace.
void hmap::gpu::laplace | ( | Array & | array, |
const Array * | p_mask, | ||
float | sigma = 0.2f , |
||
int | iterations = 3 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
See hmap::maximum_local.
Array hmap::gpu::mean_shift | ( | const Array & | array, |
int | ir, | ||
float | talus, | ||
int | iterations = 1 , |
||
bool | talus_weighted = true |
||
) |
See hmap::mean_shift.
Array hmap::gpu::mean_shift | ( | const Array & | array, |
int | ir, | ||
float | talus, | ||
const Array * | p_mask, | ||
int | iterations = 1 , |
||
bool | talus_weighted = true |
||
) |
void hmap::gpu::median_3x3 | ( | Array & | array | ) |
See hmap::median_3x3.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
See hmap::median_pseudo.
See hmap::minimum_local.
void hmap::gpu::normal_displacement | ( | Array & | array, |
const Array * | p_mask, | ||
float | amount = 0.1f , |
||
int | ir = 0 , |
||
bool | reverse = false |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
See hmap::plateau.
void hmap::gpu::plateau | ( | Array & | array, |
int | ir, | ||
float | factor | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::shrink | ( | Array & | array, |
int | ir, | ||
int | iterations = 1 |
||
) |
See hmap::shrink.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::shrink | ( | Array & | array, |
const Array & | kernel, | ||
const Array * | p_mask, | ||
int | iterations = 1 |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::smooth_cpulse | ( | Array & | array, |
int | ir | ||
) |
See hmap::smooth_cpulse.
See hmap::smooth_cpulse.
void hmap::gpu::smooth_cpulse_edge_removing | ( | Array & | array, |
float | talus, | ||
float | talus_width, | ||
int | ir | ||
) |
void hmap::gpu::smooth_fill | ( | Array & | array, |
int | ir, | ||
float | k = 0.1f , |
||
Array * | p_deposition_map = nullptr |
||
) |
See hmap::smooth_fill.
void hmap::gpu::smooth_fill | ( | Array & | array, |
int | ir, | ||
const Array * | p_mask, | ||
float | k = 0.1f , |
||
Array * | p_deposition_map = nullptr |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::smooth_fill_holes | ( | Array & | array, |
int | ir | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::gpu::smooth_fill_smear_peaks | ( | Array & | array, |
int | ir | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
See hmap::gradient_norm.
Array hmap::gpu::generate_riverbed | ( | const Path & | path, |
Vec2< int > | shape, | ||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} , |
||
bool | bezier_smoothing = false , |
||
float | depth_start = 0.01f , |
||
float | depth_end = 1.f , |
||
float | slope_start = 64.f , |
||
float | slope_end = 32.f , |
||
float | shape_exponent_start = 1.f , |
||
float | shape_exponent_end = 10.f , |
||
float | k_smoothing = 0.5f , |
||
int | post_filter_ir = 0 , |
||
Array * | p_noise_x = nullptr , |
||
Array * | p_noise_y = nullptr , |
||
Array * | p_noise_r = nullptr |
||
) |
void hmap::gpu::interpolate_array_bicubic | ( | const Array & | source, |
Array & | target, | ||
const Vec4< float > & | bbox_source, | ||
const Vec4< float > & | bbox_target | ||
) |
void hmap::gpu::interpolate_array_bilinear | ( | const Array & | source, |
Array & | target, | ||
const Vec4< float > & | bbox_source, | ||
const Vec4< float > & | bbox_target | ||
) |
void hmap::gpu::interpolate_array_nearest | ( | const Array & | source, |
Array & | target, | ||
const Vec4< float > & | bbox_source, | ||
const Vec4< float > & | bbox_target | ||
) |
See hmap::border.
See hmap::closing.
See hmap::dilation.
See hmap::erosion.
See hmap::opening.
See hmap::skeleton.
void hmap::gpu::helper_bind_optional_buffer | ( | clwrapper::Run & | run, |
const std::string & | id, | ||
const Array * | p_array | ||
) |
bool hmap::gpu::init_opencl | ( | ) |
Array hmap::gpu::badlands | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
int | octaves = 8 , |
||
float | rugosity = 0.2f , |
||
float | angle = 30.f , |
||
float | k_smoothing = 0.1f , |
||
float | base_noise_amp = 0.2f , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a synthetic "badlands" terrain heightmap.
This function procedurally creates a 2D elevation field resembling badlands (highly eroded terrain with sharp ridges and valleys). It combines fractal noise (FBM) with a Voronoi-based primitive, displaced along a specified orientation.
shape | Output array shape (resolution in x and y). |
kw | Frequency vector controlling the scale of the features. |
seed | Random seed used for noise and Voronoi generation. |
rugosity | Controls roughness of the fractal noise (higher = more irregular). |
angle | Orientation angle (degrees) of terrain displacements. |
k_smoothing | Voronoi smoothing parameter (controls ridge sharpness). |
base_noise_amp | Amplitude of the base displacement noise. |
p_noise_x | Optional pointer to external displacement noise field (X-axis). |
p_noise_y | Optional pointer to external displacement noise field (Y-axis). |
bbox | Bounding box of the generation domain in normalized coordinates. |
Example
Result
Array hmap::gpu::basalt_field | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
float | warp_kw = 4.f , |
||
float | large_scale_warp_amp = 0.2f , |
||
float | large_scale_gain = 6.f , |
||
float | large_scale_amp = 0.2f , |
||
float | medium_scale_kw_ratio = 3.f , |
||
float | medium_scale_warp_amp = 1.f , |
||
float | medium_scale_gain = 7.f , |
||
float | medium_scale_amp = 0.08f , |
||
float | small_scale_kw_ratio = 10.f , |
||
float | small_scale_amp = 0.1f , |
||
float | small_scale_overlay_amp = 0.002f , |
||
float | rugosity_kw_ratio = 1.f , |
||
float | rugosity_amp = 1.f , |
||
bool | flatten_activate = true , |
||
float | flatten_kw_ratio = 1.f , |
||
float | flatten_amp = 0.f , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a synthetic procedural terrain resembling basaltic landforms.
This function creates a multi-scale procedural field combining large, medium, and small-scale Voronoi-based patterns, noise warping, and optional flattening, simulating the morphology of fractured basalt or volcanic terrains. The terrain is constructed using a combination of Voronoi diagrams (via voronoi_fbm
) and fractal noise (noise_fbm
), layered with frequency-domain manipulations and amplitude/gain controls at each scale.
The final output is a heightmap represented as an Array
, normalized and composed of:
shape | Output resolution (width x height) of the field. |
kw | Base wave numbers (frequency) for the terrain features. |
seed | Initial seed used for deterministic random generation. |
warp_kw | Frequency of the warping noise that displaces Voronoi positions. |
large_scale_warp_amp | Amplitude of displacement for large-scale Voronoi warping. |
large_scale_gain | Gain adjustment applied to the large-scale features. |
large_scale_amp | Final amplitude of the large-scale height contribution. |
medium_scale_kw_ratio | Scaling factor for the frequency of the medium-scale patterns. |
medium_scale_warp_amp | Amplitude of warping for the medium-scale displacement. |
medium_scale_gain | Gain control for medium-scale modulation. |
medium_scale_amp | Amplitude of the medium-scale heightmap. |
small_scale_kw_ratio | Frequency ratio for small-scale details. |
small_scale_amp | Amplitude of small-scale pattern contribution. |
small_scale_overlay_amp | Additional overlay strength for repeating the small-scale pattern. |
rugosity_kw_ratio | Frequency ratio for high-frequency noise applied as fine roughness. |
rugosity_amp | Strength of the rugosity (high-frequency modulation). |
flatten_activate | Enables or disables the final flattening operation. |
flatten_kw_ratio | Frequency scaling of the flattening noise field. |
flatten_amp | Amplitude control of the flattening operation. |
p_noise_x | Optional pointer to a noise field used to displace grid coordinates in X. |
p_noise_y | Optional pointer to a noise field used to displace grid coordinates in Y. |
bbox | The 2D bounding box ({xmin, xmax, ymin, ymax}) over which the terrain is generated. |
Array
representing the synthetic basalt-like terrain field.gpu::
namespace.seed
, warp_kw
, and the gain/amplitude values can produce a wide variety of terrain features.Example
Result
Array hmap::gpu::gabor_wave | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
const Array & | angle, | ||
float | angle_spread_ratio = 1.f , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Return an array filled with coherence Gabor noise.
shape | Array shape. |
kw | Noise wavenumbers {kx, ky} for each directions. |
seed | Random seed number. |
angle | Base orientation angle for the Gabor wavelets (in radians). Defaults to 0. |
angle_spread_ratio | Ratio that controls the spread of wave orientations around the base angle. Defaults to 1. |
bbox | Domain bounding box. |
Example
Result
Array hmap::gpu::gabor_wave | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
float | angle = 0.f , |
||
float | angle_spread_ratio = 1.f , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Array hmap::gpu::gabor_wave_fbm | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Return an array filled with coherence Gabor noise.
shape | Array shape. |
kw | Noise wavenumbers {kx, ky} for each directions. |
seed | Random seed number. |
angle | Base orientation angle for the Gabor wavelets (in radians). Defaults to 0. |
angle_spread_ratio | Ratio that controls the spread of wave orientations around the base angle. Defaults to 1. |
octaves | Number of octaves. |
weigth | Octave weighting. |
persistence | Octave persistence. |
lacunarity | Defines the wavenumber ratio between each octaves. |
p_ctrl_param | Reference to the control parameter array (acts as a multiplier for the weight parameter). |
p_noise_x,p_noise_y | Reference to the input noise arrays. |
bbox | Domain bounding box. |
Example
Result
Array hmap::gpu::gabor_wave_fbm | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Array hmap::gpu::gavoronoise | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
const Array & | angle, | ||
float | amplitude = 0.05f , |
||
float | angle_spread_ratio = 1.f , |
||
Vec2< float > | 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 , |
||
Vec4< float > | 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.
shape | Dimensions of the output array. |
kw | Wave number vector controlling the noise frequency. |
seed | Seed value for random number generation. |
amplitude | Amplitude of the noise. |
kw_multiplier | Multiplier for wave numbers in the noise function. |
slope_strength | Strength of slope-based directional erosion in the noise. |
branch_strength | Strength of branch-like structures in the generated noise. |
z_cut_min | Minimum cutoff for Z-value in the noise. |
z_cut_max | Maximum cutoff for Z-value in the noise. |
octaves | Number of octaves for fractal Brownian motion (fBm). |
persistence | Amplitude scaling factor between noise octaves. |
lacunarity | Frequency scaling factor between noise octaves. |
p_ctrl_param | Optional array for control parameters, can modify the Z cutoff dynamically. |
p_noise_x | Optional array for X-axis noise perturbation. |
p_noise_y | Optional array for Y-axis noise perturbation. |
bbox | Bounding box for mapping grid coordinates to world space. |
This function leverages an OpenCL kernel to compute the GavoroNoise values on the GPU, allowing for efficient large-scale generation. The kernel applies a combination of fractal Brownian motion (fBm), directional erosion, and other procedural techniques to generate intricate noise patterns.
The optional p_ctrl_param
, p_noise_x
, and p_noise_y
buffers provide additional flexibility for dynamically adjusting noise parameters and perturbations.
Example
Result
Array hmap::gpu::gavoronoise | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
float | angle = 0.f , |
||
float | amplitude = 0.05f , |
||
float | angle_spread_ratio = 1.f , |
||
Vec2< float > | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Array hmap::gpu::gavoronoise | ( | const Array & | base, |
Vec2< float > | kw, | ||
uint | seed, | ||
float | amplitude = 0.05f , |
||
Vec2< float > | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Array hmap::gpu::mountain_inselberg | ( | Vec2< int > | shape, |
uint | seed, | ||
float | scale = 1.f , |
||
int | octaves = 8 , |
||
float | rugosity = 0.2f , |
||
float | angle = 45.f , |
||
float | gamma = 1.1f , |
||
bool | round_shape = false , |
||
bool | add_deposition = true , |
||
float | bulk_amp = 0.2f , |
||
float | base_noise_amp = 0.2f , |
||
float | k_smoothing = 0.1f , |
||
Vec2< float > | center = {0.5f, 0.5f} , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a synthetic mountain-like inselberg (isolated hill) heightmap.
This function procedurally creates a 2D elevation field resembling an inselberg, using a combination of fractal noise (FBM), Gaussian pulses, and Voronoi-based structures. It allows control over scale, shape, orientation, rugosity, and optional geological-like effects such as bulk uplift and deposition smoothing.
shape | Output array shape (resolution in x and y). |
seed | Random seed used for noise and Voronoi generation. |
scale | Global scaling factor for the inselberg width and structure. |
rugosity | Controls roughness of the fractal noise (higher = more irregular). |
angle | Orientation angle (degrees) for directional displacements. |
gamma | Gamma correction factor applied to the final heightmap. |
round_shape | If true, generates a symmetric round shape; if false, adds directional displacement. |
add_deposition | If true, applies a smoothing fill step simulating sediment deposition. |
bulk_amp | Amplitude of bulk uplift applied to the base pulse (0 = none, >0 = raises and normalizes the feature). |
base_noise_amp | Amplitude of the base displacement noise. |
k_smoothing | Voronoi smoothing parameter (controls ridge sharpness). |
center | Center of the inselberg in normalized coordinates. |
p_noise_x | Optional pointer to external displacement noise field (X-axis). |
p_noise_y | Optional pointer to external displacement noise field (Y-axis). |
bbox | Bounding box of the generation domain in normalized coordinates. |
Example
Result**
Array hmap::gpu::mountain_range_radial | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
float | half_width = 0.2f , |
||
float | angle_spread_ratio = 0.5f , |
||
float | core_size_ratio = 1.f , |
||
Vec2< float > | center = {0.5f, 0.5f} , |
||
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_angle = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a heightmap representing a radial mountain range.
This function creates a heightmap that simulates a mountain range emanating radially from a specified center. The mountain range is influenced by various noise parameters and control attributes.
shape | The dimensions of the output heightmap as a 2D vector. |
kw | The wave numbers (frequency components) as a 2D vector. |
seed | The seed for random noise generation. |
half_width | The half-width of the radial mountain range, controlling its spread. Default is 0.2f. |
angle_spread_ratio | The ratio controlling the angular spread of the mountain range. Default is 0.5f. |
center | The center point of the radial mountain range as normalized coordinates within [0, 1]. Default is {0.5f, 0.5f}. |
octaves | The number of octaves for fractal noise generation. Default is 8. |
weight | The initial weight for noise contribution. Default is 0.7f. |
persistence | The amplitude scaling factor for subsequent noise octaves. Default is 0.5f. |
lacunarity | The frequency scaling factor for subsequent noise octaves. Default is 2.0f. |
p_ctrl_param | Optional pointer to an array of control parameters influencing the terrain generation. |
p_noise_x | Optional pointer to a precomputed noise array for the X-axis. |
p_noise_y | Optional pointer to a precomputed noise array for the Y-axis. |
p_angle | Optional pointer to an array to output the angle. |
bbox | The bounding box of the output heightmap in normalized coordinates [xmin, xmax, ymin, ymax]. Default is {0.0f, 1.0f, 0.0f, 1.0f}. |
Example
Result
Array hmap::gpu::mountain_stump | ( | Vec2< int > | shape, |
uint | seed, | ||
float | scale = 1.f , |
||
int | octaves = 8 , |
||
float | peak_kw = 6.f , |
||
float | rugosity = 0.f , |
||
float | angle = 45.f , |
||
float | k_smoothing = 0.f , |
||
float | gamma = 0.25f , |
||
bool | add_deposition = true , |
||
float | ridge_amp = 0.75f , |
||
float | base_noise_amp = 0.1f , |
||
Vec2< float > | center = {0.5f, 0.5f} , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a mountain-like heightmap with a flattened (stump-shaped) peak.
This function procedurally creates a terrain resembling a broad mountain with a smooth, truncated summit. The result combines layered fractal noise (FBM), Gaussian shaping, and Voronoi-based ridge formation to produce natural-looking geomorphological features. The shape can be modulated by directional displacement noise, smoothed using deposition simulation, and refined through gamma and smoothing parameters.
shape | Dimensions of the output heightmap (width, height). |
seed | Random seed for noise generation. |
scale | Global scale factor controlling the size of features. |
octaves | Number of noise octaves used in FBM generation. |
peak_kw | Base spatial frequency of the main ridge/peak structure. |
rugosity | Controls the roughness of base noise displacements. |
angle | Orientation angle (in degrees) of the main ridge direction. |
k_smoothing | Smoothing coefficient applied to the Voronoi FBM ridges. |
gamma | Gamma correction applied to the ridge intensity. |
add_deposition | If true, applies an additional smoothing pass to simulate sediment deposition. |
ridge_amp | Amplitude scaling factor for ridge prominence. |
base_noise_amp | Amplitude scaling factor for base displacement noise. |
center | Normalized coordinates of the mountain’s center (default domain: [0, 1]²). |
p_noise_x | Optional pointer to horizontal displacement noise (nullptr for none). |
p_noise_y | Optional pointer to vertical displacement noise (nullptr for none). |
bbox | Bounding box of the generated region (xmin, xmax, ymin, ymax). |
Example
Result
Array hmap::gpu::mountain_tibesti | ( | Vec2< int > | shape, |
uint | seed, | ||
float | scale = 1.f , |
||
int | octaves = 8 , |
||
float | peak_kw = 20.f , |
||
float | rugosity = 0.f , |
||
float | angle = 30.f , |
||
float | angle_spread_ratio = 0.25f , |
||
float | gamma = 1.f , |
||
bool | add_deposition = true , |
||
float | bulk_amp = 1.f , |
||
float | base_noise_amp = 0.1f , |
||
Vec2< float > | center = {0.5f, 0.5f} , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a synthetic "Tibesti" mountain heightmap.
This function procedurally creates a 2D elevation field inspired by the Tibesti mountains, a desert volcanic range. The terrain is built by combining Gabor wavelets, fractal simplex noise, and a Gaussian envelope, producing sharp volcanic peaks modulated by erosion-like patterns.
shape | Output array shape (resolution in x and y). |
seed | Random seed used for noise and wavelet generation. |
scale | Global scaling factor controlling the overall mountain size. |
octaves | Number of octaves used in the fractal noise and Gabor FBM. |
peak_kw | Base frequency of the peak features (scaled internally by scale ). |
rugosity | Controls roughness of the fractal noise (higher = more irregular). |
angle | Orientation angle (degrees) for Gabor waves. |
angle_spread_ratio | Spread ratio of the Gabor wave orientation (controls anisotropy). |
gamma | Gamma correction factor applied to auxiliary noise fields. |
add_deposition | If true, applies a smoothing fill step simulating sediment deposition. |
bulk_amp | Amplitude of bulk uplift applied to the peaks (affects normalization with noise weighting). |
base_noise_amp | Amplitude of the base displacement noise. |
center | Center of the mountain in normalized coordinates. |
p_noise_x | Optional pointer to external displacement noise field (X-axis). |
p_noise_y | Optional pointer to external displacement noise field (Y-axis). |
bbox | Bounding box of the generation domain in normalized coordinates. |
Example
Result
Array hmap::gpu::noise | ( | NoiseType | noise_type, |
Vec2< int > | shape, | ||
Vec2< float > | kw, | ||
uint | seed, | ||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
const Array * | p_stretching = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
See hmap::noise.
Array hmap::gpu::noise_fbm | ( | NoiseType | noise_type, |
Vec2< int > | shape, | ||
Vec2< float > | kw, | ||
uint | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
See hmap::noise_fbm.
Array hmap::gpu::polygon_field | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
float | rmin = 0.05f , |
||
float | rmax = 0.8f , |
||
float | clamping_dist = 0.1f , |
||
float | clamping_k = 0.1f , |
||
int | n_vertices_min = 3 , |
||
int | n_vertices_max = 16 , |
||
float | density = 0.5f , |
||
hmap::Vec2< float > | jitter = {0.5f, 0.5f} , |
||
float | shift = 0.1f , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
const Array * | p_noise_distance = nullptr , |
||
const Array * | p_density_multiplier = nullptr , |
||
const Array * | p_size_multiplier = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a scalar field representing the signed distance to randomly generated polygons.
This function procedurally generates a field where each pixel stores the signed distance to the nearest polygon, using a smooth signed distance function (SDF) with optional clamping. The polygons are generated randomly within the specified bounding box, with configurable vertex counts, sizes, jitter, and density. Optionally, displacement noise fields can be applied to polygon positions.
shape | Resolution of the output field (width, height). |
kw | Scaling factor for field coordinates (world units per pixel). |
seed | Random seed for polygon generation. |
rmin | Minimum polygon radius (relative to bbox size). |
rmax | Maximum polygon radius (relative to bbox size). |
clamping_dist | Distance threshold for clamping the SDF value (used to soften edges). |
clamping_k | Smoothness parameter for clamping. |
n_vertices_min | Minimum number of vertices per polygon. |
n_vertices_max | Maximum number of vertices per polygon. |
density | Fraction of pixels covered by polygons (approximate). |
jitter | Random displacement factor applied to polygon vertices. |
shift | Random position shift applied to polygon center. |
p_noise_x | Optional displacement noise field in the X direction (nullptr to disable). |
p_noise_y | Optional displacement noise field in the Y direction (nullptr to disable). |
bbox | Bounding box in normalized coordinates {xmin, xmax, ymin, ymax}. |
Example
Result
Array hmap::gpu::polygon_field_fbm | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
float | rmin = 0.05f , |
||
float | rmax = 0.8f , |
||
float | clamping_dist = 0.1f , |
||
float | clamping_k = 0.1f , |
||
int | n_vertices_min = 3 , |
||
int | n_vertices_max = 16 , |
||
float | density = 0.1f , |
||
hmap::Vec2< float > | jitter = {0.5f, 0.5f} , |
||
float | shift = 0.1f , |
||
int | octaves = 8 , |
||
float | persistence = 0.5f , |
||
float | lacunarity = 2.f , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
const Array * | p_noise_distance = nullptr , |
||
const Array * | p_density_multiplier = nullptr , |
||
const Array * | p_size_multiplier = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a scalar field representing the signed distance to randomly generated polygons combined with fractal Brownian motion (fBm) noise modulation.
Similar to polygon_field(), but the generated SDF is modulated by an fBm noise function to create more natural, irregular shapes. The fBm parameters allow control over the noise persistence, lacunarity, and number of octaves.
shape | Resolution of the output field (width, height). |
kw | Scaling factor for field coordinates (world units per pixel). |
seed | Random seed for polygon generation and fBm noise. |
rmin | Minimum polygon radius (relative to bbox size). |
rmax | Maximum polygon radius (relative to bbox size). |
clamping_dist | Distance threshold for clamping the SDF value (used to soften edges). |
clamping_k | Smoothness parameter for clamping. |
n_vertices_min | Minimum number of vertices per polygon. |
n_vertices_max | Maximum number of vertices per polygon. |
density | Fraction of pixels covered by polygons (approximate). |
jitter | Random displacement factor applied to polygon vertices. |
shift | Random position shift applied to polygon center. |
octaves | Number of fBm octaves. |
persistence | Amplitude decay per octave in fBm. |
lacunarity | Frequency multiplier per octave in fBm. |
p_noise_x | Optional displacement noise field in the X direction (nullptr to disable). |
p_noise_y | Optional displacement noise field in the Y direction (nullptr to disable). |
bbox | Bounding box in normalized coordinates {xmin, xmax, ymin, ymax}. |
Example
Result
Array hmap::gpu::shattered_peak | ( | Vec2< int > | shape, |
uint | seed, | ||
float | scale = 1.f , |
||
int | octaves = 8 , |
||
float | peak_kw = 4.f , |
||
float | rugosity = 0.f , |
||
float | angle = 30.f , |
||
float | gamma = 1.f , |
||
bool | add_deposition = true , |
||
float | bulk_amp = 0.3f , |
||
float | base_noise_amp = 0.1f , |
||
float | k_smoothing = 0.f , |
||
Vec2< float > | center = {0.5f, 0.5f} , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a synthetic "shattered peak" terrain heightmap.
This function procedurally creates a 2D elevation field resembling a sharp, fractured mountain peak. It combines a Gaussian pulse envelope, fractal noise displacements, and Voronoi-based primitives with edge-distance shaping. The result is a rugged peak structure with broken ridges and steep slopes.
shape | Output array shape (resolution in x and y). |
seed | Random seed used for noise and Voronoi generation. |
scale | Global scaling factor controlling the overall peak size. |
peak_kw | Base frequency of the peak features (scaled internally by scale ). |
rugosity | Controls roughness of the fractal noise (higher = more irregular). |
angle | Orientation angle (degrees) for directional displacements. |
gamma | Gamma correction factor applied to the final heightmap. |
add_deposition | If true, applies a smoothing fill step simulating sediment deposition. |
bulk_amp | Amplitude of bulk uplift applied to the peak (internally overridden to 0.5f for normalization). |
base_noise_amp | Amplitude of the base displacement noise. |
k_smoothing | Voronoi smoothing parameter (controls ridge sharpness). |
center | Center of the peak in normalized coordinates. |
p_noise_x | Optional pointer to external displacement noise field (X-axis). |
p_noise_y | Optional pointer to external displacement noise field (Y-axis). |
bbox | Bounding box of the generation domain in normalized coordinates. |
Example
Result
Array hmap::gpu::vorolines | ( | Vec2< int > | shape, |
float | density, | ||
uint | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} , |
||
Vec4< float > | bbox_points = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a Voronoi-based pattern where cells are defined by proximity to random lines.
This function generates an OpenCL-accelerated Voronoi-like pattern based on the distance from each pixel to a set of randomly oriented lines. Each line is defined by a random point and a direction sampled from a uniform distribution around a given angle.
shape | The resolution of the resulting 2D array (width, height). |
density | Number of base points per unit area used to define lines. |
seed | Seed for the random number generator used to generate base points and directions. |
k_smoothing | Kernel smoothing factor; controls how sharp or soft the distance fields are. |
exp_sigma | Exponential smoothing parameter applied to the computed distance field. |
alpha | Base angle (in radians) used to orient the generated lines. |
alpha_span | Maximum angular deviation from alpha ; controls line orientation variability. |
return_type | Type of Voronoi output to return (e.g., F1, F2, edge distance, smoothed field, etc.). |
p_noise_x | Optional pointer to an input noise field applied to the X coordinates (can be nullptr). |
p_noise_y | Optional pointer to an input noise field applied to the Y coordinates (can be nullptr). |
bbox | Bounding box in normalized coordinates (min_x, max_x, min_y, max_y) of the final array. |
bbox_points | Bounding box within which random base points are sampled. |
theta = alpha + rand * alpha_span
. Example
Result
Array hmap::gpu::vorolines_fbm | ( | Vec2< int > | shape, |
float | density, | ||
uint | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} , |
||
Vec4< float > | 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.
This function extends the standard vorolines
generation by introducing fBm-based warping of the coordinate space, resulting in more organic and fractal-like structures. It creates a Voronoi distance field based on proximity to oriented line segments and distorts the result using multi-octave procedural noise.
shape | Output resolution of the 2D array (width, height). |
density | Number of base points per unit area used to define lines. |
seed | Seed value for the random number generator. |
k_smoothing | Kernel smoothing coefficient to soften distance values (e.g., for blending). |
exp_sigma | Sigma value for optional exponential smoothing on the final field. |
alpha | Base orientation angle (in radians) of lines generated from random points. |
alpha_span | Maximum angle deviation from alpha , determining directional randomness of lines. |
return_type | Type of output to return (e.g., F1, F2, distance to edge, smoothed version). |
octaves | Number of noise octaves used in the fBm modulation. |
weight | Weight of each octave's contribution to the total noise. |
persistence | Amplitude decay factor for each successive octave (commonly 0.5–0.8). |
lacunarity | Frequency multiplier for each successive octave (commonly 2.0). |
p_noise_x | Optional pointer to an external noise field applied to X coordinates (can be nullptr). |
p_noise_y | Optional pointer to an external noise field applied to Y coordinates (can be nullptr). |
bbox | Bounding box for the final image domain (min_x, max_x, min_y, max_y). |
bbox_points | Bounding box from which the initial set of points are sampled. |
Array
representing the Voronoi-fBm field, distorted by noise and influenced by distance to random lines.p_noise_x
, p_noise_y
) are provided. Example
Result
Array hmap::gpu::voronoi | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
Vec2< float > | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a Voronoi diagram in a 2D array with configurable properties.
shape | The dimensions of the output array as a 2D vector of integers. |
kw | The frequency scale factors for the Voronoi cells, given as a 2D vector of floats. |
seed | A seed value for random number generation, ensuring reproducibility. |
jitter | (Optional) The amount of random variation in the positions of Voronoi cell sites, given as a 2D vector of floats. Defaults to {0.5f, 0.5f}. |
return_type | (Optional) The type of value to compute for the Voronoi diagram. Defaults to VoronoiReturnType::F1_SQUARED . |
p_ctrl_param | (Optional) A pointer to an Array used to control the Voronoi computation. Used here as a multiplier for the jitter. If nullptr, no control is applied. |
p_noise_x | (Optional) A pointer to an Array providing additional noise in the x-direction for cell positions. If nullptr, no x-noise is applied. |
p_noise_y | (Optional) A pointer to an Array providing additional noise in the y-direction for cell positions. If nullptr, no y-noise is applied. |
bbox | (Optional) The bounding box for the Voronoi computation, given as a 4D vector of floats representing {min_x, max_x, min_y, max_y}. Defaults to {0.f, 1.f, 0.f, 1.f}. |
Example
Result
Array hmap::gpu::voronoi_fbm | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
Vec2< float > | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a Voronoi diagram in a 2D array with configurable properties.
shape | The dimensions of the output array as a 2D vector of integers. |
kw | The frequency scale factors for the base Voronoi cells, given as a 2D vector of floats. |
seed | A seed value for random number generation, ensuring reproducibility. |
jitter | (Optional) The amount of random variation in the positions of Voronoi cell sites, given as a 2D vector of floats. Defaults to {0.5f, 0.5f}. |
return_type | (Optional) The type of value to compute for the Voronoi diagram. Defaults to VoronoiReturnType::F1_SQUARED . |
octaves | (Optional) The number of layers (octaves) in the fractal Brownian motion. Defaults to 8. |
weight | (Optional) The initial weight of the base layer in the FBM computation. Defaults to 0.7f. |
persistence | (Optional) The persistence factor that controls the amplitude reduction between octaves. Defaults to 0.5f. |
lacunarity | (Optional) The lacunarity factor that controls the frequency increase between octaves. Defaults to 2.f. |
p_ctrl_param | (Optional) A pointer to an Array used to control the Voronoi computation. If nullptr, no control is applied. |
p_noise_x | (Optional) A pointer to an Array providing additional noise in the x-direction for cell positions. If nullptr, no x-noise is applied. |
p_noise_y | (Optional) A pointer to an Array providing additional noise in the y-direction for cell positions. If nullptr, no y-noise is applied. |
bbox | (Optional) The bounding box for the Voronoi computation, given as a 4D vector of floats representing {min_x, max_x, min_y, max_y}. Defaults to {0.f, 1.f, 0.f, 1.f}. |
Example
Result
Array hmap::gpu::voronoi_edge_distance | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
uint | seed, | ||
Vec2< float > | jitter = {0.5f, 0.5f} , |
||
const Array * | p_ctrl_param = nullptr , |
||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Computes the Voronoi edge distance.
shape | The shape of the grid as a 2D vector (width, height). |
kw | The weights for the Voronoi kernel as a 2D vector. |
seed | The random seed used for generating Voronoi points. |
jitter | Optional parameter for controlling jitter in Voronoi point placement (default is {0.5f, 0.5f}). |
p_ctrl_param | Optional pointer to an Array specifying control parameters for Voronoi grid jitter (default is nullptr). |
p_noise_x,p_noise_y | Reference to the input noise arrays. |
bbox | The bounding box for the Voronoi diagram as {x_min, x_max, y_min, y_max} (default is {0.f, 1.f, 0.f, 1.f}). |
Array hmap::gpu::voronoise | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
float | u_param, | ||
float | v_param, | ||
uint | seed, | ||
const Array * | p_noise_x = nullptr , |
||
const Array * | p_noise_y = nullptr , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a 2D Voronoi noise array.
This function computes a Voronoi noise pattern based on the input parameters and returns it as a 2D array. The noise is calculated in the OpenCL kernel noise_voronoise
, which uses a combination of hashing and smoothstep functions to generate a weighted Voronoi noise field.
shape | The dimensions of the 2D output array as a vector (width and height). |
kw | Wave numbers for scaling the noise pattern, represented as a 2D vector. |
u_param | A control parameter for the noise, adjusting the contribution of random offsets. |
v_param | A control parameter for the noise, affecting the smoothness of the pattern. |
p_ctrl_param | Optional pointer to an Array specifying control parameters for Voronoi grid jitter (default is nullptr). |
p_noise_x,p_noise_y | Reference to the input noise arrays. |
seed | A seed value for random number generation, ensuring reproducibility. |
Array
object containing the generated 2D Voronoi noise values.Example
Result
Array hmap::gpu::voronoise_fbm | ( | Vec2< int > | shape, |
Vec2< float > | kw, | ||
float | u_param, | ||
float | v_param, | ||
uint | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
Return an array filled with coherence Voronoise.
shape | Array shape. |
kw | Noise wavenumbers {kx, ky} for each directions. |
seed | Random seed number. |
octaves | Number of octaves. |
weigth | Octave weighting. |
persistence | Octave persistence. |
lacunarity | Defines the wavenumber ratio between each octaves. |
p_ctrl_param | Reference to the control parameter array (acts as a multiplier for the weight parameter). |
p_noise_x,p_noise_y | Reference to the input noise arrays. |
bbox | Domain bounding box. |
Example
Result
Array hmap::gpu::vororand | ( | Vec2< int > | shape, |
float | density, | ||
float | variability, | ||
uint | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} , |
||
Vec4< float > | bbox_points = {0.f, 1.f, 0.f, 1.f} |
||
) |
Generates a 2D Voronoi-based scalar field using OpenCL.
This function computes a Voronoi diagram or derived metric (such as F1, F2, or edge distances) on a grid of given shape. A set of random points is generated within an extended bounding box, based on the desired density and variability, to reduce edge artifacts. Optionally, per-pixel displacement can be applied through noise fields.
The result is stored in an Array
object representing a 2D scalar field.
shape | Dimensions of the output array (width x height). |
density | Number of random points per unit area for Voronoi diagram. |
variability | Amount of randomness added to the point generation bounding box. |
seed | Seed for random number generation used in point sampling. |
k_smoothing | Smoothing factor used in soft minimum/maximum Voronoi distance computations. |
exp_sigma | Standard deviation used in exponential falloff for edge distance computation. |
return_type | Type of Voronoi computation to perform (e.g., F1, F2, F2-F1, edge distance). |
p_noise_x | Optional pointer to a noise field applied to X coordinates of grid points. |
p_noise_y | Optional pointer to a noise field applied to Y coordinates of grid points. |
bbox | Bounding box of the domain in which the field is computed: {xmin, xmax, ymin, ymax}. |
bbox_points | Bounding box for point generation, usually larger than bbox to avoid edge effects. |
Array
object containing the computed scalar field."vororand"
must be compiled and available in the OpenCL context.p_noise_x
or p_noise_y
are provided, they must match the shape of the output array.bbox
to reduce border artifacts.Example
Result
Array hmap::gpu::vororand | ( | Vec2< int > | 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 , |
||
Vec4< float > | bbox = {0.f, 1.f, 0.f, 1.f} |
||
) |
See hmap::maximum_smooth.
See hmap::minimum_smooth.
Array hmap::gpu::select_valley | ( | const Array & | z, |
int | ir, | ||
bool | zero_at_borders = true , |
||
bool | ridge_select = false |
||
) |
See hmap::select_valley.
void hmap::gpu::rotate | ( | Array & | array, |
float | angle, | ||
bool | zoom_in = true |
||
) |
See hmap::rotate.
See hmap::warp.
Vec4< float > hmap::gpu::helper_transform_bbox | ( | const Vec4< float > & | bbox_source, |
const Vec4< float > & | bbox_target | ||
) |