Changeset View
Changeset View
Standalone View
Standalone View
source/blender/render/intern/source/shadeoutput.c
| Context not available. | |||||
| #include "DNA_lamp_types.h" | #include "DNA_lamp_types.h" | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| #include "IMB_colormanagement.h" | |||||
| /* local include */ | /* local include */ | ||||
| #include "occlusion.h" | #include "occlusion.h" | ||||
| #include "render_types.h" | #include "render_types.h" | ||||
| Context not available. | |||||
| if (ma->ramp_col) { | if (ma->ramp_col) { | ||||
| if (ma->rampin_col==MA_RAMP_IN_RESULT) { | if (ma->rampin_col==MA_RAMP_IN_RESULT) { | ||||
| float fac = rgb_to_grayscale(diff); | float fac = IMB_colormanagement_get_luminance(diff); | ||||
| do_colorband(ma->ramp_col, fac, col); | do_colorband(ma->ramp_col, fac, col); | ||||
| /* blending method */ | /* blending method */ | ||||
| Context not available. | |||||
| diff[2] += b * shi->b; | diff[2] += b * shi->b; | ||||
| } | } | ||||
| else { | else { | ||||
| float colt[3], col[4]; | float colt[3], col[4], rgb[3]; | ||||
| float fac; | float fac; | ||||
| /* input */ | /* input */ | ||||
| switch (ma->rampin_col) { | switch (ma->rampin_col) { | ||||
| case MA_RAMP_IN_ENERGY: | case MA_RAMP_IN_ENERGY: | ||||
| /* should use 'rgb_to_grayscale' but we only have a vector version */ | rgb[0] = r; | ||||
| fac= 0.3f*r + 0.58f*g + 0.12f*b; | rgb[1] = g; | ||||
| rgb[2] = b; | |||||
| fac= IMB_colormanagement_get_luminance(rgb); | |||||
| break; | break; | ||||
| case MA_RAMP_IN_SHADER: | case MA_RAMP_IN_SHADER: | ||||
| fac= is; | fac= is; | ||||
| Context not available. | |||||
| if (ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) { | if (ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) { | ||||
| float col[4]; | float col[4]; | ||||
| float fac = rgb_to_grayscale(spec_col); | float fac = IMB_colormanagement_get_luminance(spec_col); | ||||
| do_colorband(ma->ramp_spec, fac, col); | do_colorband(ma->ramp_spec, fac, col); | ||||
| Context not available. | |||||
| if (shi->mat->shadowonly_flag == MA_SO_OLD) { | if (shi->mat->shadowonly_flag == MA_SO_OLD) { | ||||
| /* Old "Shadows Only" */ | /* Old "Shadows Only" */ | ||||
| accum+= (1.0f-visifac) + (visifac)*rgb_to_grayscale(shadfac)*shadfac[3]; | accum+= (1.0f-visifac) + (visifac)* | ||||
| IMB_colormanagement_get_luminance(shadfac)*shadfac[3]; | |||||
| } | } | ||||
| else { | else { | ||||
| shaded += rgb_to_grayscale(shadfac)*shadfac[3] * visifac * lar->energy; | shaded += IMB_colormanagement_get_luminance(shadfac)*shadfac[3] | ||||
| * visifac * lar->energy; | |||||
| if (shi->mat->shadowonly_flag == MA_SO_SHADOW) { | if (shi->mat->shadowonly_flag == MA_SO_SHADOW) { | ||||
| lightness += visifac * lar->energy; | lightness += visifac * lar->energy; | ||||
| Context not available. | |||||
| if (R.wrld.aomix==WO_AOADD) { | if (R.wrld.aomix==WO_AOADD) { | ||||
| if (shi->mat->shadowonly_flag == MA_SO_OLD) { | if (shi->mat->shadowonly_flag == MA_SO_OLD) { | ||||
| f= f*(1.0f - rgb_to_grayscale(shi->ao)); | f= f*(1.0f - IMB_colormanagement_get_luminance(shi->ao)); | ||||
| shr->alpha= (shr->alpha + f)*f; | shr->alpha= (shr->alpha + f)*f; | ||||
| } | } | ||||
| else { | else { | ||||
| shr->alpha -= f*rgb_to_grayscale(shi->ao); | shr->alpha -= f*IMB_colormanagement_get_luminance(shi->ao); | ||||
| if (shr->alpha<0.0f) shr->alpha=0.0f; | if (shr->alpha<0.0f) shr->alpha=0.0f; | ||||
| } | } | ||||
| } | } | ||||
| else /* AO Multiply */ | else /* AO Multiply */ | ||||
| shr->alpha= (1.0f - f)*shr->alpha + f*(1.0f - (1.0f - shr->alpha)*rgb_to_grayscale(shi->ao)); | shr->alpha= (1.0f - f)*shr->alpha + f*(1.0f - (1.0f - shr->alpha)* | ||||
| IMB_colormanagement_get_luminance(shi->ao)); | |||||
| } | } | ||||
| if (R.wrld.mode & WO_ENV_LIGHT) { | if (R.wrld.mode & WO_ENV_LIGHT) { | ||||
| if (shi->mat->shadowonly_flag == MA_SO_OLD) { | if (shi->mat->shadowonly_flag == MA_SO_OLD) { | ||||
| f= R.wrld.ao_env_energy*shi->amb*(1.0f - rgb_to_grayscale(shi->env)); | f= R.wrld.ao_env_energy*shi->amb*(1.0f - | ||||
| IMB_colormanagement_get_luminance(shi->env)); | |||||
| shr->alpha= (shr->alpha + f)*f; | shr->alpha= (shr->alpha + f)*f; | ||||
| } | } | ||||
| else { | else { | ||||
| f= R.wrld.ao_env_energy*shi->amb; | f= R.wrld.ao_env_energy*shi->amb; | ||||
| shr->alpha -= f*rgb_to_grayscale(shi->env); | shr->alpha -= f*IMB_colormanagement_get_luminance(shi->env); | ||||
| if (shr->alpha<0.0f) shr->alpha=0.0f; | if (shr->alpha<0.0f) shr->alpha=0.0f; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||