Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/studiolight.c
| Show First 20 Lines • Show All 1,059 Lines • ▼ Show 20 Lines | static void studiolight_lights_eval(StudioLight *sl, float color[3], const float normal[3]) | ||||
| const float specular_color = brdf_approx(0.05f, roughness, N[2]); | const float specular_color = brdf_approx(0.05f, roughness, N[2]); | ||||
| float diff_light[3], spec_light[3]; | float diff_light[3], spec_light[3]; | ||||
| /* Ambient lighting */ | /* Ambient lighting */ | ||||
| copy_v3_v3(diff_light, sl->light_ambient); | copy_v3_v3(diff_light, sl->light_ambient); | ||||
| copy_v3_v3(spec_light, sl->light_ambient); | copy_v3_v3(spec_light, sl->light_ambient); | ||||
| reflect_v3_v3v3(R, I, N); | reflect_v3_v3v3(R, I, N); | ||||
| for (int i = 0; i < 3; i++) { | for (int i = 0; i < STUDIOLIGHT_MAX_LIGHT; i++) { | ||||
| SolidLight *light = &sl->light[i]; | SolidLight *light = &sl->light[i]; | ||||
| if (light->flag) { | if (light->flag) { | ||||
| /* Diffuse lighting */ | /* Diffuse lighting */ | ||||
| float NL = dot_v3v3(light->vec, N); | float NL = dot_v3v3(light->vec, N); | ||||
| float diff = wrapped_lighting(NL, light->smooth); | float diff = wrapped_lighting(NL, light->smooth); | ||||
| madd_v3_v3fl(diff_light, light->col, diff); | madd_v3_v3fl(diff_light, light->col, diff); | ||||
| /* Specular lighting */ | /* Specular lighting */ | ||||
| float spec = blinn_specular(light->vec, I, N, R, NL, roughness, light->smooth); | float spec = blinn_specular(light->vec, I, N, R, NL, roughness, light->smooth); | ||||
| ▲ Show 20 Lines • Show All 579 Lines • Show Last 20 Lines | |||||