|
Blender V4.3
|
#include <math.h>#include "BLI_compiler_compat.h"#include "BLI_sys_types.h"#include "BLI_noise.h"Go to the source code of this file.
Macros | |
| #define | VALUE_AT(rx, ry, rz) ((rx) * q[0] + (ry) * q[1] + (rz) * q[2]) |
| #define | SURVE(t) ((t) * (t) * (3.0f - 2.0f * (t))) |
Static Data | |
| #define | HASHPNT(x, y, z) hashpntf + 3 * hash[(hash[(hash[(z) & 255] + (y)) & 255] + (x)) & 255] |
| #define | hash BLI_noise_hash_uchar_512 |
| static const float | hashpntf [768] |
| const uchar | BLI_noise_hash_uchar_512 [512] |
| static const float | hashvectf [768] |
Improved Perlin Noise Implementation (Original) | |
| #define | SETUP(val, b0, b1, r0, r1) |
| static const char | g_perlin_data_ub [512+2] |
| static const float | g_perlin_data_v3 [512+2][3] |
| static float | noise3_perlin (const float vec[3]) |
| static float | orgBlenderNoise (float x, float y, float z) |
| static float | orgBlenderNoiseS (float x, float y, float z) |
| float | BLI_noise_hnoise (float noisesize, float x, float y, float z) |
| float | BLI_noise_turbulence (float noisesize, float x, float y, float z, int nr) |
| static float | orgPerlinNoise (float x, float y, float z) |
| static float | orgPerlinNoiseU (float x, float y, float z) |
| float | BLI_noise_hnoisep (float noisesize, float x, float y, float z) |
Definition at line 154 of file noise.c.
Referenced by LightManager::add_ies(), BKE_cryptomatte_hash(), BKE_cryptomatte_matte_id_to_entries(), BKE_idtype_cache_key_hash(), BKE_modifiers_persistent_uid_init(), BKE_sim_debug_data_add_element(), BKE_sim_debug_data_remove_element(), BLI_ghash_ensure_p(), BLI_ghash_ensure_p_ex(), BLI_ghash_popkey(), BLI_ghash_remove(), BLI_ghash_replace_key(), BLI_ghashutil_pairhash(), BLI_ghashutil_uinthash_v4(), BLI_gset_ensure_p_ex(), BLI_gset_insert(), BLI_gset_pop_key(), BLI_hash_pointer_to_color(), bpy_lib_write(), btAdjustInternalEdgeContacts(), btGetHash(), btHashString::btHashString(), blender::deg::build_collision_relations(), blender::deg::build_effector_relations(), blender::gpu::VKShaderModule::build_sources_hash(), mikk::Mikktspace< Mesh >::buildNeighbors(), ccd_build_deflector_hash(), ccd_build_deflector_hash_single(), ccd_update_deflector_hash(), ccd_update_deflector_hash_single(), ccg_ehash_insert(), ccg_ehash_lookup(), ccg_ehash_lookupWithPrev(), blender::deg::clear_physics_relations(), blender::HashedSetSlot< Key >::contains(), blender::nodes::node_geo_duplicate_elements_cc::copy_hashed_ids(), DEG_get_collision_relations(), DEG_get_effector_relations(), depsgraph_key_hash(), blender::ed::sculpt_paint::paint::image::do_paint_pixels(), drw_register_shader_vlattrs(), blender::ed::object::dupliobject_hash(), blender::ed::object::dupliobject_instancer_hash(), ED_mesh_mirrtopo_init(), blender::ed::geometry::find_socket_log_contexts(), blender::find_socket_log_contexts(), btHashMap< Key, Value >::findIndex(), btHashedSimplePairCache::findPair(), blender::bke::cryptomatte::manifest::from_manifest(), GPUCodegen::generate_cryptomatte(), blender::compositor::NodeOperation::generate_hash(), blender::compositor::generate_hashes(), blender::nodes::geo_eval_log::GeoTreeLog::GeoTreeLog(), blender::eevee::Film::get_aov_texture(), blender::ed::space_node::get_compute_context_hash_for_node_editor(), blender::IntrusiveMapSlot< Key, Value, KeyInfo >::get_hash(), blender::IntrusiveSetSlot< Key, KeyInfo >::get_hash(), blender::SimpleMapSlot< Key, Value >::get_hash(), blender::SimpleSetSlot< Key >::get_hash(), blender::SimpleVectorSetSlot< Key, IndexT >::get_hash(), blender::ed::space_node::get_nested_previews(), ghash_bucket_index(), ghash_buckets_resize(), ghash_insert(), ghash_insert_safe(), ghash_insert_safe_keyonly(), ghash_lookup_entry(), GPU_material_add_output_link_aov(), gpu_pass_cache_lookup(), gpu_pass_cache_resolve_collision(), grad1(), grad2(), grad3(), grad4(), blender::noise::hash_float(), blender::noise::hash_float(), blender::noise::hash_float(), blender::noise::hash_float(), blender::noise::hash_float(), blender::hash_string(), blender::bke::hash_to_anonymous_attribute_name(), blender::noise::hash_to_float(), blender::noise::hash_to_float(), blender::noise::hash_to_float(), blender::noise::hash_to_float(), HsiehHash(), blender::io::ply::PLYImportTest::import_and_check(), btHashMap< Key, Value >::insert(), make_string(), blender::workbench::Material::Material(), mesh_calc_edges_mdata(), mirrtopo_vert_sort(), newPerlin(), nlaevalchan_keyhash(), blender::bke::node_hash_int_str(), blender::bke::node_instance_hash_clear(), blender::bke::node_instance_hash_clear_tags(), blender::bke::node_instance_hash_free(), blender::bke::node_instance_hash_haskey(), blender::bke::node_instance_hash_insert(), blender::bke::node_instance_hash_iterator_init(), blender::bke::node_instance_hash_iterator_new(), blender::bke::node_instance_hash_lookup(), blender::bke::node_instance_hash_new(), blender::bke::node_instance_hash_pop(), blender::bke::node_instance_hash_remove(), blender::bke::node_instance_hash_remove_untagged(), blender::bke::node_instance_hash_size(), blender::bke::node_instance_hash_tag_key(), blender::nodes::node_shader_output_aov_cc::node_shader_gpu_output_aov(), blender::noise::noise_grad(), blender::noise::noise_grad(), blender::noise::noise_grad(), blender::noise::noise_grad(), blender::HashedSetSlot< Key >::occupy(), blender::IntrusiveMapSlot< Key, Value, KeyInfo >::occupy(), blender::SimpleMapSlot< Key, Value >::occupy(), blender::DefaultHash< blender::Set< const BMVert * > >::operator()(), blender::DefaultHash< gpu::VKComputeInfo >::operator()(), blender::DefaultHash< gpu::VKDescriptorSetLayoutInfo >::operator()(), blender::DefaultHash< T * >::operator()(), blender::DefaultHash< Vector< blender::gpu::shader::SpecializationConstant::Value > >::operator()(), ObjVertexHash::operator()(), orgBlenderNoise(), path_files_md5_hash(), path_files_md5_hash_recursive(), blender::noise::perlin_noise(), blender::noise::perlin_noise(), blender::noise::perlin_noise(), blender::noise::perlin_noise(), blender::geometry::phash_insert(), blender::geometry::phash_lookup(), blender::geometry::phash_next(), btConnectivityProcessor::processTriangle(), PyC_FlagSet_ToBitfield(), pyrna_enum_bitfield_from_set(), pyrna_enum_bitmap_from_set(), blender::ed::sculpt_paint::filter::randomize_factors(), btHashMap< Key, Value >::remove(), btHashedSimplePairCache::removeOverlappingPair(), sb_detect_aabb_collisionCached(), sb_detect_edge_collisionCached(), sb_detect_face_collisionCached(), sb_detect_face_pointCached(), sb_detect_vertex_collisionCached(), blender::RandomNumberGenerator::seed_random(), blender::nodes::should_log_socket_values_for_context(), TEST(), TEST(), thumb_create_ex(), thumb_create_or_fail(), ui_popup_menu_memory__internal(), blender::nodes::node_geo_distribute_points_on_faces_cc::update_elimination_mask_based_on_density_factors(), blender::compositor::CryptomatteOperation::update_memory_buffer_partial(), util_hash_to_float(), view_layer_bases_hash_create(), WM_gizmomap_gizmo_hash_new(), and wm_gizmomap_select_all_intern().
Definition at line 29 of file noise.c.
Referenced by BLI_noise_cell_v3(), and BLI_noise_voronoi().
| #define SETUP | ( | val, | |
| b0, | |||
| b1, | |||
| r0, | |||
| r1 ) |
Definition at line 752 of file noise.c.
Referenced by noise3_perlin(), Freestyle::Noise::smoothNoise1(), Freestyle::Noise::smoothNoise2(), and Freestyle::Noise::smoothNoise3().
| #define SURVE | ( | t | ) | ((t) * (t) * (3.0f - 2.0f * (t))) |
Referenced by noise3_perlin().
| #define VALUE_AT | ( | rx, | |
| ry, | |||
| rz ) ((rx) * q[0] + (ry) * q[1] + (rz) * q[2]) |
Referenced by noise3_perlin().
Returns unsigned cell-noise.
Definition at line 1111 of file noise.c.
References floor(), int, and z().
Referenced by BLI_noise_cell(), BLI_noise_generic_noise(), and BLI_noise_generic_turbulence().
newnoise: BLI_noise_cell & BLI_noise_cell_v3 (for vector/point/color). idem, signed.
Definition at line 1126 of file noise.c.
References BLI_cellNoiseU(), and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), BLI_noise_mg_variable_lacunarity(), and M_Noise_cell().
Returns a vector/point/color in r_ca, using point hash-array directly.
Definition at line 1131 of file noise.c.
References floor(), HASHPNT, int, and z().
Referenced by M_Noise_cell_vector(), and voronoiTex().
| float BLI_noise_generic_noise | ( | float | noisesize, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| bool | hard, | ||
| int | noisebasis ) |
newnoise: generic noise & turbulence functions to replace the above BLI_noise_hnoise/p & BLI_noise_turbulence/1. This is done so different noise basis functions can be used. newnoise: generic noise function for use with different noisebasis.
Definition at line 1153 of file noise.c.
References BLI_cellNoiseU(), fabsf, float, newPerlinU(), orgBlenderNoise(), orgPerlinNoiseU(), voronoi_Cr(), voronoi_F1(), voronoi_F1F2(), voronoi_F2(), voronoi_F3(), voronoi_F4(), and z().
Referenced by M_Noise_noise(), noise_vector(), stucci(), turb(), and wood_int().
| float BLI_noise_generic_turbulence | ( | float | noisesize, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| int | oct, | ||
| bool | hard, | ||
| int | noisebasis ) |
newnoise: generic turbulence function for use with different noisebasis.
Definition at line 1210 of file noise.c.
References BLI_cellNoiseU(), fabsf, float, newPerlinU(), orgBlenderNoise(), orgPerlinNoiseU(), sum(), voronoi_Cr(), voronoi_F1(), voronoi_F1F2(), voronoi_F2(), voronoi_F3(), voronoi_F4(), and z().
Referenced by alter_co(), clouds(), do_physical_effector(), do_rough(), do_rough_curve(), marble_int(), and pointdensity().
Definition at line 424 of file noise.c.
References orgBlenderNoise(), x, y, and z().
Referenced by BLI_noise_turbulence().
Definition at line 841 of file noise.c.
References noise3_perlin(), and z().
| float BLI_noise_mg_fbm | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | H, | ||
| float | lacunarity, | ||
| float | octaves, | ||
| int | noisebasis ) |
Procedural fBm evaluated at "point"; returns value stored in "value".
| H | is the fractal increment parameter. |
| lacunarity | is the gap between successive frequencies. |
| octaves | is the number of frequencies in the fBm. |
Definition at line 1272 of file noise.c.
References BLI_noise_cell(), float, floorf, H, int, newPerlin(), orgBlenderNoiseS(), orgPerlinNoise(), powf, voronoi_CrS(), voronoi_F1F2S(), voronoi_F1S(), voronoi_F2S(), voronoi_F3S(), voronoi_F4S(), and z().
Referenced by M_Noise_fractal(), and mg_mFractalOrfBmTex().
| float BLI_noise_mg_hetero_terrain | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | H, | ||
| float | lacunarity, | ||
| float | octaves, | ||
| float | offset, | ||
| int | noisebasis ) |
Heterogeneous procedural terrain function: stats by altitude method. Evaluated at "point"; returns value stored in "value".
| H | Determines the fractal dimension of the roughest areas. |
| lacunarity | Is the gap between successive frequencies. |
| octaves | Is the number of frequencies in the fBm. |
| offset | Raises the terrain from sea level. |
Definition at line 1391 of file noise.c.
References BLI_noise_cell(), float, floorf, H, int, newPerlin(), orgBlenderNoiseS(), orgPerlinNoise(), powf, voronoi_CrS(), voronoi_F1F2S(), voronoi_F1S(), voronoi_F2S(), voronoi_F3S(), voronoi_F4S(), and z().
Referenced by M_Noise_hetero_terrain(), and mg_HTerrainTex().
| float BLI_noise_mg_hybrid_multi_fractal | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | H, | ||
| float | lacunarity, | ||
| float | octaves, | ||
| float | offset, | ||
| float | gain, | ||
| int | noisebasis ) |
Hybrid additive/multiplicative multi-fractal terrain model.
Some good parameter values to start with:
| H | 0.25 |
| offset | 0.7 |
Definition at line 1461 of file noise.c.
References BLI_noise_cell(), float, floorf, H, newPerlin(), orgBlenderNoiseS(), orgPerlinNoise(), powf, result, voronoi_CrS(), voronoi_F1F2S(), voronoi_F1S(), voronoi_F2S(), voronoi_F3S(), voronoi_F4S(), and z().
Referenced by M_Noise_hybrid_multi_fractal(), and mg_ridgedOrHybridMFTex().
| float BLI_noise_mg_multi_fractal | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | H, | ||
| float | lacunarity, | ||
| float | octaves, | ||
| int | noisebasis ) |
Procedural multi-fractal evaluated at "point"; returns value stored in "value".
| H | determines the highest fractal dimension. |
| lacunarity | is gap between successive frequencies. |
| octaves | is the number of frequencies in the fBm. |
offset, old docs read: is the zero offset, which determines multi-fractality. Definition at line 1332 of file noise.c.
References BLI_noise_cell(), float, floorf, H, int, newPerlin(), orgBlenderNoiseS(), orgPerlinNoise(), powf, voronoi_CrS(), voronoi_F1F2S(), voronoi_F1S(), voronoi_F2S(), voronoi_F3S(), voronoi_F4S(), and z().
Referenced by M_Noise_multi_fractal(), and mg_mFractalOrfBmTex().
| float BLI_noise_mg_ridged_multi_fractal | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | H, | ||
| float | lacunarity, | ||
| float | octaves, | ||
| float | offset, | ||
| float | gain, | ||
| int | noisebasis ) |
Ridged multi-fractal terrain model.
Some good parameter values to start with:
| H | 1.0 |
| offset | 1.0 |
| gain | 2.0 |
Definition at line 1537 of file noise.c.
References BLI_noise_cell(), fabsf, float, H, int, newPerlin(), orgBlenderNoiseS(), orgPerlinNoise(), powf, result, voronoi_CrS(), voronoi_F1F2S(), voronoi_F1S(), voronoi_F2S(), voronoi_F3S(), voronoi_F4S(), and z().
Referenced by M_Noise_ridged_multi_fractal(), and mg_ridgedOrHybridMFTex().
| float BLI_noise_mg_variable_lacunarity | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | distortion, | ||
| int | nbas1, | ||
| int | nbas2 ) |
"Variable Lacunarity Noise" A distorted variety of Perlin noise.
Definition at line 1608 of file noise.c.
References BLI_noise_cell(), float, newPerlin(), orgBlenderNoiseS(), orgPerlinNoise(), voronoi_CrS(), voronoi_F1F2S(), voronoi_F1S(), voronoi_F2S(), voronoi_F3S(), voronoi_F4S(), and z().
Referenced by M_Noise_variable_lacunarity(), and mg_distNoiseTex().
Original turbulence functions.
Definition at line 437 of file noise.c.
References BLI_noise_hnoise(), and z().
Referenced by fcm_noise_evaluate().
Not 'pure' Worley, but the results are virtually the same. Returns distances in da and point coords in pa.
Definition at line 915 of file noise.c.
References dist_Chebychev(), dist_Manhattan(), dist_Minkovsky(), dist_Minkovsky4(), dist_MinkovskyH(), dist_Real(), dist_Squared(), float, floor(), HASHPNT, int, and z().
Referenced by do_clump(), M_Noise_voronoi(), voronoi_F1(), voronoi_F1F2(), voronoi_F1F2S(), voronoi_F1S(), voronoi_F2(), voronoi_F2S(), voronoi_F3(), voronoi_F3S(), voronoi_F4(), voronoi_F4S(), and voronoiTex().
Definition at line 271 of file noise.c.
Referenced by adjustSwingAxisToUseEllipseNormal(), newPerlin(), and btSdfCollisionShape::queryPoint().
| BLI_INLINE float lerp | ( | float | t, |
| float | a, | ||
| float | b ) |
Definition at line 280 of file noise.c.
References A, B, floor(), grad(), hash, int, lerp, npfade(), v, w(), X, Y, Z, and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), BLI_noise_mg_variable_lacunarity(), and newPerlinU().
Definition at line 317 of file noise.c.
References newPerlin(), and z().
Referenced by BLI_noise_generic_noise(), and BLI_noise_generic_turbulence().
Definition at line 762 of file noise.c.
References b, float, g_perlin_data_ub, g_perlin_data_v3, lerp, SETUP, SURVE, v, and VALUE_AT.
Referenced by BLI_noise_hnoisep(), orgPerlinNoise(), and orgPerlinNoiseU().
| BLI_INLINE float npfade | ( | float | t | ) |
Definition at line 266 of file noise.c.
Referenced by newPerlin().
Definition at line 329 of file noise.c.
References floor(), hash, hashvectf, int, and z().
Referenced by BLI_noise_generic_noise(), BLI_noise_generic_turbulence(), BLI_noise_hnoise(), and orgBlenderNoiseS().
Definition at line 417 of file noise.c.
References orgBlenderNoise(), and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), and BLI_noise_mg_variable_lacunarity().
Definition at line 826 of file noise.c.
References noise3_perlin(), v, x, y, and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), and BLI_noise_mg_variable_lacunarity().
Definition at line 833 of file noise.c.
References noise3_perlin(), v, x, y, and z().
Referenced by BLI_noise_generic_noise(), and BLI_noise_generic_turbulence().
Definition at line 1045 of file noise.c.
References voronoi_F1F2(), and z().
Referenced by BLI_noise_generic_noise(), and BLI_noise_generic_turbulence().
Definition at line 1095 of file noise.c.
References voronoi_F1F2(), and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), and BLI_noise_mg_variable_lacunarity().
Definition at line 1009 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_generic_noise(), and BLI_noise_generic_turbulence().
Definition at line 1037 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_generic_noise(), BLI_noise_generic_turbulence(), voronoi_Cr(), and voronoi_CrS().
Definition at line 1087 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), and BLI_noise_mg_variable_lacunarity().
Signed version of all 6 of the above, just 2x-1, not really correct though (range is potentially (0, sqrt(6)). Used in the musgrave functions.
Definition at line 1059 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), and BLI_noise_mg_variable_lacunarity().
Definition at line 1016 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_generic_noise(), and BLI_noise_generic_turbulence().
Definition at line 1066 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), and BLI_noise_mg_variable_lacunarity().
Definition at line 1023 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_generic_noise(), and BLI_noise_generic_turbulence().
Definition at line 1073 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), and BLI_noise_mg_variable_lacunarity().
Definition at line 1030 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_generic_noise(), and BLI_noise_generic_turbulence().
Definition at line 1080 of file noise.c.
References BLI_noise_voronoi(), and z().
Referenced by BLI_noise_mg_fbm(), BLI_noise_mg_hetero_terrain(), BLI_noise_mg_hybrid_multi_fractal(), BLI_noise_mg_multi_fractal(), BLI_noise_mg_ridged_multi_fractal(), and BLI_noise_mg_variable_lacunarity().
|
static |
Definition at line 456 of file noise.c.
Referenced by noise3_perlin().
|
static |
Definition at line 492 of file noise.c.
Referenced by noise3_perlin().
|
static |
Definition at line 156 of file noise.c.
Referenced by orgBlenderNoise().