|
Blender V5.0
|
#include "MEM_guardedalloc.h"#include "BLI_math_matrix.h"#include "BLI_math_vector.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) |
| #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 ) |
Definition at line 67 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 295 of file hair_volume.cc.
References BLI_INLINE, fabsf, w(), x, y, and z().
Referenced by hair_grid_weights().
| BLI_INLINE int floor_int | ( | float | value | ) |
Definition at line 37 of file hair_volume.cc.
References BLI_INLINE.
Referenced by SIM_hair_volume_add_segment(), and SIM_hair_volume_create_vertex_grid().
| BLI_INLINE float floor_mod | ( | float | value | ) |
Definition at line 42 of file hair_volume.cc.
References BLI_INLINE, and floorf.
| BLI_INLINE void grid_to_world | ( | HairGrid * | grid, |
| float | vecw[3], | ||
| const float | vec[3] ) |
Definition at line 341 of file hair_volume.cc.
References add_v3_v3(), BLI_INLINE, HairGrid::cellsize, copy_v3_v3(), HairGrid::gmin, 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 82 of file hair_volume.cc.
References BLI_assert, BLI_INLINE, HAIR_GRID_INDEX_AXIS, and i.
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 105 of file hair_volume.cc.
References BLI_INLINE, data, 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 70 of file hair_volume.cc.
References BLI_INLINE, HAIR_GRID_INDEX_AXIS, and i.
| BLI_INLINE bool hair_grid_point_valid | ( | const float | vec[3], |
| const float | gmin[3], | ||
| const float | gmax[3] ) |
Definition at line 289 of file hair_volume.cc.
References BLI_INLINE.
Referenced by SIM_hair_volume_add_vertex().
| BLI_INLINE int hair_grid_size | ( | const int | res[3] | ) |
Definition at line 47 of file hair_volume.cc.
References BLI_INLINE.
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 312 of file hair_volume.cc.
References BLI_INLINE, dist_tent_v3f3(), HAIR_GRID_INDEX_AXIS, and i.
Referenced by SIM_hair_volume_add_vertex().
| BLI_INLINE float hair_volume_density_divergence | ( | float | density, |
| float | target_density, | ||
| float | strength ) |
Definition at line 690 of file hair_volume.cc.
References BLI_INLINE, 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 597 of file hair_volume.cc.
References BLI_INLINE, HairGridVert::density, len_v3v3(), madd_v3_v3fl(), HairGridVert::samples, v, HairGridVert::velocity, and x.
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 617 of file hair_volume.cc.
References float, floor_int(), hair_volume_eval_grid_vertex_sample(), i, interp_v3_v3v3(), HairGrid::inv_cellsize, max_ii(), min_ii(), HairGrid::res, v, v2, HairGrid::verts, and x.
Referenced by cloth_continuum_add_hair_segments().
Definition at line 348 of file hair_volume.cc.
References HairGridVert::density, HairGrid::gmax, HairGrid::gmin, hair_grid_point_valid(), hair_grid_weights(), HairGrid::inv_cellsize, madd_v3_v3fl(), HairGrid::res, v, HairGridVert::velocity, HairGrid::verts, and x.
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 1100 of file hair_volume.cc.
References HairGrid::cellsize, copy_v3_v3(), float, floor_int(), HairGrid::gmax, HairGrid::gmin, hair_grid_size(), i, HairGrid::inv_cellsize, MAX_HAIR_GRID_RES, MEM_calloc_arrayN(), MEM_callocN(), HairGrid::res, size(), sub_v3_v3v3(), and HairGrid::verts.
Referenced by cloth_continuum_step().
| void SIM_hair_volume_free_vertex_grid | ( | HairGrid * | grid | ) |
Definition at line 1157 of file hair_volume.cc.
References MEM_freeN(), and HairGrid::verts.
Referenced by cloth_continuum_step().
| void SIM_hair_volume_grid_clear | ( | HairGrid * | grid | ) |
Definition at line 277 of file hair_volume.cc.
References HairGridVert::density, hair_grid_size(), i, HairGrid::res, HairGridVert::samples, size(), HairGridVert::velocity, HairGridVert::velocity_smooth, HairGrid::verts, 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 1167 of file hair_volume.cc.
References HairGrid::cellsize, copy_v3_v3(), copy_v3_v3_int(), HairGrid::gmax, HairGrid::gmin, and HairGrid::res.
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 230 of file hair_volume.cc.
References HairGrid::gmin, hair_grid_interpolate(), HairGrid::inv_cellsize, HairGrid::res, HairGrid::verts, and x.
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 250 of file hair_volume.cc.
References add_v3_v3(), copy_v3_v3(), HairGrid::gmin, hair_grid_interpolate(), interp_v3_v3v3(), HairGrid::inv_cellsize, HairGrid::res, sub_v3_v3v3(), v, HairGrid::verts, and x.
Referenced by cloth_continuum_step().
| void SIM_hair_volume_normalize_vertex_grid | ( | HairGrid * | grid | ) |
Definition at line 671 of file hair_volume.cc.
References HairGridVert::density, hair_grid_size(), i, mul_v3_fl(), HairGrid::res, size(), HairGridVert::velocity, and HairGrid::verts.
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 701 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, HairGrid::cellsize, col, HairGridVert::density, density_threshold, float, HairGrid::gmin, grid_to_world(), hair_volume_density_divergence(), i, 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, HairGrid::res, sub_v3_v3v3(), HairGridVert::velocity, HairGridVert::velocity_smooth, HairGrid::verts, 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 191 of file hair_volume.cc.
References HairGrid::gmin, hair_grid_interpolate(), I, HairGrid::inv_cellsize, madd_v3_v3fl(), mul_m3_fl(), mul_v3_fl(), mul_v3_v3fl(), normalize_v3(), HairGrid::res, sub_m3_m3m3(), sub_v3_v3(), v, HairGrid::verts, x, zero_m3(), and zero_v3().
| BLI_INLINE float weights_sum | ( | const float | weights[8] | ) |
Definition at line 301 of file hair_volume.cc.
References BLI_INLINE, and i.
|
static |
Definition at line 684 of file hair_volume.cc.
Referenced by hair_volume_density_divergence(), and SIM_hair_volume_solve_divergence().
|
static |
Definition at line 35 of file hair_volume.cc.