ENABLE_SMOOTH_NORMALS (#14080)

* ENABLE_SMOOTH_NORMALS

* Remove definition of macro L if defined

* Update GLModel.cpp

* suavizado ajustado en 5 grados

5 grados

3,5 grados

* Ajuste de brillo menos intenso

* opcion smooth normals

Update GLModel.cpp

test

test 3

* cleaning macros

* tooltip

* Apply suggestion from @RF47

* Apply suggestion from @RF47

* Apply suggestions from code review

Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
This commit is contained in:
Rodrigo Faselli
2026-06-18 22:42:12 -03:00
committed by SoftFever
parent 70fd764e7d
commit da7e0540a9
9 changed files with 79 additions and 61 deletions

View File

@@ -10,18 +10,18 @@ const float EPSILON = 0.0001;
// normalized values for (-0.6/1.31, 0.6/1.31, 1./1.31)
const vec3 LIGHT_TOP_DIR = vec3(-0.4574957, 0.4574957, 0.7624929);
#define LIGHT_TOP_DIFFUSE (0.8 * INTENSITY_CORRECTION)
#define LIGHT_TOP_SPECULAR (0.8 * INTENSITY_CORRECTION)
#define LIGHT_TOP_SHININESS 128.0
#define LIGHT_TOP_DIFFUSE (0.85 * INTENSITY_CORRECTION)
#define LIGHT_TOP_SPECULAR (0.35 * INTENSITY_CORRECTION)
#define LIGHT_TOP_SHININESS 32.0
// normalized values for (1./1.43, 0.2/1.43, 1./1.43)
const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074);
#define LIGHT_FRONT_DIFFUSE (0.3 * INTENSITY_CORRECTION)
#define LIGHT_FRONT_SPECULAR (0.28 * INTENSITY_CORRECTION)
#define LIGHT_FRONT_SHININESS 64.0
#define LIGHT_FRONT_DIFFUSE (0.35 * INTENSITY_CORRECTION)
#define LIGHT_FRONT_SPECULAR (0.12 * INTENSITY_CORRECTION)
#define LIGHT_FRONT_SHININESS 16.0
#define INTENSITY_AMBIENT 0.22
#define WINDOW_REFLECTION_INTENSITY 0.55
#define INTENSITY_AMBIENT 0.25
#define WINDOW_REFLECTION_INTENSITY 0.30
struct PrintVolumeDetection
{
@@ -162,11 +162,11 @@ vec3 compute_window_reflection(vec3 normal, vec3 view_dir)
float bars = 1.0;
// Fresnel effect for edge glow
float fresnel = pow(1.0 - max(dot(normal, view_dir), 0.0), 1.0);
float fresnel = pow(1.0 - max(dot(normal, view_dir), 0.0), 1.2);
float facing = smoothstep(-0.4, 0.6, reflect_light.z);
float intensity = window_light * bars * (0.25 + 0.25 * fresnel) * facing;
intensity = clamp(intensity, 0.0, 0.45);
float intensity = window_light * bars * (0.15 + 0.15 * fresnel) * facing;
intensity = clamp(intensity, 0.0, 0.25);
return vec3(intensity);
}

View File

@@ -10,18 +10,18 @@ const float EPSILON = 0.0001;
// normalized values for (-0.6/1.31, 0.6/1.31, 1./1.31)
const vec3 LIGHT_TOP_DIR = vec3(-0.4574957, 0.4574957, 0.7624929);
#define LIGHT_TOP_DIFFUSE (0.8 * INTENSITY_CORRECTION)
#define LIGHT_TOP_SPECULAR (0.8 * INTENSITY_CORRECTION)
#define LIGHT_TOP_SHININESS 128.0
#define LIGHT_TOP_DIFFUSE (0.85 * INTENSITY_CORRECTION)
#define LIGHT_TOP_SPECULAR (0.35 * INTENSITY_CORRECTION)
#define LIGHT_TOP_SHININESS 32.0
// normalized values for (1./1.43, 0.2/1.43, 1./1.43)
const vec3 LIGHT_FRONT_DIR = vec3(0.6985074, 0.1397015, 0.6985074);
#define LIGHT_FRONT_DIFFUSE (0.3 * INTENSITY_CORRECTION)
#define LIGHT_FRONT_SPECULAR (0.28 * INTENSITY_CORRECTION)
#define LIGHT_FRONT_SHININESS 64.0
#define LIGHT_FRONT_DIFFUSE (0.35 * INTENSITY_CORRECTION)
#define LIGHT_FRONT_SPECULAR (0.12 * INTENSITY_CORRECTION)
#define LIGHT_FRONT_SHININESS 16.0
#define INTENSITY_AMBIENT 0.22
#define WINDOW_REFLECTION_INTENSITY 0.55
#define INTENSITY_AMBIENT 0.25
#define WINDOW_REFLECTION_INTENSITY 0.30
struct PrintVolumeDetection
{
@@ -164,12 +164,13 @@ vec3 compute_window_reflection(vec3 normal, vec3 view_dir)
// No bars - just pure circular glass
float bars = 1.0;
// Fresnel effect for edge glow
float fresnel = pow(1.0 - max(dot(normal, view_dir), 0.0), 1.0);
float fresnel = pow(1.0 - max(dot(normal, view_dir), 0.0), 1.2);
float facing = smoothstep(-0.4, 0.6, reflect_light.z);
float intensity = window_light * bars * (0.25 + 0.25 * fresnel) * facing;
intensity = clamp(intensity, 0.0, 0.45);
float intensity = window_light * bars * (0.15 + 0.15 * fresnel) * facing;
intensity = clamp(intensity, 0.0, 0.25);
return vec3(intensity);
}