HighMap library (C++)
Loading...
Searching...
No Matches
erosion.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
16#pragma once
17#include <cmath>
18
19#include "highmap/array.hpp"
20
21// neighbor pattern search based on Moore pattern and define diagonal
22// weight coefficients ('c' corresponds to a weight coefficient
23// applied to take into account the longer distance for diagonal
24// comparison between cells)
25
26// 6 2 8
27// 1 . 4
28// 5 3 7
29// clang-format off
30#define DI {-1, 0, 0, 1, -1, -1, 1, 1}
31#define DJ {0, 1, -1, 0, -1, 1, -1, 1}
32#define CD {1.f, 1.f, 1.f, 1.f, M_SQRT2, M_SQRT2, M_SQRT2, M_SQRT2}
33// clang-format on
34
35namespace hmap
36{
37
52
70void depression_filling(Array &z, int iterations = 1000, float epsilon = 1e-4f);
71
88void erosion_maps(Array &z_before,
89 Array &z_after,
90 Array &erosion_map,
91 Array &deposition_map,
92 float tolerance = 0.f);
93
118void hydraulic_algebric(Array &z,
119 Array *p_mask,
120 float talus_ref,
121 int ir,
122 Array *p_bedrock = nullptr,
123 Array *p_erosion_map = nullptr,
124 Array *p_deposition_map = nullptr,
125 float c_erosion = 0.05f,
126 float c_deposition = 0.05f,
127 int iterations = 1);
128
129void hydraulic_algebric(Array &z,
130 float talus_ref,
131 int ir,
132 Array *p_bedrock = nullptr,
133 Array *p_erosion_map = nullptr,
134 Array *p_deposition_map = nullptr,
135 float c_erosion = 0.05f,
136 float c_deposition = 0.05f,
137 int iterations = 1);
138
169void hydraulic_benes(Array &z,
170 Array *p_mask,
171 int iterations = 50,
172 Array *p_bedrock = nullptr,
173 Array *p_moisture_map = nullptr,
174 Array *p_erosion_map = nullptr,
175 Array *p_deposition_map = nullptr,
176 float c_capacity = 40.f,
177 float c_erosion = 0.2f,
178 float c_deposition = 0.8f,
179 float water_level = 0.005f,
180 float evap_rate = 0.01f,
181 float rain_rate = 0.5f);
182
183void hydraulic_benes(Array &z,
184 int iterations = 50,
185 Array *p_bedrock = nullptr,
186 Array *p_moisture_map = nullptr,
187 Array *p_erosion_map = nullptr,
188 Array *p_deposition_map = nullptr,
189 float c_capacity = 40.f,
190 float c_erosion = 0.2f,
191 float c_deposition = 0.8f,
192 float water_level = 0.005f,
193 float evap_rate = 0.01f,
194 float rain_rate = 0.5f);
195
209void hydraulic_blur(Array &z,
210 float radius,
211 float vmax,
212 float k_smoothing = 0.1f);
213
231void hydraulic_diffusion(Array &z,
232 float c_diffusion,
233 float talus,
234 int iterations);
258void hydraulic_musgrave(Array &z,
259 Array &moisture_map,
260 int iterations = 100,
261 float c_capacity = 1.f,
262 float c_erosion = 0.1f,
263 float c_deposition = 0.1f,
264 float water_level = 0.01f,
265 float evap_rate = 0.01f);
266
267void hydraulic_musgrave(Array &z,
268 int iterations = 100,
269 float c_capacity = 1.f,
270 float c_erosion = 0.1f,
271 float c_deposition = 0.1f,
272 float water_level = 0.01f,
273 float evap_rate = 0.01f);
274
305void hydraulic_particle(Array &z,
306 Array *p_mask,
307 int nparticles,
308 int seed,
309 Array *p_bedrock = nullptr,
310 Array *p_moisture_map = nullptr,
311 Array *p_erosion_map = nullptr, // -> out
312 Array *p_deposition_map = nullptr, // -> out
313 float c_capacity = 10.f,
314 float c_erosion = 0.05f,
315 float c_deposition = 0.05f,
316 float c_inertia = 0.3f,
317 float drag_rate = 0.001f,
318 float evap_rate = 0.001f,
319 bool post_filtering = false);
320
321void hydraulic_particle(Array &z,
322 int nparticles,
323 int seed,
324 Array *p_bedrock = nullptr,
325 Array *p_moisture_map = nullptr,
326 Array *p_erosion_map = nullptr, // -> out
327 Array *p_deposition_map = nullptr, // -> out
328 float c_capacity = 10.f,
329 float c_erosion = 0.05f,
330 float c_deposition = 0.05f,
331 float c_inertia = 0.3f,
332 float drag_rate = 0.001f,
333 float evap_rate = 0.001f,
334 bool post_filtering = false);
335
370 float particle_density,
371 int seed,
372 Array *p_bedrock = nullptr,
373 Array *p_moisture_map = nullptr,
374 Array *p_erosion_map = nullptr, // -> out
375 Array *p_deposition_map = nullptr, // -> out
376 float c_capacity = 10.f,
377 float c_erosion = 0.05f,
378 float c_deposition = 0.01f,
379 float c_inertia = 0.3f,
380 float drag_rate = 0.01f,
381 float evap_rate = 0.001f,
382 int pyramid_finest_level = 0);
383
433 Array &z,
434 uint seed,
435 float ridge_wavelength,
436 float ridge_scaling = 0.1f,
438 float delta = 0.02f,
439 float noise_ratio = 0.2f,
440 int prefilter_ir = -1,
441 float density_factor = 1.f,
442 float kernel_width_ratio = 2.f,
443 float phase_smoothing = 2.f,
444 float phase_noise_amp = M_PI,
445 bool reverse_phase = false,
446 bool rotate90 = false,
447 bool use_default_mask = true,
448 float talus_mask = 0.f,
449 Array *p_mask = nullptr,
450 Array *p_ridge_mask = nullptr,
451 float vmin = 0.f,
452 float vmax = -1.f);
453
481void hydraulic_stream(Array &z,
482 float c_erosion,
483 float talus_ref,
484 Array *p_bedrock = nullptr,
485 Array *p_moisture_map = nullptr,
486 Array *p_erosion_map = nullptr, // -> out
487 int ir = 1,
488 float clipping_ratio = 10.f);
489
490void hydraulic_stream(Array &z,
491 Array *p_mask,
492 float c_erosion,
493 float talus_ref,
494 Array *p_bedrock = nullptr,
495 Array *p_moisture_map = nullptr,
496 Array *p_erosion_map = nullptr, // -> out
497 int ir = 1,
498 float clipping_ratio = 10.f);
499
533 float c_erosion,
534 float talus_ref,
535 int upscaling_levels = 1,
536 float persistence = 1.f,
537 int ir = 1,
538 float clipping_ratio = 10.f);
539
574 Array &z,
575 Array *p_mask,
576 float c_erosion,
577 float talus_ref,
578 int upscaling_levels = 1,
579 float persistence = 1.f,
580 int ir = 1,
581 float clipping_ratio = 10.f);
582
621void hydraulic_stream_log(Array &z,
622 float c_erosion,
623 float talus_ref,
624 int deposition_ir = 32,
625 float deposition_scale_ratio = 1.f,
626 float gradient_power = 0.8f,
627 float gradient_scaling_ratio = 1.f,
628 int gradient_prefilter_ir = 16,
629 float saturation_ratio = 1.f,
630 Array *p_bedrock = nullptr,
631 Array *p_moisture_map = nullptr,
632 Array *p_erosion_map = nullptr,
633 Array *p_deposition_map = nullptr,
634 Array *p_flow_map = nullptr);
635
636void hydraulic_stream_log(Array &z,
637 float c_erosion,
638 float talus_ref,
639 Array *p_mask,
640 int deposition_ir = 32,
641 float deposition_scale_ratio = 1.f,
642 float gradient_power = 0.8f,
643 float gradient_scaling_ratio = 1.f,
644 int gradient_prefilter_ir = 16,
645 float saturation_ratio = 1.f,
646 Array *p_bedrock = nullptr,
647 Array *p_moisture_map = nullptr,
648 Array *p_erosion_map = nullptr,
649 Array *p_deposition_map = nullptr,
650 Array *p_flow_map = nullptr);
651
680void hydraulic_vpipes(Array &z,
681 Array *p_mask,
682 int iterations,
683 Array *p_bedrock = nullptr,
684 Array *p_moisture_map = nullptr,
685 Array *p_erosion_map = nullptr,
686 Array *p_deposition_map = nullptr,
687 float water_height = 0.1f,
688 float c_capacity = 0.1f,
689 float c_erosion = 0.05f,
690 float c_deposition = 0.05f,
691 float rain_rate = 0.f,
692 float evap_rate = 0.01f);
693
694void hydraulic_vpipes(Array &z,
695 int iterations,
696 Array *p_bedrock = nullptr,
697 Array *p_moisture_map = nullptr,
698 Array *p_erosion_map = nullptr,
699 Array *p_deposition_map = nullptr,
700 float water_height = 0.1f,
701 float c_capacity = 0.1f,
702 float c_erosion = 0.05f,
703 float c_deposition = 0.05f,
704 float rain_rate = 0.f,
705 float evap_rate = 0.01f);
706
729void sediment_deposition(Array &z,
730 Array *p_mask,
731 const Array &talus,
732 Array *p_deposition_map = nullptr,
733 float max_deposition = 0.01,
734 int iterations = 5,
735 int thermal_subiterations = 10);
736
737void sediment_deposition(Array &z,
738 const Array &talus,
739 Array *p_deposition_map = nullptr,
740 float max_deposition = 0.01,
741 int iterations = 5,
742 int thermal_subiterations = 10);
743
767void sediment_deposition_particle(Array &z,
768 Array *p_mask,
769 int nparticles,
770 int ir,
771 int seed = 1,
772 Array *p_spawning_map = nullptr,
773 Array *p_deposition_map = nullptr,
774 float particle_initial_sediment = 0.1f,
775 float deposition_velocity_limit = 0.01f,
776 float drag_rate = 0.001f);
777
778void sediment_deposition_particle(Array &z,
779 int nparticles,
780 int ir,
781 int seed = 1,
782 Array *p_spawning_map = nullptr,
783 Array *p_deposition_map = nullptr,
784 float particle_initial_sediment = 0.1f,
785 float deposition_velocity_limit = 0.01f,
786 float drag_rate = 0.001f);
787
788void sediment_layer(Array &z,
789 const Array &talus_layer,
790 const Array &talus_upper_limit,
791 int iterations,
792 bool apply_post_filter = true,
793 Array *p_deposition_map = nullptr);
794
814void stratify(Array &z,
815 Array *p_mask,
816 std::vector<float> hs,
817 std::vector<float> gamma,
818 Array *p_noise = nullptr);
819
820void stratify(Array &z,
821 std::vector<float> hs,
822 std::vector<float> gamma,
823 Array *p_noise = nullptr);
824
825void stratify(Array &z,
826 std::vector<float> hs,
827 float gamma = 0.5f,
828 Array *p_noise = nullptr);
829
830void stratify(Array &z,
831 Array &partition,
832 int nstrata,
833 float strata_noise,
834 float gamma,
835 float gamma_noise,
836 int npartitions,
837 uint seed,
838 float mixing_gain_factor = 1.f,
839 Array *p_noise = nullptr,
840 float vmin = 1.f,
841 float vmax = 0.f);
842
866void stratify_multiscale(Array &z,
867 float zmin,
868 float zmax,
869 std::vector<int> n_strata,
870 std::vector<float> strata_noise,
871 std::vector<float> gamma_list,
872 std::vector<float> gamma_noise,
873 uint seed,
874 Array *p_mask = nullptr,
875 Array *p_noise = nullptr);
876
897void stratify_oblique(Array &z,
898 Array *p_mask,
899 std::vector<float> hs,
900 std::vector<float> gamma,
901 float talus,
902 float angle,
903 Array *p_noise = nullptr);
904
905void stratify_oblique(Array &z,
906 std::vector<float> hs,
907 std::vector<float> gamma,
908 float talus,
909 float angle,
910 Array *p_noise = nullptr);
911
931void thermal(Array &z,
932 Array *p_mask,
933 const Array &talus,
934 int iterations = 10,
935 Array *p_bedrock = nullptr,
936 Array *p_deposition_map = nullptr);
937
938void thermal(Array &z,
939 const Array &talus,
940 int iterations = 10,
941 Array *p_bedrock = nullptr,
942 Array *p_deposition_map = nullptr);
943
944void thermal(Array &z,
945 float talus,
946 int iterations = 10,
947 Array *p_bedrock = nullptr,
948 Array *p_deposition_map = nullptr);
949
971void thermal_auto_bedrock(Array &z,
972 const Array &talus,
973 int iterations = 10,
974 Array *p_deposition_map = nullptr);
975
976void thermal_auto_bedrock(Array &z,
977 float talus,
978 int iterations = 10,
979 Array *p_deposition_map = nullptr);
980
981void thermal_auto_bedrock(Array &z,
982 Array *p_mask,
983 float talus,
984 int iterations = 10,
985 Array *p_deposition_map = nullptr);
986
1004void thermal_flatten(Array &z,
1005 const Array &talus,
1006 const Array &bedrock,
1007 int iterations = 10,
1008 int post_filter_ir = 1);
1009
1010void thermal_flatten(Array &z,
1011 float talus,
1012 int iterations = 10,
1013 int post_filter_ir = 1);
1014
1034void thermal_olsen(Array &z,
1035 const Array &talus,
1036 int iterations = 10,
1037 Array *p_bedrock = nullptr,
1038 Array *p_deposition_map = nullptr);
1039
1052void thermal_rib(Array &z, int iterations, Array *p_bedrock = nullptr);
1053
1077void thermal_schott(Array &z,
1078 const Array &talus,
1079 int iterations = 10,
1080 float intensity = 0.001f);
1081
1082void thermal_schott(Array &z,
1083 const Array &talus,
1084 Array *p_mask,
1085 int iterations = 10,
1086 float intensity = 0.001f);
1087
1109void thermal_schott(Array &z,
1110 const float talus,
1111 int iterations = 10,
1112 float intensity = 0.001f);
1113
1114void thermal_schott(Array &z,
1115 const float talus,
1116 Array *p_mask,
1117 int iterations = 10,
1118 float intensity = 0.001f);
1119
1120} // namespace hmap
1121
1122namespace hmap::gpu
1123{
1124
1126void hydraulic_particle(Array &z,
1127 int nparticles,
1128 int seed,
1129 Array *p_bedrock = nullptr,
1130 Array *p_moisture_map = nullptr,
1131 Array *p_erosion_map = nullptr,
1132 Array *p_deposition_map = nullptr,
1133 float c_capacity = 10.f,
1134 float c_erosion = 0.05f,
1135 float c_deposition = 0.05f,
1136 float c_inertia = 0.3f,
1137 float drag_rate = 0.001f,
1138 float evap_rate = 0.001f,
1139 bool post_filtering = false);
1140
1142void hydraulic_particle(Array &z,
1143 Array *p_mask,
1144 int nparticles,
1145 int seed,
1146 Array *p_bedrock = nullptr,
1147 Array *p_moisture_map = nullptr,
1148 Array *p_erosion_map = nullptr,
1149 Array *p_deposition_map = nullptr,
1150 float c_capacity = 10.f,
1151 float c_erosion = 0.05f,
1152 float c_deposition = 0.05f,
1153 float c_inertia = 0.3f,
1154 float drag_rate = 0.001f,
1155 float evap_rate = 0.001f,
1156 bool post_filtering = false);
1157
1204void hydraulic_schott(Array &z,
1205 int iterations,
1206 const Array &talus,
1207 float c_erosion = 1.f,
1208 float c_thermal = 0.1f,
1209 float c_deposition = 0.2f,
1210 float flow_acc_exponent = 0.8f,
1211 float flow_acc_exponent_depo = 0.8f,
1212 float flow_routing_exponent = 1.3f,
1213 float thermal_weight = 1.5f,
1214 float deposition_weight = 2.5f,
1215 Array *p_flow = nullptr);
1216
1217void hydraulic_schott(Array &z,
1218 int iterations,
1219 const Array &talus,
1220 Array *p_mask,
1221 float c_erosion = 1.f,
1222 float c_thermal = 0.1f,
1223 float c_deposition = 0.2f,
1224 float flow_acc_exponent = 0.8f,
1225 float flow_acc_exponent_depo = 0.8f,
1226 float flow_routing_exponent = 1.3f,
1227 float thermal_weight = 1.5f,
1228 float deposition_weight = 2.5f,
1229 Array *p_flow = nullptr);
1230
1232void hydraulic_stream_log(Array &z,
1233 float c_erosion,
1234 float talus_ref,
1235 int deposition_ir = 32,
1236 float deposition_scale_ratio = 1.f,
1237 float gradient_power = 0.8f,
1238 float gradient_scaling_ratio = 1.f,
1239 int gradient_prefilter_ir = 16,
1240 float saturation_ratio = 1.f,
1241 Array *p_bedrock = nullptr,
1242 Array *p_moisture_map = nullptr,
1243 Array *p_erosion_map = nullptr,
1244 Array *p_deposition_map = nullptr,
1245 Array *p_flow_map = nullptr);
1246
1247void hydraulic_stream_log(Array &z,
1248 float c_erosion,
1249 float talus_ref,
1250 Array *p_mask,
1251 int deposition_ir = 32,
1252 float deposition_scale_ratio = 1.f,
1253 float gradient_power = 0.8f,
1254 float gradient_scaling_ratio = 1.f,
1255 int gradient_prefilter_ir = 16,
1256 float saturation_ratio = 1.f,
1257 Array *p_bedrock = nullptr,
1258 Array *p_moisture_map = nullptr,
1259 Array *p_erosion_map = nullptr,
1260 Array *p_deposition_map = nullptr,
1261 Array *p_flow_map = nullptr);
1262
1264void thermal(Array &z,
1265 const Array &talus,
1266 int iterations = 10,
1267 Array *p_bedrock = nullptr,
1268 Array *p_deposition_map = nullptr);
1269
1271void thermal(Array &z,
1272 Array *p_mask,
1273 const Array &talus,
1274 int iterations = 10,
1275 Array *p_bedrock = nullptr,
1276 Array *p_deposition_map = nullptr);
1277
1279void thermal(Array &z,
1280 float talus,
1281 int iterations = 10,
1282 Array *p_bedrock = nullptr,
1283 Array *p_deposition_map = nullptr);
1284
1286void thermal_auto_bedrock(Array &z,
1287 const Array &talus,
1288 int iterations = 10,
1289 Array *p_deposition_map = nullptr);
1290
1292void thermal_auto_bedrock(Array &z,
1293 Array *p_mask,
1294 const Array &talus,
1295 int iterations = 10,
1296 Array *p_deposition_map = nullptr);
1297
1299void thermal_auto_bedrock(Array &z,
1300 float,
1301 int iterations = 10,
1302 Array *p_deposition_map = nullptr);
1303
1321void thermal_inflate(Array &z, const Array &talus, int iterations = 10);
1322
1323void thermal_inflate(Array &z,
1324 const Array *p_mask,
1325 const Array &talus,
1326 int iterations = 10);
1327
1329void thermal_rib(Array &z, int iterations, Array *p_bedrock = nullptr);
1330
1350void thermal_ridge(Array &z,
1351 const Array &talus,
1352 int iterations = 10,
1353 Array *p_deposition_map = nullptr);
1354
1355void thermal_ridge(Array &z,
1356 const Array *p_mask,
1357 const Array &talus,
1358 int iterations = 10,
1359 Array *p_deposition_map = nullptr);
1360
1382void thermal_scree(Array &z,
1383 const Array &talus,
1384 const Array &zmax,
1385 int iterations = 10,
1386 bool talus_constraint = true,
1387 Array *p_deposition_map = nullptr);
1388
1389void thermal_scree(Array &z,
1390 const Array *p_mask,
1391 const Array &talus,
1392 const Array &zmax,
1393 int iterations = 10,
1394 bool talus_constraint = true,
1395 Array *p_deposition_map = nullptr);
1396
1397} // namespace hmap::gpu
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
unsigned int uint
Definition array.hpp:14
Definition blending.hpp:151
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.
Definition thermal_gpu.cpp:207
void thermal(Array &z, const Array &talus, int iterations=10, Array *p_bedrock=nullptr, Array *p_deposition_map=nullptr)
See hmap::thermal.
Definition thermal_gpu.cpp:13
void thermal_auto_bedrock(Array &z, const Array &talus, int iterations=10, Array *p_deposition_map=nullptr)
See hmap::thermal_auto_bedrock.
Definition thermal_gpu.cpp:97
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.
Definition hydraulic_stream_gpu.cpp:17
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.
Definition erosion_gpu.cpp:12
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.
Definition thermal_gpu.cpp:249
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.
Definition hydraulic_schott_gpu.cpp:10
void thermal_inflate(Array &z, const Array &talus, int iterations=10)
Apply thermal weathering erosion to give a scree like effect.
Definition thermal_gpu.cpp:156
void thermal_rib(Array &z, int iterations, Array *p_bedrock=nullptr)
See hmap::thermal_rib.
Definition thermal_gpu.cpp:189
Definition algebra.hpp:28
void stratify_oblique(Array &z, Array *p_mask, std::vector< float > hs, std::vector< float > gamma, float talus, float angle, Array *p_noise=nullptr)
Stratify the heightmap by creating a series of oblique layers with elevations corrected by a gamma fa...
Definition stratify.cpp:241
void thermal_olsen(Array &z, const Array &talus, int iterations=10, Array *p_bedrock=nullptr, Array *p_deposition_map=nullptr)
Apply thermal weathering erosion.
Definition thermal_olsen.cpp:23
void hydraulic_blur(Array &z, float radius, float vmax, float k_smoothing=0.1f)
Apply cell-based hydraulic erosion using a nonlinear diffusion model.
Definition hydraulic_blur.cpp:13
ErosionProfile
Procedural erosion angular profile type.
Definition erosion.hpp:42
@ SAW_SMOOTH
Definition erosion.hpp:45
@ TRIANGLE_GRENIER
Definition erosion.hpp:48
@ SQUARE_SMOOTH
Definition erosion.hpp:47
@ SAW_SHARP
Definition erosion.hpp:44
@ TRIANGLE_SHARP
Definition erosion.hpp:49
@ SHARP_VALLEYS
Definition erosion.hpp:46
@ TRIANGLE_SMOOTH
Definition erosion.hpp:50
@ COSINE
Definition erosion.hpp:43
void sediment_deposition(Array &z, Array *p_mask, const Array &talus, Array *p_deposition_map=nullptr, float max_deposition=0.01, int iterations=5, int thermal_subiterations=10)
Perform sediment deposition combined with thermal erosion.
Definition deposition.cpp:47
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)
Apply hydraulic erosion based on a flow accumulation map, alternative formulation.
Definition hydraulic_stream.cpp:100
void thermal_rib(Array &z, int iterations, Array *p_bedrock=nullptr)
Apply thermal erosion using a 'rib' algorithm (taken from Geomorph).
Definition thermal_rib.cpp:17
void hydraulic_musgrave(Array &z, Array &moisture_map, int iterations=100, float c_capacity=1.f, float c_erosion=0.1f, float c_deposition=0.1f, float water_level=0.01f, float evap_rate=0.01f)
Apply cell-based hydraulic erosion/deposition of Musgrave et al. (1989).
Definition hydraulic_musgrave.cpp:31
void thermal_flatten(Array &z, const Array &talus, const Array &bedrock, int iterations=10, int post_filter_ir=1)
Apply modified thermal weathering of Olsen.
Definition thermal_flatten.cpp:22
void hydraulic_stream_upscale_amplification(Array &z, float c_erosion, float talus_ref, int upscaling_levels=1, float persistence=1.f, int ir=1, float clipping_ratio=10.f)
Applies hydraulic erosion with upscaling amplification.
Definition hydraulic_stream_upscale_amplification.cpp:17
void hydraulic_diffusion(Array &z, float c_diffusion, float talus, int iterations)
Apply cell-based hydraulic erosion using a nonlinear diffusion model.
Definition hydraulic_diffusion.cpp:17
void stratify_multiscale(Array &z, float zmin, float zmax, std::vector< int > n_strata, std::vector< float > strata_noise, std::vector< float > gamma_list, std::vector< float > gamma_noise, uint seed, Array *p_mask=nullptr, Array *p_noise=nullptr)
Stratify the heightmap by creating a multiscale series of layers with elevations corrected by a gamma...
Definition stratify.cpp:62
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)
Apply hydraulic erosion using a particle based procedure.
Definition hydraulic_particle.cpp:184
void sediment_layer(Array &z, const Array &talus_layer, const Array &talus_upper_limit, int iterations, bool apply_post_filter=true, Array *p_deposition_map=nullptr)
Definition deposition.cpp:209
void depression_filling(Array &z, int iterations=1000, float epsilon=1e-4f)
Fill the depressions of the heightmap using the Planchon-Darboux algorithm.
Definition depression_filling.cpp:23
void hydraulic_vpipes(Array &z, Array *p_mask, int iterations, Array *p_bedrock=nullptr, Array *p_moisture_map=nullptr, Array *p_erosion_map=nullptr, Array *p_deposition_map=nullptr, float water_height=0.1f, float c_capacity=0.1f, float c_erosion=0.05f, float c_deposition=0.05f, float rain_rate=0.f, float evap_rate=0.01f)
Apply hydraulic erosion using the 'virtual pipes' algorithm.
Definition hydraulic_vpipes.cpp:289
float angle(const Point &p1, const Point &p2)
Computes the angle between two points relative to the x-axis.
Definition points.cpp:42
void hydraulic_particle_multiscale(Array &z, float particle_density, 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.01f, float c_inertia=0.3f, float drag_rate=0.01f, float evap_rate=0.001f, int pyramid_finest_level=0)
Apply hydraulic erosion using a particle based procedure, using a pyramid decomposition to allow a mu...
Definition hydraulic_particle_multiscale.cpp:17
void thermal_schott(Array &z, const Array &talus, int iterations=10, float intensity=0.001f)
Applies the thermal erosion process to an array of elevation values.
Definition thermal_schott.cpp:24
void thermal(Array &z, Array *p_mask, const Array &talus, int iterations=10, Array *p_bedrock=nullptr, Array *p_deposition_map=nullptr)
Apply thermal weathering erosion.
Definition thermal.cpp:174
void stratify(Array &z, Array *p_mask, std::vector< float > hs, std::vector< float > gamma, Array *p_noise=nullptr)
Stratify the heightmap by creating a series of layers with elevations corrected by a gamma factor.
Definition stratify.cpp:46
void hydraulic_algebric(Array &z, Array *p_mask, float talus_ref, int ir, Array *p_bedrock=nullptr, Array *p_erosion_map=nullptr, Array *p_deposition_map=nullptr, float c_erosion=0.05f, float c_deposition=0.05f, int iterations=1)
Apply an algerbic formula based on the local gradient to perform erosion/deposition.
Definition hydraulic_algebric.cpp:73
void thermal_auto_bedrock(Array &z, const Array &talus, int iterations=10, Array *p_deposition_map=nullptr)
Apply thermal weathering erosion with automatic determination of the bedrock.
Definition thermal.cpp:206
void hydraulic_stream(Array &z, float c_erosion, float talus_ref, Array *p_bedrock=nullptr, Array *p_moisture_map=nullptr, Array *p_erosion_map=nullptr, int ir=1, float clipping_ratio=10.f)
Apply hydraulic erosion based on a flow accumulation map.
Definition hydraulic_stream.cpp:20
void hydraulic_benes(Array &z, Array *p_mask, int iterations=50, Array *p_bedrock=nullptr, Array *p_moisture_map=nullptr, Array *p_erosion_map=nullptr, Array *p_deposition_map=nullptr, float c_capacity=40.f, float c_erosion=0.2f, float c_deposition=0.8f, float water_level=0.005f, float evap_rate=0.01f, float rain_rate=0.5f)
Apply cell-based hydraulic erosion/deposition based on Benes et al. procedure.
Definition hydraulic_benes.cpp:207
void sediment_deposition_particle(Array &z, Array *p_mask, int nparticles, int ir, int seed=1, Array *p_spawning_map=nullptr, Array *p_deposition_map=nullptr, float particle_initial_sediment=0.1f, float deposition_velocity_limit=0.01f, float drag_rate=0.001f)
Definition deposition.cpp:172
void hydraulic_procedural(Array &z, uint seed, float ridge_wavelength, float ridge_scaling=0.1f, ErosionProfile erosion_profile=ErosionProfile::TRIANGLE_SMOOTH, float delta=0.02f, float noise_ratio=0.2f, int prefilter_ir=-1, float density_factor=1.f, float kernel_width_ratio=2.f, float phase_smoothing=2.f, float phase_noise_amp=M_PI, bool reverse_phase=false, bool rotate90=false, bool use_default_mask=true, float talus_mask=0.f, Array *p_mask=nullptr, Array *p_ridge_mask=nullptr, float vmin=0.f, float vmax=-1.f)
Generates a procedurally eroded terrain using hydraulic erosion and ridge generation techniques.
Definition hydraulic_procedural.cpp:148
void erosion_maps(Array &z_before, Array &z_after, Array &erosion_map, Array &deposition_map, float tolerance=0.f)
Definition erosion_maps.cpp:16