|
Blender V4.3
|
#include <algorithm>#include "MEM_guardedalloc.h"#include "BLI_math_matrix.h"#include "BLI_math_vector.h"#include "BLI_utildefines.h"#include "DNA_texture_types.h"#include "BKE_effect.h"#include "eigen_utils.h"#include "implicit.h"Go to the source code of this file.
Classes | |
| struct | HairGridVert |
| struct | HairGrid |
Macros | |
| #define | HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, axis) min_ii(max_ii(int((vec[axis] - gmin[axis]) * scale), 0), res[axis] - 2) |
| #define | MARGIN_i0 (i < 1) |
| #define | MARGIN_j0 (j < 1) |
| #define | MARGIN_k0 (k < 1) |
| #define | MARGIN_i1 (i >= resA[0] - 1) |
| #define | MARGIN_j1 (j >= resA[1] - 1) |
| #define | MARGIN_k1 (k >= resA[2] - 1) |
| #define | NEIGHBOR_MARGIN_i0 (i < 2) |
| #define | NEIGHBOR_MARGIN_j0 (j < 2) |
| #define | NEIGHBOR_MARGIN_k0 (k < 2) |
| #define | NEIGHBOR_MARGIN_i1 (i >= resA[0] - 2) |
| #define | NEIGHBOR_MARGIN_j1 (j >= resA[1] - 2) |
| #define | NEIGHBOR_MARGIN_k1 (k >= resA[2] - 2) |
Functions | |
| BLI_INLINE int | floor_int (float value) |
| BLI_INLINE float | floor_mod (float value) |
| BLI_INLINE int | hair_grid_size (const int res[3]) |
| BLI_INLINE int | hair_grid_offset (const float vec[3], const int res[3], const float gmin[3], float scale) |
| BLI_INLINE int | hair_grid_interp_weights (const int res[3], const float gmin[3], float scale, const float vec[3], float uvw[3]) |
| BLI_INLINE void | hair_grid_interpolate (const HairGridVert *grid, const int res[3], const float gmin[3], float scale, const float vec[3], float *density, float velocity[3], float vel_smooth[3], float density_gradient[3], float velocity_gradient[3][3]) |
| void | SIM_hair_volume_vertex_grid_forces (HairGrid *grid, const float x[3], const float v[3], float smoothfac, float pressurefac, float minpressure, float f[3], float dfdx[3][3], float dfdv[3][3]) |
| void | SIM_hair_volume_grid_interpolate (HairGrid *grid, const float x[3], float *density, float velocity[3], float velocity_smooth[3], float density_gradient[3], float velocity_gradient[3][3]) |
| void | SIM_hair_volume_grid_velocity (HairGrid *grid, const float x[3], const float v[3], float fluid_factor, float r_v[3]) |
| void | SIM_hair_volume_grid_clear (HairGrid *grid) |
| BLI_INLINE bool | hair_grid_point_valid (const float vec[3], const float gmin[3], const float gmax[3]) |
| BLI_INLINE float | dist_tent_v3f3 (const float a[3], float x, float y, float z) |
| BLI_INLINE float | weights_sum (const float weights[8]) |
| BLI_INLINE int | hair_grid_weights (const int res[3], const float gmin[3], float scale, const float vec[3], float weights[8]) |
| BLI_INLINE void | grid_to_world (HairGrid *grid, float vecw[3], const float vec[3]) |
| void | SIM_hair_volume_add_vertex (HairGrid *grid, const float x[3], const float v[3]) |
| BLI_INLINE void | hair_volume_eval_grid_vertex_sample (HairGridVert *vert, const float loc[3], float radius, float dist_scale, const float x[3], const float v[3]) |
| void | SIM_hair_volume_add_segment (HairGrid *grid, const float[3], const float[3], const float x2[3], const float v2[3], const float x3[3], const float v3[3], const float[3], const float[3], const float[3], const float[3], const float[3]) |
| void | SIM_hair_volume_normalize_vertex_grid (HairGrid *grid) |
| BLI_INLINE float | hair_volume_density_divergence (float density, float target_density, float strength) |
| bool | SIM_hair_volume_solve_divergence (HairGrid *grid, float, float target_density, float target_strength) |
| HairGrid * | SIM_hair_volume_create_vertex_grid (float cellsize, const float gmin[3], const float gmax[3]) |
| void | SIM_hair_volume_free_vertex_grid (HairGrid *grid) |
| void | SIM_hair_volume_grid_geometry (HairGrid *grid, float *cellsize, int res[3], float gmin[3], float gmax[3]) |
Variables | |
| static float | I [3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}} |
| static const float | density_threshold = 0.001f |
| #define HAIR_GRID_INDEX_AXIS | ( | vec, | |
| res, | |||
| gmin, | |||
| scale, | |||
| axis ) min_ii(max_ii(int((vec[axis] - gmin[axis]) * scale), 0), res[axis] - 2) |
Definition at line 74 of file hair_volume.cc.
Referenced by hair_grid_interp_weights(), hair_grid_offset(), and hair_grid_weights().
| #define MARGIN_i0 (i < 1) |
Referenced by SIM_hair_volume_solve_divergence().
| #define MARGIN_i1 (i >= resA[0] - 1) |
Referenced by SIM_hair_volume_solve_divergence().
| #define MARGIN_j0 (j < 1) |
Referenced by SIM_hair_volume_solve_divergence().
| #define MARGIN_j1 (j >= resA[1] - 1) |
Referenced by SIM_hair_volume_solve_divergence().
| #define MARGIN_k0 (k < 1) |
Referenced by SIM_hair_volume_solve_divergence().
| #define MARGIN_k1 (k >= resA[2] - 1) |
Referenced by SIM_hair_volume_solve_divergence().
| #define NEIGHBOR_MARGIN_i0 (i < 2) |
Referenced by SIM_hair_volume_solve_divergence().
| #define NEIGHBOR_MARGIN_i1 (i >= resA[0] - 2) |
Referenced by SIM_hair_volume_solve_divergence().
| #define NEIGHBOR_MARGIN_j0 (j < 2) |
Referenced by SIM_hair_volume_solve_divergence().
| #define NEIGHBOR_MARGIN_j1 (j >= resA[1] - 2) |
Referenced by SIM_hair_volume_solve_divergence().
| #define NEIGHBOR_MARGIN_k0 (k < 2) |
Referenced by SIM_hair_volume_solve_divergence().
| #define NEIGHBOR_MARGIN_k1 (k >= resA[2] - 2) |
Referenced by SIM_hair_volume_solve_divergence().
Definition at line 302 of file hair_volume.cc.
References fabsf, w(), and z().
Referenced by hair_grid_weights().
| BLI_INLINE int floor_int | ( | float | value | ) |
Definition at line 44 of file hair_volume.cc.
References int.
Referenced by SIM_hair_volume_add_segment(), and SIM_hair_volume_create_vertex_grid().
| BLI_INLINE float floor_mod | ( | float | value | ) |
Definition at line 49 of file hair_volume.cc.
References floorf.
| BLI_INLINE void grid_to_world | ( | HairGrid * | grid, |
| float | vecw[3], | ||
| const float | vec[3] ) |
Definition at line 348 of file hair_volume.cc.
References add_v3_v3(), copy_v3_v3(), and mul_v3_fl().
Referenced by blender::eevee::VolumeProbeModule::set_view(), and SIM_hair_volume_solve_divergence().
| BLI_INLINE int hair_grid_interp_weights | ( | const int | res[3], |
| const float | gmin[3], | ||
| float | scale, | ||
| const float | vec[3], | ||
| float | uvw[3] ) |
Definition at line 89 of file hair_volume.cc.
References BLI_assert, and HAIR_GRID_INDEX_AXIS.
Referenced by hair_grid_interpolate().
| BLI_INLINE void hair_grid_interpolate | ( | const HairGridVert * | grid, |
| const int | res[3], | ||
| const float | gmin[3], | ||
| float | scale, | ||
| const float | vec[3], | ||
| float * | density, | ||
| float | velocity[3], | ||
| float | vel_smooth[3], | ||
| float | density_gradient[3], | ||
| float | velocity_gradient[3][3] ) |
Definition at line 112 of file hair_volume.cc.
References hair_grid_interp_weights(), and zero_m3().
Referenced by SIM_hair_volume_grid_interpolate(), SIM_hair_volume_grid_velocity(), and SIM_hair_volume_vertex_grid_forces().
| BLI_INLINE int hair_grid_offset | ( | const float | vec[3], |
| const int | res[3], | ||
| const float | gmin[3], | ||
| float | scale ) |
Definition at line 77 of file hair_volume.cc.
References HAIR_GRID_INDEX_AXIS.
| BLI_INLINE bool hair_grid_point_valid | ( | const float | vec[3], |
| const float | gmin[3], | ||
| const float | gmax[3] ) |
Definition at line 296 of file hair_volume.cc.
Referenced by SIM_hair_volume_add_vertex().
| BLI_INLINE int hair_grid_size | ( | const int | res[3] | ) |
Definition at line 54 of file hair_volume.cc.
Referenced by SIM_hair_volume_create_vertex_grid(), SIM_hair_volume_grid_clear(), and SIM_hair_volume_normalize_vertex_grid().
| BLI_INLINE int hair_grid_weights | ( | const int | res[3], |
| const float | gmin[3], | ||
| float | scale, | ||
| const float | vec[3], | ||
| float | weights[8] ) |
Definition at line 319 of file hair_volume.cc.
References dist_tent_v3f3(), and HAIR_GRID_INDEX_AXIS.
Referenced by SIM_hair_volume_add_vertex().
| BLI_INLINE float hair_volume_density_divergence | ( | float | density, |
| float | target_density, | ||
| float | strength ) |
Definition at line 697 of file hair_volume.cc.
References density_threshold, and logf.
Referenced by SIM_hair_volume_solve_divergence().
| BLI_INLINE void hair_volume_eval_grid_vertex_sample | ( | HairGridVert * | vert, |
| const float | loc[3], | ||
| float | radius, | ||
| float | dist_scale, | ||
| const float | x[3], | ||
| const float | v[3] ) |
Definition at line 604 of file hair_volume.cc.
References HairGridVert::density, len_v3v3(), madd_v3_v3fl(), HairGridVert::samples, v, and HairGridVert::velocity.
Referenced by SIM_hair_volume_add_segment().
| void SIM_hair_volume_add_segment | ( | HairGrid * | grid, |
| const float | x1[3], | ||
| const float | v1[3], | ||
| const float | x2[3], | ||
| const float | v2[3], | ||
| const float | x3[3], | ||
| const float | v3[3], | ||
| const float | x4[3], | ||
| const float | v4[3], | ||
| const float | dir1[3], | ||
| const float | dir2[3], | ||
| const float | dir3[3] ) |
Definition at line 624 of file hair_volume.cc.
References float, floor_int(), hair_volume_eval_grid_vertex_sample(), interp_v3_v3v3(), max_ii(), min_ii(), v, and v2.
Referenced by cloth_continuum_add_hair_segments().
Definition at line 355 of file hair_volume.cc.
References hair_grid_point_valid(), hair_grid_weights(), madd_v3_v3fl(), and v.
Referenced by cloth_continuum_fill_grid().
| HairGrid * SIM_hair_volume_create_vertex_grid | ( | float | cellsize, |
| const float | gmin[3], | ||
| const float | gmax[3] ) |
Definition at line 1107 of file hair_volume.cc.
References copy_v3_v3(), float, floor_int(), hair_grid_size(), MAX_HAIR_GRID_RES, MEM_callocN, size(), and sub_v3_v3v3().
Referenced by cloth_continuum_step().
| void SIM_hair_volume_free_vertex_grid | ( | HairGrid * | grid | ) |
Definition at line 1164 of file hair_volume.cc.
References MEM_freeN().
Referenced by cloth_continuum_step().
| void SIM_hair_volume_grid_clear | ( | HairGrid * | grid | ) |
Definition at line 284 of file hair_volume.cc.
References hair_grid_size(), size(), and zero_v3().
| void SIM_hair_volume_grid_geometry | ( | HairGrid * | grid, |
| float * | cellsize, | ||
| int | res[3], | ||
| float | gmin[3], | ||
| float | gmax[3] ) |
Definition at line 1174 of file hair_volume.cc.
References copy_v3_v3(), and copy_v3_v3_int().
Referenced by cloth_continuum_fill_grid(), and cloth_continuum_step().
| void SIM_hair_volume_grid_interpolate | ( | HairGrid * | grid, |
| const float | x[3], | ||
| float * | density, | ||
| float | velocity[3], | ||
| float | velocity_smooth[3], | ||
| float | density_gradient[3], | ||
| float | velocity_gradient[3][3] ) |
Definition at line 237 of file hair_volume.cc.
References hair_grid_interpolate().
Referenced by cloth_continuum_step().
| void SIM_hair_volume_grid_velocity | ( | struct HairGrid * | grid, |
| const float | x[3], | ||
| const float | v[3], | ||
| float | fluid_factor, | ||
| float | r_v[3] ) |
Effect of fluid simulation grid on velocities. fluid_factor controls blending between PIC (Particle-in-Cell) and FLIP (Fluid-Implicit-Particle) methods (0 = only PIC, 1 = only FLIP)
Definition at line 257 of file hair_volume.cc.
References add_v3_v3(), copy_v3_v3(), hair_grid_interpolate(), interp_v3_v3v3(), sub_v3_v3v3(), and v.
Referenced by cloth_continuum_step().
| void SIM_hair_volume_normalize_vertex_grid | ( | HairGrid * | grid | ) |
Definition at line 678 of file hair_volume.cc.
References hair_grid_size(), mul_v3_fl(), and size().
Referenced by cloth_continuum_fill_grid().
| bool SIM_hair_volume_solve_divergence | ( | HairGrid * | grid, |
| float | dt, | ||
| float | target_density, | ||
| float | target_strength ) |
Definition at line 708 of file hair_volume.cc.
References A, add_v3_v3v3(), B, BKE_sim_debug_data_add_circle, BKE_sim_debug_data_add_dot, BKE_sim_debug_data_add_vector, BLI_assert, col, HairGridVert::density, density_threshold, float, grid_to_world(), hair_volume_density_divergence(), interp_v3_v3v3(), MARGIN_i0, MARGIN_i1, MARGIN_j0, MARGIN_j1, MARGIN_k0, MARGIN_k1, mul_v3_fl(), NEIGHBOR_MARGIN_i0, NEIGHBOR_MARGIN_i1, NEIGHBOR_MARGIN_j0, NEIGHBOR_MARGIN_j1, NEIGHBOR_MARGIN_k0, NEIGHBOR_MARGIN_k1, sub_v3_v3v3(), HairGridVert::velocity, HairGridVert::velocity_smooth, and zero_v3().
Referenced by cloth_continuum_step().
| void SIM_hair_volume_vertex_grid_forces | ( | struct HairGrid * | grid, |
| const float | x[3], | ||
| const float | v[3], | ||
| float | smoothfac, | ||
| float | pressurefac, | ||
| float | minpressure, | ||
| float | f[3], | ||
| float | dfdx[3][3], | ||
| float | dfdv[3][3] ) |
WARNING: expressing grid effects on velocity as a force is not very stable, due to discontinuities in interpolated values! Better use hybrid approaches such as described in "Detail Preserving Continuum Simulation of Straight Hair" (McAdams, Selle 2009)
Definition at line 198 of file hair_volume.cc.
References hair_grid_interpolate(), I, madd_v3_v3fl(), mul_m3_fl(), mul_v3_fl(), mul_v3_v3fl(), normalize_v3(), sub_m3_m3m3(), sub_v3_v3(), v, zero_m3(), and zero_v3().
| BLI_INLINE float weights_sum | ( | const float | weights[8] | ) |
Definition at line 308 of file hair_volume.cc.
Referenced by blender::compositor::karis_brightness_weighted_sum().
|
static |
Definition at line 691 of file hair_volume.cc.
Referenced by hair_volume_density_divergence(), and SIM_hair_volume_solve_divergence().
|
static |
Definition at line 42 of file hair_volume.cc.
Referenced by SIM_hair_volume_vertex_grid_forces().