Blender V2.61 - r43446
|
#include <stdio.h>
#include <float.h>
#include <math.h>
#include <string.h>
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_colortools.h"
#include "BKE_material.h"
#include "BKE_texture.h"
#include "DNA_group_types.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "occlusion.h"
#include "renderpipeline.h"
#include "render_types.h"
#include "pixelblending.h"
#include "rendercore.h"
#include "shadbuf.h"
#include "sss.h"
#include "texture.h"
#include "shading.h"
Go to the source code of this file.
Functions | |
ListBase * | get_lights (ShadeInput *shi) |
float | mistfactor (float zcor, float const co[3]) |
static void | spothalo (struct LampRen *lar, ShadeInput *shi, float *intens) |
void | renderspothalo (ShadeInput *shi, float col[4], float alpha) |
static double | Normalize_d (double *n) |
float | fresnel_fac (float *view, float *vn, float grad, float fac) |
static double | saacos_d (double fac) |
static float | area_lamp_energy (float(*area)[3], float *co, float *vn) |
static float | area_lamp_energy_multisample (LampRen *lar, float *co, float *vn) |
static float | spec (float inp, int hard) |
static float | Phong_Spec (float *n, float *l, float *v, int hard, int tangent) |
static float | CookTorr_Spec (float *n, float *l, float *v, int hard, int tangent) |
static float | Blinn_Spec (float *n, float *l, float *v, float refrac, float spec_power, int tangent) |
static float | Toon_Spec (float *n, float *l, float *v, float size, float smooth, int tangent) |
static float | WardIso_Spec (float *n, float *l, float *v, float rms, int tangent) |
static float | Toon_Diff (float *n, float *l, float *UNUSED(v), float size, float smooth) |
static float | OrenNayar_Diff (float nl, float *n, float *l, float *v, float rough) |
static float | Minnaert_Diff (float nl, float *n, float *v, float darkness) |
static float | Fresnel_Diff (float *vn, float *lv, float *UNUSED(view), float fac_i, float fac) |
void | calc_R_ref (ShadeInput *shi) |
void | shade_color (ShadeInput *shi, ShadeResult *shr) |
static void | ramp_diffuse_result (float *diff, ShadeInput *shi) |
static void | add_to_diffuse (float *diff, ShadeInput *shi, float is, float r, float g, float b) |
static void | ramp_spec_result (float spec_col[3], ShadeInput *shi) |
static void | do_specular_ramp (ShadeInput *shi, float is, float t, float spec[3]) |
void | ambient_occlusion (ShadeInput *shi) |
static void | ambient_occlusion_apply (ShadeInput *shi, ShadeResult *shr) |
void | environment_lighting_apply (ShadeInput *shi, ShadeResult *shr) |
static void | indirect_lighting_apply (ShadeInput *shi, ShadeResult *shr) |
void | lamp_get_shadow (LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real) |
float | lamp_get_visibility (LampRen *lar, const float co[3], float lv[3], float *dist) |
static void | shade_one_light (LampRen *lar, ShadeInput *shi, ShadeResult *shr, int passflag) |
static void | shade_lamp_loop_only_shadow (ShadeInput *shi, ShadeResult *shr) |
static void | wrld_exposure_correct (float diff[3]) |
void | shade_lamp_loop (ShadeInput *shi, ShadeResult *shr) |
Variables | |
struct Render | R |
Definition in file shadeoutput.c.
static void add_to_diffuse | ( | float * | diff, |
ShadeInput * | shi, | ||
float | is, | ||
float | r, | ||
float | g, | ||
float | b | ||
) | [static] |
Definition at line 915 of file shadeoutput.c.
References ShadeInput::b, do_colorband(), ShadeInput::g, MA_RAMP_COL, MA_RAMP_IN_ENERGY, MA_RAMP_IN_NOR, MA_RAMP_IN_RESULT, MA_RAMP_IN_SHADER, ShadeInput::mat, Material::mode, ShadeInput::r, ramp_blend(), Material::ramp_col, Material::rampblend_col, Material::rampfac_col, Material::rampin_col, ShadeInput::view, and ShadeInput::vn.
Referenced by shade_one_light().
void ambient_occlusion | ( | ShadeInput * | shi | ) |
Definition at line 1031 of file shadeoutput.c.
References Material::amb, ShadeInput::ao, ShadeInput::env, ShadeInput::mat, R, R_RAYTRACE, ray_ao(), sample_occ(), and WO_AOGATHER_APPROX.
Referenced by bake_shade(), shade_lamp_loop(), and shade_samples_do_AO().
static void ambient_occlusion_apply | ( | ShadeInput * | shi, |
ShadeResult * | shr | ||
) | [static] |
Definition at line 1043 of file shadeoutput.c.
References ShadeInput::ao, ShadeInput::b, ShadeResult::combined, copy_v3_v3(), ShadeInput::g, interp_v3_v3v3(), mul_v3_v3v3(), ShadeInput::r, R, R_RAYTRACE, ShadeInput::refl, ShadeResult::spec, WO_AOADD, WO_AOGATHER_APPROX, and WO_AOMUL.
Referenced by shade_lamp_loop().
static float area_lamp_energy | ( | float(*) | area[3], |
float * | co, | ||
float * | vn | ||
) | [static] |
Definition at line 431 of file shadeoutput.c.
References CROSS, cross(), Normalize_d(), saacos_d(), and VECSUB.
Referenced by area_lamp_energy_multisample().
static float area_lamp_energy_multisample | ( | LampRen * | lar, |
float * | co, | ||
float * | vn | ||
) | [static] |
Definition at line 480 of file shadeoutput.c.
References add_v3_v3v3(), LampRen::area, area_lamp_energy(), LampRen::areasize, LampRen::co, dot_v3v3(), LampRen::jitter, LampRen::k, LampRen::mat, mul_m3_v3(), pow(), LampRen::ray_totsamp, sub_v3_v3v3(), and LampRen::vec.
Referenced by shade_one_light().
static float Blinn_Spec | ( | float * | n, |
float * | l, | ||
float * | v, | ||
float | refrac, | ||
float | spec_power, | ||
int | tangent | ||
) | [static] |
Definition at line 597 of file shadeoutput.c.
References KDL::exp(), g, i, normalize_v3(), p, saacos(), sasqrt(), and sqrt().
Referenced by shade_one_light().
void calc_R_ref | ( | ShadeInput * | shi | ) |
Definition at line 815 of file shadeoutput.c.
References ShadeInput::dxno, ShadeInput::dxref, ShadeInput::dxview, ShadeInput::dyno, ShadeInput::dyref, ShadeInput::dyview, VlakRen::flag, i, ShadeInput::osatex, R_SMOOTH, ShadeInput::ref, ShadeInput::view, ShadeInput::vlr, and ShadeInput::vn.
Referenced by do_material_tex().
static float CookTorr_Spec | ( | float * | n, |
float * | l, | ||
float * | v, | ||
int | hard, | ||
int | tangent | ||
) | [static] |
Definition at line 573 of file shadeoutput.c.
References i, normalize_v3(), sasqrt(), and spec().
Referenced by shade_one_light().
static void do_specular_ramp | ( | ShadeInput * | shi, |
float | is, | ||
float | t, | ||
float | spec[3] | ||
) | [static] |
Definition at line 991 of file shadeoutput.c.
References do_colorband(), MA_RAMP_IN_ENERGY, MA_RAMP_IN_NOR, MA_RAMP_IN_RESULT, MA_RAMP_IN_SHADER, ShadeInput::mat, ramp_blend(), Material::ramp_spec, Material::rampblend_spec, Material::rampfac_spec, Material::rampin_spec, ShadeInput::specb, ShadeInput::specg, ShadeInput::specr, ShadeInput::view, and ShadeInput::vn.
Referenced by shade_one_light().
void environment_lighting_apply | ( | ShadeInput * | shi, |
ShadeResult * | shr | ||
) |
Definition at line 1073 of file shadeoutput.c.
References ShadeInput::amb, ShadeInput::b, ShadeResult::combined, ShadeInput::env, ShadeInput::g, ShadeInput::r, R, R_RAYTRACE, ShadeInput::refl, and WO_AOGATHER_APPROX.
Referenced by bake_shade(), and shade_lamp_loop().
static float Fresnel_Diff | ( | float * | vn, |
float * | lv, | ||
float * | UNUSEDview, | ||
float | fac_i, | ||
float | fac | ||
) | [static] |
Definition at line 808 of file shadeoutput.c.
References fresnel_fac().
Referenced by shade_one_light().
float fresnel_fac | ( | float * | view, |
float * | vn, | ||
float | grad, | ||
float | fac | ||
) |
Definition at line 406 of file shadeoutput.c.
Referenced by Fresnel_Diff(), ray_trace(), shade_color(), shade_lamp_loop(), and traceray().
ListBase* get_lights | ( | ShadeInput * | shi | ) |
Definition at line 66 of file shadeoutput.c.
References Group::gobject, Material::group, ShadeInput::light_override, ShadeInput::mat, R, and R_PREVIEWBUTS.
Referenced by renderspothalo(), shade_lamp_loop(), shade_lamp_loop_only_shadow(), and vol_get_scattering().
static void indirect_lighting_apply | ( | ShadeInput * | shi, |
ShadeResult * | shr | ||
) | [static] |
Definition at line 1087 of file shadeoutput.c.
References ShadeInput::b, ShadeResult::combined, ShadeInput::g, ShadeInput::indirect, ShadeInput::r, R, R_RAYTRACE, ShadeInput::refl, and WO_AOGATHER_APPROX.
Referenced by shade_lamp_loop().
void lamp_get_shadow | ( | LampRen * | lar, |
ShadeInput * | shi, | ||
float | inp, | ||
float | shadfac[4], | ||
int | do_real | ||
) |
Definition at line 1102 of file shadeoutput.c.
References LampRen::buftype, ShadeInput::co, copy_v4_v4(), ShadeInput::depth, ShadeInput::dxco, ShadeInput::dyco, ISB_getshadow(), LA_SHAD_RAY, LA_SHADBUF_IRREGULAR, Material::lbias, ShadeInput::mat, LampRen::mode, R, ray_shadow(), LampShadowSample::s, ShadeInput::sample, ShadeInput::samplenr, LampShadowSubSample::samplenr, LampShadowSubSample::shadfac, LampRen::shadsamp, LampRen::shb, testshadowbuf(), and ShadeInput::thread.
Referenced by shade_lamp_loop_only_shadow(), and shade_one_light().
float lamp_get_visibility | ( | LampRen * | lar, |
const float | co[3], | ||
float | lv[3], | ||
float * | dist | ||
) |
Definition at line 1131 of file shadeoutput.c.
References LampRen::co, copy_v3_v3(), LampRen::curfalloff, curvemapping_evaluateF(), LampRen::dist, LampRen::distkw, dot_v3v3(), fabs(), LampRen::falloff_type, i, LampRen::imat, LA_AREA, LA_FALLOFF_CONSTANT, LA_FALLOFF_CURVE, LA_FALLOFF_INVLINEAR, LA_FALLOFF_INVSQUARE, LA_FALLOFF_SLIDERS, LA_HEMI, LA_SPHERE, LA_SPOT, LA_SQUARE, LA_SUN, LampRen::ld1, LampRen::ld2, MAX2, LampRen::mode, mul_m3_v3(), mul_v3_fl(), LampRen::spotbl, LampRen::spotsi, sqrt(), sqrtf, sub_v3_v3v3(), LampRen::type, and LampRen::vec.
static float Minnaert_Diff | ( | float | nl, |
float * | n, | ||
float * | v, | ||
float | darkness | ||
) | [static] |
Definition at line 786 of file shadeoutput.c.
References i, MAX2, and pow().
Referenced by shade_one_light().
float mistfactor | ( | float | zcor, |
float const | co[3] | ||
) |
Definition at line 122 of file shadeoutput.c.
Referenced by shade_input_do_shade(), shadeHaloFloat(), and spothalo().
static double Normalize_d | ( | double * | n | ) | [static] |
Definition at line 386 of file shadeoutput.c.
References simple_enum_gen::d, and sqrt().
Referenced by area_lamp_energy().
static float OrenNayar_Diff | ( | float | nl, |
float * | n, | ||
float * | l, | ||
float * | v, | ||
float | rough | ||
) | [static] |
Definition at line 726 of file shadeoutput.c.
References A, B, i, normalize_v3(), saacos(), sinf, and tanf.
Referenced by shade_one_light().
static float Phong_Spec | ( | float * | n, |
float * | l, | ||
float * | v, | ||
int | hard, | ||
int | tangent | ||
) | [static] |
Definition at line 552 of file shadeoutput.c.
References normalize_v3(), sasqrt(), and spec().
Referenced by shade_one_light().
static void ramp_diffuse_result | ( | float * | diff, |
ShadeInput * | shi | ||
) | [static] |
Definition at line 896 of file shadeoutput.c.
References do_colorband(), MA_RAMP_IN_RESULT, ShadeInput::mat, ramp_blend(), Material::ramp_col, Material::rampblend_col, Material::rampfac_col, Material::rampin_col, and rgb_to_grayscale().
Referenced by shade_lamp_loop().
static void ramp_spec_result | ( | float | spec_col[3], |
ShadeInput * | shi | ||
) | [static] |
Definition at line 972 of file shadeoutput.c.
References do_colorband(), MA_RAMP_IN_RESULT, ShadeInput::mat, ramp_blend(), Material::ramp_spec, Material::rampblend_spec, Material::rampfac_spec, Material::rampin_spec, and rgb_to_grayscale().
Referenced by shade_lamp_loop().
void renderspothalo | ( | ShadeInput * | shi, |
float | col[4], | ||
float | alpha | ||
) |
Definition at line 347 of file shadeoutput.c.
References LampRen::b, LampRen::buftype, ListBase::first, LampRen::g, get_lights(), LampRen::haint, i, LA_HALO, LA_LAYER, LA_SHADBUF_DEEP, LA_SPOT, GroupObject::lampren, ShadeInput::lay, ObjectInstanceRen::lay, LampRen::lay, Render::lights, LampRen::mode, GroupObject::next, NULL, ShadeInput::obi, LampRen::r, spothalo(), LampRen::type, and ShadeInput::vlr.
Referenced by lamphalo_tile(), shade_tra_samples(), and strand_shade_point().
static double saacos_d | ( | double | fac | ) | [static] |
Definition at line 423 of file shadeoutput.c.
Referenced by area_lamp_energy().
void shade_color | ( | ShadeInput * | shi, |
ShadeResult * | shr | ||
) |
Definition at line 863 of file shadeoutput.c.
References ShadeResult::alpha, ShadeInput::alpha, ShadeInput::b, ShadeResult::diff, do_material_tex(), fresnel_fac(), Material::fresnel_tra, Material::fresnel_tra_i, ShadeInput::g, MA_FACETEXTURE, MA_FACETEXTURE_ALPHA, MA_TRANSP, MA_VERTEXCOLP, ShadeInput::mat, ShadeInput::mode, Material::mode, R, ShadeInput::r, Material::texco, ShadeInput::vcol, ShadeInput::view, and ShadeInput::vn.
Referenced by shade_ray().
void shade_lamp_loop | ( | ShadeInput * | shi, |
ShadeResult * | shr | ||
) |
Definition at line 1645 of file shadeoutput.c.
References add_v3_v3(), ShadeResult::alpha, ShadeInput::alpha, ShadeInput::ambb, ShadeInput::ambg, ambient_occlusion(), ambient_occlusion_apply(), ShadeInput::ambr, ShadeInput::ao, ShadeResult::ao, ShadeInput::b, CLAMP(), ShadeInput::co, Object::col, ShadeResult::col, ShadeResult::combined, ShadeInput::combinedflag, copy_v3_v3(), copy_v4_v4(), ShadeInput::depth, ShadeResult::diff, do_material_tex(), ShadeInput::emit, ShadeResult::emit, ShadeInput::env, ShadeResult::env, environment_lighting_apply(), ListBase::first, fresnel_fac(), Material::fresnel_tra, Material::fresnel_tra_i, ShadeInput::g, get_lights(), ShadeInput::indirect, ShadeResult::indirect, indirect_lighting_apply(), LA_LAYER, LA_YF_PHOTON, GroupObject::lampren, ShadeInput::lay, ObjectInstanceRen::lay, LampRen::lay, Render::lights, MA_DIFF_SSS, MA_FACETEXTURE, MA_FACETEXTURE_ALPHA, MA_OBCOLOR, MA_ONLYSHADOW, MA_RAMP_COL, MA_RAMP_SPEC, MA_RAYTRANSP, MA_SHLESS, MA_TRANSP, MA_VERTEXCOL, MA_VERTEXCOLP, MA_ZTRANSP, ShadeInput::mat, MAX3(), ShadeInput::mirb, ShadeInput::mirg, ShadeInput::mirr, LampRen::mode, Material::mode, ShadeInput::mode, mul_v3_fl(), GroupObject::next, NULL, ObjectRen::ob, ShadeInput::obi, ShadeInput::obr, ShadeInput::passflag, pow(), R, ShadeInput::r, R_SHADOW, ramp_diffuse_result(), ramp_spec_result(), ShadeInput::refcol, ShadeResult::refl, Render::result, sample_sss(), SCE_PASS_AO, SCE_PASS_COMBINED, SCE_PASS_DIFFUSE, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT, SCE_PASS_INDIRECT, SCE_PASS_REFLECT, SCE_PASS_RGBA, SCE_PASS_SHADOW, SCE_PASS_SPEC, ShadeResult::shad, Material::shade_flag, shade_lamp_loop_only_shadow(), shade_one_light(), ShadeResult::spec, ShadeInput::spectra, Material::sss_flag, sss_pass_done(), Material::sss_texfac, sub_v3_v3v3(), Material::texco, LampRen::type, ShadeInput::vcol, ShadeInput::view, ShadeInput::vn, ShadeInput::volume_depth, WO_AMB_OCC, WO_ENV_LIGHT, WO_INDIRECT_LIGHT, and wrld_exposure_correct().
Referenced by shade_material_loop().
static void shade_lamp_loop_only_shadow | ( | ShadeInput * | shi, |
ShadeResult * | shr | ||
) | [static] |
Definition at line 1510 of file shadeoutput.c.
References ShadeInput::alpha, ShadeResult::alpha, ShadeInput::amb, ShadeInput::ao, ShadeInput::co, ShadeInput::depth, dot_v3v3(), LampRen::energy, ShadeInput::env, ListBase::first, get_lights(), LA_LAYER, LA_SHAD_RAY, LA_YF_PHOTON, lamp_get_shadow(), lamp_get_visibility(), GroupObject::lampren, ShadeInput::lay, ObjectInstanceRen::lay, LampRen::lay, Render::lights, MA_SO_OLD, MA_SO_SHADED, MA_SO_SHADOW, ShadeInput::mat, LampRen::mode, GroupObject::next, NULL, ShadeInput::obi, R, R_SHADOW, rgb_to_grayscale(), Material::shadowonly_flag, LampRen::shb, LampRen::type, ShadeInput::vn, WO_AMB_OCC, WO_AOADD, and WO_ENV_LIGHT.
Referenced by shade_lamp_loop().
static void shade_one_light | ( | LampRen * | lar, |
ShadeInput * | shi, | ||
ShadeResult * | shr, | ||
int | passflag | ||
) | [static] |
Definition at line 1235 of file shadeoutput.c.
References add_to_diffuse(), area_lamp_energy_multisample(), ShadeInput::b, LampRen::b, blend(), Blinn_Spec(), CLAMP(), LampRen::co, ShadeInput::co, CookTorr_Spec(), copy_v3_v3(), cross(), cross_v3_v3v3(), Material::darkness, ShadeInput::depth, ShadeResult::diff, Material::diff_shader, do_lamp_tex(), do_specular_ramp(), dot_v3v3(), ShadeInput::dxco, ShadeInput::dxlv, ShadeInput::dyco, ShadeInput::dylv, LampRen::energy, VlakRen::flag, Fresnel_Diff(), ShadeInput::g, LampRen::g, ShadeInput::har, i, interp_v3_v3v3(), LA_AREA, LA_HEMI, LA_NO_DIFF, LA_NO_SPEC, LA_ONLYSHADOW, LA_OSATEX, LA_SHAD_RAY, LA_SHAD_TEX, LA_SPOT, LA_TEXTURE, lamp_get_shadow(), lamp_get_visibility(), MA_CUBIC, MA_DIFF_FRESNEL, MA_DIFF_MINNAERT, MA_DIFF_ORENNAYAR, MA_DIFF_TOON, MA_RAMP_SPEC, MA_RAYBIAS, MA_SHADOW, MA_SHADOW_TRA, MA_SPEC_BLINN, MA_SPEC_COOKTORR, MA_SPEC_PHONG, MA_SPEC_WARDISO, MA_STR_SURFDIFF, MA_TANGENT_V, ShadeInput::mat, Minnaert_Diff(), Material::mode, LampRen::mode, normalize_v3(), ObjectRen::ob, ShadeInput::obr, OrenNayar_Diff(), ShadeInput::osatex, Material::param, Phong_Spec(), ShadeInput::r, LampRen::r, R, R_SHADOW, R_SMOOTH, R_TANGENT, ShadeInput::refl, Material::refrac, Material::rms, Material::roughness, Material::sbias, SCE_PASS_COMBINED, SCE_PASS_DIFFUSE, SCE_PASS_SHADOW, SCE_PASS_SPEC, ShadeResult::shad, Material::shade_flag, LampRen::shb, LampRen::shdwb, LampRen::shdwg, LampRen::shdwr, Object::smoothresh, spec(), ShadeInput::spec, ShadeResult::spec, Material::spec_shader, ShadeInput::specb, ShadeInput::specg, ShadeInput::specr, Material::strand_surfnor, ShadeInput::surfdist, ShadeInput::surfnor, ShadeInput::tang, thresh, Toon_Diff(), Toon_Spec(), LampRen::type, ShadeInput::view, ShadeInput::vlr, ShadeInput::vn, and WardIso_Spec().
Referenced by shade_lamp_loop().
static float spec | ( | float | inp, |
int | hard | ||
) | [static] |
Definition at line 512 of file shadeoutput.c.
Referenced by CookTorr_Spec(), ntlLightObject::getShadedColor(), GPU_enable_material(), Phong_Spec(), set_draw_settings_cached(), shade_one_light(), and DisplayBuffer::write().
static void spothalo | ( | struct LampRen * | lar, |
ShadeInput * | shi, | ||
float * | intens | ||
) | [static] |
Definition at line 159 of file shadeoutput.c.
References LampRen::co, ShadeInput::co, LampRen::dist, fabs(), fabsf, LampRen::haint, if(), LampRen::imat, len_v3v3(), mistfactor(), mul_m3_v3(), mul_m3_v3_double(), R, R_ORTHO, LampRen::sh_invcampos, LampRen::sh_zfac, ShadBuf::shadhalostep, shadow_halo(), LampRen::shb, sqrt(), VECCOPY, ShadeInput::view, and WO_MIST.
Referenced by renderspothalo().
static float Toon_Diff | ( | float * | n, |
float * | l, | ||
float * | UNUSEDv, | ||
float | size, | ||
float | smooth | ||
) | [static] |
Definition at line 707 of file shadeoutput.c.
References saacos(), and size().
Referenced by shade_one_light().
static float Toon_Spec | ( | float * | n, |
float * | l, | ||
float * | v, | ||
float | size, | ||
float | smooth, | ||
int | tangent | ||
) | [static] |
Definition at line 651 of file shadeoutput.c.
References normalize_v3(), saacos(), sasqrt(), and size().
Referenced by shade_one_light().
static float WardIso_Spec | ( | float * | n, |
float * | l, | ||
float * | v, | ||
float | rms, | ||
int | tangent | ||
) | [static] |
Definition at line 675 of file shadeoutput.c.
References angle(), expf, i, M_PI, MAX2, normalize_v3(), saacos(), sasqrt(), sqrtf, and KDL::tan().
Referenced by shade_one_light().
static void wrld_exposure_correct | ( | float | diff[3] | ) | [static] |
Definition at line 1637 of file shadeoutput.c.
Referenced by shade_lamp_loop().
Definition at line 127 of file pipeline.c.