[Bf-blender-cvs] [31333fc193c] master: Viewport: Change default studiolight

Clément Foucault noreply at git.blender.org
Fri May 24 19:28:28 CEST 2019


Commit: 31333fc193ce39015eab50734c0048f64423091e
Author: Clément Foucault
Date:   Fri May 24 18:03:25 2019 +0200
Branches: master
https://developer.blender.org/rB31333fc193ce39015eab50734c0048f64423091e

Viewport: Change default studiolight

Differential Revision: https://developer.blender.org/D4939

===================================================================

M	source/blender/blenkernel/intern/material.c
M	source/blender/blenkernel/intern/studiolight.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/draw/engines/workbench/workbench_materials.c

===================================================================

diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 75b9e355df9..1e5a2d53bfa 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -133,7 +133,7 @@ void BKE_material_init(Material *ma)
   ma->a = 1.0f;
   ma->spec = 0.5;
 
-  ma->roughness = 0.25f;
+  ma->roughness = 0.4f;
 
   ma->pr_type = MA_SPHERE;
 
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index d0c29e4331b..20f2a9be53b 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -1248,55 +1248,55 @@ static void studiolight_irradiance_preview(uint *icon_buffer, StudioLight *sl)
 
 void BKE_studiolight_default(SolidLight lights[4], float light_ambient[4])
 {
-  copy_v3_fl3(light_ambient, 0.025000, 0.025000, 0.025000);
+  copy_v3_fl3(light_ambient, 0.0, 0.0, 0.0);
 
   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[0].smooth = 0.526620f;
+  lights[0].col[0] = 0.033103f;
+  lights[0].col[1] = 0.033103f;
+  lights[0].col[2] = 0.033103f;
+  lights[0].spec[0] = 0.266761f;
+  lights[0].spec[1] = 0.266761f;
+  lights[0].spec[2] = 0.266761f;
+  lights[0].vec[0] = -0.352546f;
+  lights[0].vec[1] = 0.170931f;
+  lights[0].vec[2] = -0.920051f;
 
   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[1].smooth = 0.000000f;
+  lights[1].col[0] = 0.521083f;
+  lights[1].col[1] = 0.538226f;
+  lights[1].col[2] = 0.538226f;
+  lights[1].spec[0] = 0.599030f;
+  lights[1].spec[1] = 0.599030f;
+  lights[1].spec[2] = 0.599030f;
+  lights[1].vec[0] = -0.408163f;
+  lights[1].vec[1] = 0.346939f;
+  lights[1].vec[2] = 0.844415f;
 
   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[2].smooth = 0.478261f;
+  lights[2].col[0] = 0.038403f;
+  lights[2].col[1] = 0.034357f;
+  lights[2].col[2] = 0.049530f;
+  lights[2].spec[0] = 0.106102f;
+  lights[2].spec[1] = 0.125981f;
+  lights[2].spec[2] = 0.158523f;
+  lights[2].vec[0] = 0.521739f;
+  lights[2].vec[1] = 0.826087f;
+  lights[2].vec[2] = 0.212999f;
 
   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;
+  lights[3].smooth = 0.200000f;
+  lights[3].col[0] = 0.090838f;
+  lights[3].col[1] = 0.082080f;
+  lights[3].col[2] = 0.072255f;
+  lights[3].spec[0] = 0.106535f;
+  lights[3].spec[1] = 0.084771f;
+  lights[3].spec[2] = 0.066080f;
+  lights[3].vec[0] = 0.624519f;
+  lights[3].vec[1] = -0.562067f;
+  lights[3].vec[2] = -0.542269f;
 }
 
 /* API */
@@ -1308,8 +1308,6 @@ void BKE_studiolight_init(void)
                                        STUDIOLIGHT_TYPE_STUDIO);
   BLI_strncpy(sl->name, "Default", FILE_MAXFILE);
 
-  BKE_studiolight_default(sl->light, sl->light_ambient);
-
   BLI_addtail(&studiolights, sl);
 
   /* go over the preset folder and add a studiolight for every image with its path */
@@ -1336,6 +1334,8 @@ void BKE_studiolight_init(void)
 
   /* sort studio lights on filename. */
   BLI_listbase_sort(&studiolights, studiolight_cmp);
+
+  BKE_studiolight_default(sl->light, sl->light_ambient);
 }
 
 void BKE_studiolight_free(void)
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index fdeb2997b05..44db1c424b6 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -425,6 +425,21 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
       camera->dof.focus_distance = 10.0f;
       camera->dof.aperture_fstop = 2.8f;
     }
+
+    for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
+      /* Update default material to be a bit more rough. */
+      ma->roughness = 0.4f;
+
+      if (ma->nodetree) {
+        for (bNode *node = ma->nodetree->nodes.first; node; node = node->next) {
+          if (node->type == SH_NODE_BSDF_PRINCIPLED) {
+            bNodeSocket *roughness_socket = nodeFindSocket(node, SOCK_IN, "Roughness");
+            bNodeSocketValueFloat *roughness_data = roughness_socket->default_value;
+            roughness_data->value = 0.4f;
+          }
+        }
+      }
+    }
   }
 
   for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index b280b6fd01a..a079d64a799 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -52,7 +52,7 @@ void workbench_material_update_data(WORKBENCH_PrivateData *wpd,
   copy_v3_v3(data->base_color, data->diffuse_color);
   copy_v3_fl3(data->specular_color, 0.05f, 0.05f, 0.05f); /* Dielectric: 5% reflective. */
   data->metallic = 0.0f;
-  data->roughness = 0.5f; /* sqrtf(0.25f); */
+  data->roughness = 0.632455532f; /* sqrtf(0.4f); */
 
   if (color_type == V3D_SHADING_SINGLE_COLOR) {
     copy_v3_v3(data->diffuse_color, wpd->shading.single_color);



More information about the Bf-blender-cvs mailing list