Viewport: add more contrast to default studio light, make it default again

It's closer to the default matcap now, but slightly less metallic and dark. The
reason to use studio lights as default is because the roughness and metallic
parameters of the material then have an effect, and because Texture color mode
does not work for matcaps.
This commit is contained in:
Brecht Van Lommel 2019-05-24 13:22:13 +02:00
parent 419434a1ad
commit dd4a268221
5 changed files with 62 additions and 28 deletions

View File

@ -131,6 +131,7 @@ typedef struct StudioLight {
void BKE_studiolight_init(void);
void BKE_studiolight_free(void);
void BKE_studiolight_default(SolidLight lights[4], float light_ambient[4]);
struct StudioLight *BKE_studiolight_find(const char *name, int flag);
struct StudioLight *BKE_studiolight_findindex(int index, int flag);
struct StudioLight *BKE_studiolight_find_default(int flag);

View File

@ -840,7 +840,7 @@ void BKE_screen_view3d_shading_init(View3DShading *shading)
shading->type = OB_SOLID;
shading->prev_type = OB_SOLID;
shading->flag = V3D_SHADING_SPECULAR_HIGHLIGHT | V3D_SHADING_XRAY_BONE;
shading->light = V3D_LIGHTING_MATCAP;
shading->light = V3D_LIGHTING_STUDIO;
shading->shadow_intensity = 0.5f;
shading->xray_alpha = 0.5f;
shading->xray_alpha_wire = 0.5f;

View File

@ -1246,6 +1246,59 @@ static void studiolight_irradiance_preview(uint *icon_buffer, StudioLight *sl)
ITER_PIXELS_END;
}
void BKE_studiolight_default(SolidLight lights[4], float light_ambient[4])
{
copy_v3_fl3(light_ambient, 0.025000, 0.025000, 0.025000);
lights[0].flag = 1;
lights[0].smooth = 0.346939;
lights[0].col[0] = 0.058834;
lights[0].col[1] = 0.058834;
lights[0].col[2] = 0.058834;
lights[0].spec[0] = 0.084151;
lights[0].spec[1] = 0.084151;
lights[0].spec[2] = 0.084151;
lights[0].vec[0] = 0.182079;
lights[0].vec[1] = -0.235631;
lights[0].vec[2] = -0.954634;
lights[1].flag = 1;
lights[1].smooth = 0.000000;
lights[1].col[0] = 0.498431;
lights[1].col[1] = 0.514808;
lights[1].col[2] = 0.514808;
lights[1].spec[0] = 1.000000;
lights[1].spec[1] = 1.000000;
lights[1].spec[2] = 1.000000;
lights[1].vec[0] = 0.000000;
lights[1].vec[1] = 0.530612;
lights[1].vec[2] = 0.847615;
lights[2].flag = 1;
lights[2].smooth = 0.277551;
lights[2].col[0] = 0.136410;
lights[2].col[1] = 0.180357;
lights[2].col[2] = 0.149840;
lights[2].spec[0] = 0.086273;
lights[2].spec[1] = 0.095056;
lights[2].spec[2] = 0.061140;
lights[2].vec[0] = -0.909747;
lights[2].vec[1] = 0.375765;
lights[2].vec[2] = -0.176523;
lights[3].flag = 1;
lights[3].smooth = 0.362069;
lights[3].col[0] = 0.017977;
lights[3].col[1] = 0.011590;
lights[3].col[2] = 0.009531;
lights[3].spec[0] = 0.486897;
lights[3].spec[1] = 0.358628;
lights[3].spec[2] = 0.314323;
lights[3].vec[0] = 0.913200;
lights[3].vec[1] = 0.213080;
lights[3].vec[2] = -0.347366;
}
/* API */
void BKE_studiolight_init(void)
{
@ -1255,31 +1308,7 @@ void BKE_studiolight_init(void)
STUDIOLIGHT_TYPE_STUDIO);
BLI_strncpy(sl->name, "Default", FILE_MAXFILE);
copy_v3_fl3(sl->light_ambient, 0.025000, 0.025000, 0.025000);
copy_v4_fl4(sl->light[0].vec, -0.580952, 0.228571, 0.781185, 0.0);
copy_v4_fl4(sl->light[0].col, 0.900000, 0.900000, 0.900000, 1.000000);
copy_v4_fl4(sl->light[0].spec, 0.318547, 0.318547, 0.318547, 1.000000);
sl->light[0].flag = 1;
sl->light[0].smooth = 0.1;
copy_v4_fl4(sl->light[1].vec, 0.788218, 0.593482, -0.162765, 0.0);
copy_v4_fl4(sl->light[1].col, 0.267115, 0.269928, 0.358840, 1.000000);
copy_v4_fl4(sl->light[1].spec, 0.090838, 0.090838, 0.090838, 1.000000);
sl->light[1].flag = 1;
sl->light[1].smooth = 0.25;
copy_v4_fl4(sl->light[2].vec, 0.696472, -0.696472, -0.172785, 0.0);
copy_v4_fl4(sl->light[2].col, 0.293216, 0.304662, 0.401968, 1.000000);
copy_v4_fl4(sl->light[2].spec, 0.069399, 0.020331, 0.020331, 1.000000);
sl->light[2].flag = 1;
sl->light[2].smooth = 0.5;
copy_v4_fl4(sl->light[3].vec, 0.021053, -0.989474, 0.143173, 0.0);
copy_v4_fl4(sl->light[3].col, 0.0, 0.0, 0.0, 1.0);
copy_v4_fl4(sl->light[3].spec, 0.072234, 0.082253, 0.162642, 1.000000);
sl->light[3].flag = 1;
sl->light[3].smooth = 0.7;
BKE_studiolight_default(sl->light, sl->light_ambient);
BLI_addtail(&studiolights, sl);

View File

@ -49,6 +49,7 @@
#include "BKE_node.h"
#include "BKE_paint.h"
#include "BKE_screen.h"
#include "BKE_studiolight.h"
#include "BKE_workspace.h"
#include "BLO_readfile.h"
@ -117,6 +118,9 @@ void BLO_update_defaults_userpref_blend(void)
/* Increase a little for new scrubbing area. */
U.v2d_min_gridsize = 45;
/* Default studio light. */
BKE_studiolight_default(U.light_param, U.light_ambient);
}
/**
@ -329,7 +333,7 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
/* Screen space cavity by default for faster performance. */
View3D *v3d = sa->spacedata.first;
v3d->shading.cavity_type = V3D_SHADING_CAVITY_CURVATURE;
v3d->shading.light = V3D_LIGHTING_MATCAP;
v3d->shading.light = V3D_LIGHTING_STUDIO;
}
else if (sa->spacetype == SPACE_CLIP) {
SpaceClip *sclip = sa->spacedata.first;

View File

@ -346,8 +346,8 @@ const EnumPropertyItem rna_enum_shading_type_items[] = {
};
static const EnumPropertyItem rna_enum_viewport_lighting_items[] = {
{V3D_LIGHTING_MATCAP, "MATCAP", 0, "MatCap", "Display using matcap material and lighting"},
{V3D_LIGHTING_STUDIO, "STUDIO", 0, "Studio", "Display using studio lighting"},
{V3D_LIGHTING_MATCAP, "MATCAP", 0, "MatCap", "Display using matcap material and lighting"},
{V3D_LIGHTING_FLAT, "FLAT", 0, "Flat", "Display using flat lighting"},
{0, NULL, 0, NULL, NULL},
};