Blender V2.61 - r43446
|
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_voxel.h"
#include "BLI_utildefines.h"
#include "RE_shader_ext.h"
#include "DNA_material_types.h"
#include "DNA_group_types.h"
#include "DNA_lamp_types.h"
#include "DNA_meta_types.h"
#include "BKE_global.h"
#include "render_types.h"
#include "pixelshading.h"
#include "rayintersection.h"
#include "rayobject.h"
#include "shading.h"
#include "shadbuf.h"
#include "texture.h"
#include "volumetric.h"
#include "volume_precache.h"
Go to the source code of this file.
Functions | |
BM_INLINE float | luminance (const float col[3]) |
static float | vol_get_shadow (ShadeInput *shi, LampRen *lar, const float co[3]) |
static int | vol_get_bounds (ShadeInput *shi, const float co[3], const float vec[3], float hitco[3], Isect *isect, int intersect_type) |
static void | shade_intersection (ShadeInput *shi, float col_r[4], Isect *is) |
static void | vol_trace_behind (ShadeInput *shi, VlakRen *vlr, const float co[3], float col_r[4]) |
static void | vol_get_precached_scattering (Render *re, ShadeInput *shi, float scatter_col[3], const float co[3]) |
static float | metadensity (Object *ob, const float co[3]) |
float | vol_get_density (struct ShadeInput *shi, const float co[3]) |
static void | vol_get_reflection_color (ShadeInput *shi, float ref_col[3], const float co[3]) |
static void | vol_get_emission (ShadeInput *shi, float emission_col[3], const float co[3]) |
static void | vol_get_sigma_t (ShadeInput *shi, float sigma_t[3], const float co[3]) |
static float | vol_get_phasefunc (ShadeInput *UNUSED(shi), float g, const float w[3], const float wp[3]) |
static void | vol_get_transmittance_seg (ShadeInput *shi, float tr[3], float stepsize, const float co[3], float density) |
static void | vol_get_transmittance (ShadeInput *shi, float tr[3], const float co[3], const float endco[3]) |
static void | vol_shade_one_lamp (struct ShadeInput *shi, const float co[3], const float view[3], LampRen *lar, float lacol[3]) |
void | vol_get_scattering (ShadeInput *shi, float scatter_col[3], const float co[3], const float view[3]) |
static void | volumeintegrate (struct ShadeInput *shi, float col[4], const float co[3], const float endco[3]) |
static void | volume_trace (struct ShadeInput *shi, struct ShadeResult *shr, int inside_volume) |
void | shade_volume_shadow (struct ShadeInput *shi, struct ShadeResult *shr, struct Isect *last_is) |
void | shade_volume_outside (ShadeInput *shi, ShadeResult *shr) |
void | shade_volume_inside (ShadeInput *shi, ShadeResult *shr) |
Variables | |
struct Render | R |
Definition in file volumetric.c.
BM_INLINE float luminance | ( | const float | col[3] | ) |
Definition at line 72 of file volumetric.c.
Referenced by shade_volume_shadow(), vol_shade_one_lamp(), and volumeintegrate().
static float metadensity | ( | Object * | ob, |
const float | co[3] | ||
) | [static] |
Definition at line 240 of file volumetric.c.
References Object::data, and Render::imat.
Referenced by vol_get_density().
static void shade_intersection | ( | ShadeInput * | shi, |
float | col_r[4], | ||
Isect * | is | ||
) | [static] |
Definition at line 155 of file volumetric.c.
References ShadeResult::alpha, ShadeInput::camera_co, ShadeResult::combined, ShadeInput::combinedflag, copy_v3_v3(), ShadeInput::depth, ShadeInput::lay, ShadeInput::light_override, ShadeInput::mask, ShadeInput::mat_override, ShadeInput::osatex, ShadeInput::passflag, SCE_PASS_COMBINED, shade_ray(), Isect::start, ShadeInput::thread, ShadeInput::volume_depth, ShadeInput::xs, and ShadeInput::ys.
Referenced by vol_trace_behind(), and volume_trace().
void shade_volume_inside | ( | ShadeInput * | shi, |
ShadeResult * | shr | ||
) |
Definition at line 798 of file volumetric.c.
References ShadeResult::alpha, CLAMP(), MatInside::ma, ShadeInput::mat, MatInside::obi, ShadeInput::obi, ObjectInstanceRen::obr, ShadeInput::obr, R, VOL_SHADE_INSIDE, and volume_trace().
Referenced by shade_material_loop().
void shade_volume_outside | ( | ShadeInput * | shi, |
ShadeResult * | shr | ||
) |
Definition at line 791 of file volumetric.c.
References VOL_SHADE_OUTSIDE, and volume_trace().
Referenced by shade_input_do_shade(), and shade_ray().
void shade_volume_shadow | ( | struct ShadeInput * | shi, |
struct ShadeResult * | shr, | ||
struct Isect * | last_is | ||
) |
Definition at line 743 of file volumetric.c.
References ShadeResult::alpha, ShadeInput::co, ShadeResult::combined, copy_v3_v3(), Isect::dist, Isect::face, ShadeInput::flippednor, Isect::hit, luminance(), Isect::ob, ShadeInput::obi, Isect::start, ShadeInput::view, ShadeInput::vlr, VOL_BOUNDS_DEPTH, vol_get_bounds(), and vol_get_transmittance().
Referenced by shade_ray().
static int vol_get_bounds | ( | ShadeInput * | shi, |
const float | co[3], | ||
const float | vec[3], | ||
float | hitco[3], | ||
Isect * | isect, | ||
int | intersect_type | ||
) | [static] |
Definition at line 123 of file volumetric.c.
References Isect::check, copy_v3_v3(), Isect::dir, Isect::dist, Isect::face, FLT_MAX, Isect::last_hit, Isect::lay, Isect::mode, NULL, Isect::ob, ShadeInput::obi, Isect::orig, R, RE_CHECK_VLR_NONE, RE_RAY_MIRROR, RE_rayobject_raycast(), RE_SKIP_VLR_NEIGHBOUR, Isect::skip, Isect::start, ShadeInput::vlr, and VOL_BOUNDS_DEPTH.
Referenced by shade_volume_shadow(), vol_shade_one_lamp(), and volume_trace().
float vol_get_density | ( | struct ShadeInput * | shi, |
const float | co[3] | ||
) |
Definition at line 286 of file volumetric.c.
References VolumeSettings::density, VolumeSettings::density_scale, do_volume_tex(), MAP_DENSITY, Material::mapto_textured, ShadeInput::mat, metadensity(), NULL, ObjectRen::ob, OB_MBALL, ShadeInput::obi, ObjectInstanceRen::obr, R, Object::type, and Material::vol.
Referenced by vol_get_transmittance(), and volumeintegrate().
static void vol_get_emission | ( | ShadeInput * | shi, |
float | emission_col[3], | ||
const float | co[3] | ||
) | [static] |
Definition at line 327 of file volumetric.c.
References copy_v3_v3(), do_volume_tex(), VolumeSettings::emission, emission(), VolumeSettings::emission_col, MAP_EMISSION, MAP_EMISSION_COL, Material::mapto_textured, ShadeInput::mat, R, and Material::vol.
Referenced by volumeintegrate().
static float vol_get_phasefunc | ( | ShadeInput * | UNUSEDshi, |
float | g, | ||
const float | w[3], | ||
const float | wp[3] | ||
) | [static] |
Definition at line 363 of file volumetric.c.
References dot_v3v3(), g, and normalize().
Referenced by vol_shade_one_lamp().
static void vol_get_precached_scattering | ( | Render * | re, |
ShadeInput * | shi, | ||
float | scatter_col[3], | ||
const float | co[3] | ||
) | [static] |
Definition at line 215 of file volumetric.c.
References VolumePrecache::data_b, VolumePrecache::data_g, VolumePrecache::data_r, global_bounds_obi(), mul_v3_m4v3(), ShadeInput::obi, VolumePrecache::res, sub_v3_v3v3(), Render::viewinv, ObjectInstanceRen::volume_precache, and voxel_sample_triquadratic().
Referenced by volumeintegrate().
static void vol_get_reflection_color | ( | ShadeInput * | shi, |
float | ref_col[3], | ||
const float | co[3] | ||
) | [static] |
Definition at line 307 of file volumetric.c.
References copy_v3_v3(), do_volume_tex(), MAP_REFLECTION, MAP_REFLECTION_COL, MAP_SCATTERING, Material::mapto_textured, ShadeInput::mat, NULL, R, VolumeSettings::reflection, reflection(), VolumeSettings::reflection_col, VolumeSettings::scattering, and Material::vol.
Referenced by vol_shade_one_lamp().
void vol_get_scattering | ( | ShadeInput * | shi, |
float | scatter_col[3], | ||
const float | co[3], | ||
const float | view[3] | ||
) |
Definition at line 548 of file volumetric.c.
References add_v3_v3(), ListBase::first, get_lights(), GroupObject::lampren, Render::lights, GroupObject::next, vol_shade_one_lamp(), and zero_v3().
Referenced by vol_precache_part(), and volumeintegrate().
static float vol_get_shadow | ( | ShadeInput * | shi, |
LampRen * | lar, | ||
const float | co[3] | ||
) | [static] |
Definition at line 78 of file volumetric.c.
References Isect::check, LampRen::co, copy_v3_v3(), Isect::dir, Isect::dist, Isect::face, LA_HEMI, LA_LAYER, LA_LAYER_SHADOW, LA_SHAD_RAY, LA_SUN, LampRen::last_hit, Isect::last_hit, LampRen::lay, Isect::lay, Isect::mode, LampRen::mode, normalize_v3(), NULL, Isect::ob, Isect::orig, R, RE_CHECK_VLR_NON_SOLID_MATERIAL, RE_RAY_MIRROR, RE_rayobject_raycast(), LampRen::shb, Isect::skip, Isect::start, sub_v3_v3v3(), testshadowbuf(), ShadeInput::thread, LampRen::type, and LampRen::vec.
Referenced by vol_shade_one_lamp().
static void vol_get_sigma_t | ( | ShadeInput * | shi, |
float | sigma_t[3], | ||
const float | co[3] | ||
) | [static] |
Definition at line 345 of file volumetric.c.
References do_volume_tex(), MAP_SCATTERING, MAP_TRANSMISSION_COL, Material::mapto_textured, ShadeInput::mat, R, VolumeSettings::scattering, VolumeSettings::transmission_col, and Material::vol.
Referenced by vol_get_transmittance(), and vol_get_transmittance_seg().
static void vol_get_transmittance | ( | ShadeInput * | shi, |
float | tr[3], | ||
const float | co[3], | ||
const float | endco[3] | ||
) | [static] |
Definition at line 430 of file volumetric.c.
References add_v3_v3(), BLI_thread_frand(), simple_enum_gen::d, expf, MA_VOL_STEP_CONSTANT, ShadeInput::mat, mul_v3_fl(), normalize_v3(), p, VolumeSettings::stepsize, VolumeSettings::stepsize_type, ShadeInput::thread, Material::vol, vol_get_density(), and vol_get_sigma_t().
Referenced by shade_volume_shadow(), and vol_shade_one_lamp().
static void vol_get_transmittance_seg | ( | ShadeInput * | shi, |
float | tr[3], | ||
float | stepsize, | ||
const float | co[3], | ||
float | density | ||
) | [static] |
Definition at line 410 of file volumetric.c.
References expf, and vol_get_sigma_t().
Referenced by volumeintegrate().
static void vol_shade_one_lamp | ( | struct ShadeInput * | shi, |
const float | co[3], | ||
const float | view[3], | ||
LampRen * | lar, | ||
float | lacol[3] | ||
) | [static] |
Definition at line 466 of file volumetric.c.
References VolumeSettings::asymmetry, LampRen::co, copy_v3_v3(), do_lamp_tex(), ELEM, ELEM3, LampRen::energy, Isect::face, Isect::hit, if(), LA_HEMI, LA_LAYER, LA_SUN, LA_TEXTURE, lamp_get_visibility(), ShadeInput::lay, ObjectInstanceRen::lay, LampRen::lay, len_v3v3(), luminance(), MA_TYPE_SURFACE, MA_VOL_RECV_EXT_SHADOW, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADED, MA_VOL_SHADE_SHADEDPLUSMULTIPLE, MA_VOL_SHADE_SHADOWED, VlakRen::mat, ShadeInput::mat, Material::material_type, LampRen::mode, mul_v3_fl(), mul_v3_v3v3(), negate_v3(), normalize_v3(), ShadeInput::obi, ShadeInput::osatex, p, LampRen::r, VolumeSettings::shade_type, VolumeSettings::shadeflag, LampRen::type, LampRen::vec, Material::vol, VOL_BOUNDS_SS, vol_get_bounds(), vol_get_phasefunc(), vol_get_reflection_color(), vol_get_shadow(), and vol_get_transmittance().
Referenced by vol_get_scattering().
static void vol_trace_behind | ( | ShadeInput * | shi, |
VlakRen * | vlr, | ||
const float | co[3], | ||
float | col_r[4] | ||
) | [static] |
Definition at line 188 of file volumetric.c.
References Isect::check, copy_v3_v3(), Isect::dir, Isect::dist, Isect::face, FLT_MAX, Isect::last_hit, Isect::lay, Isect::mode, NULL, Isect::ob, ShadeInput::obi, Isect::orig, R, RE_CHECK_VLR_NONE, RE_RAY_MIRROR, RE_rayobject_raycast(), RE_SKIP_VLR_NEIGHBOUR, shade_intersection(), shadeSkyView(), shadeSunView(), Isect::skip, Isect::start, ShadeInput::thread, and ShadeInput::view.
Referenced by volume_trace().
static void volume_trace | ( | struct ShadeInput * | shi, |
struct ShadeResult * | shr, | ||
int | inside_volume | ||
) | [static] |
Definition at line 649 of file volumetric.c.
References ShadeResult::alpha, ShadeInput::camera_co, ShadeInput::co, ShadeResult::combined, copy_v3_v3(), copy_v4_v4(), ShadeInput::depth, ShadeResult::diff, Isect::face, ShadeInput::flippednor, Isect::hit, if(), MatInside::ma, MA_TRANSP, MA_ZTRANSP, VlakRen::mat, ShadeInput::mat, Material::mode, MatInside::next, R, shade_intersection(), ShadeInput::view, ShadeInput::vlr, VOL_BOUNDS_DEPTH, vol_get_bounds(), VOL_SHADE_INSIDE, VOL_SHADE_OUTSIDE, vol_trace_behind(), and volumeintegrate().
Referenced by shade_volume_inside(), and shade_volume_outside().
static void volumeintegrate | ( | struct ShadeInput * | shi, |
float | col[4], | ||
const float | co[3], | ||
const float | endco[3] | ||
) | [static] |
Definition at line 587 of file volumetric.c.
References add_v3_v3(), BLI_thread_frand(), VolumeSettings::depth_cutoff, luminance(), MA_VOL_STEP_CONSTANT, ShadeInput::mat, mul_v3_fl(), mul_v3_v3v3(), normalize_v3(), ShadeInput::obi, p, R, VolumeSettings::stepsize, VolumeSettings::stepsize_type, ShadeInput::thread, ShadeInput::view, Material::vol, vol_get_density(), vol_get_emission(), vol_get_precached_scattering(), vol_get_scattering(), vol_get_transmittance_seg(), and ObjectInstanceRen::volume_precache.
Referenced by volume_trace().
Definition at line 127 of file pipeline.c.