Refactor/Rewrite overlay wire colors #110097

Closed
Gilberto Rodrigues wants to merge 19 commits from Gilberto.R/blender:temp-fresnelpref into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
7 changed files with 15 additions and 5 deletions
Showing only changes of commit 83c12ba44a - Show all commits

View File

@ -120,6 +120,7 @@ const UserDef U_default = {
.gizmo_flag = USER_GIZMO_DRAW,
.gizmo_size = 75,
.gizmo_size_navigate_v3d = 80,
.fresnel_intensity = 0.2,
.edit_studio_light = 0,
.lookdev_sphere_size = 150,
.vbotimeout = 120,

View File

@ -751,7 +751,7 @@ class USERPREF_PT_viewport_display(ViewportPanel, CenterAlignMixIn, Panel):
col = layout.column(heading="Fresnel")
col.prop(view, "use_fresnel_edit")
col.prop(view, "use_fresnel")
col.prop(view, "fresnel_intensity_factor")
class USERPREF_PT_viewport_quality(ViewportPanel, CenterAlignMixIn, Panel):
bl_label = "Quality"

View File

@ -97,7 +97,7 @@ void main()
vec3 view_normal = normalize(normal_object_to_view(vnor) + 1e-4);
vec3 view_vec = (drw_view.winmat[3][3] == 0.0) ? normalize(view_pos) : vec3(0.0, 0.0, 1.0);
float facing = dot(view_vec, view_normal);
facing = 1.0 - abs(facing) * 0.2;
facing = 1.0 - abs(facing)*0.6;
/* Do interpolation in a non-linear space to have a better visual result. */
finalColor.rgb = mix(finalColor.rgb, non_linear_blend_color(colorEditMeshMiddle.rgb,

View File

@ -106,7 +106,7 @@ void main()
/* Fresnel */
facing = clamp(abs(facing), 0.0, 1.0);
float fresnel_alpha = mix(0.0, 0.8, facing)*fresnelMix;
float fresnel_alpha = mix(0.0, fresnelMix, facing);
finalColor.a = wireOpacity - fresnel_alpha;
finalColor.rgb = mix(finalColor.rgb, finalColor.rgb*(1-fresnel_alpha), fresnelMix);

View File

@ -82,8 +82,8 @@ void DRW_globals_update(void)
UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_PRIMARY, gb->color_checker_primary);
UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_SECONDARY, gb->color_checker_secondary);
gb->size_checker = UI_GetThemeValuef(TH_TRANSPARENT_CHECKER_SIZE);
gb->fresnel_mix_edit = ((U.gpu_flag & USER_GPU_FLAG_FRESNEL_EDIT) == 0 ) ? 0.0 : 1.0;
gb->fresnel_mix = ((U.gpu_flag & USER_GPU_FLAG_FRESNEL) == 0 ) ? 0.0 : 1.0;
gb->fresnel_mix_edit = ((U.gpu_flag & USER_GPU_FLAG_FRESNEL_EDIT) == 0 ) ? 0.0 : U.fresnel_intensity;
gb->fresnel_mix = ((U.gpu_flag & USER_GPU_FLAG_FRESNEL) == 0 ) ? 0.0 : U.fresnel_intensity;
UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, gb->color_clipping_border);
/* Custom median color to slightly affect the edit mesh colors. */

View File

@ -993,6 +993,9 @@ typedef struct UserDef {
struct WalkNavigation walk_navigation;
/** Fresnel */
float fresnel_intensity;
char _pad[4];
/** The UI for the user preferences. */
UserDef_SpaceData space_data;

View File

@ -4711,6 +4711,12 @@ static void rna_def_userdef_view(BlenderRNA *brna)
"It improves the shape readability of very dense meshes");
RNA_def_property_update(prop, 0, "rna_userdef_gpu_update");
prop = RNA_def_property(srna, "fresnel_intensity_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, nullptr, "fresnel_intensity");
RNA_def_property_ui_text(prop, "Fresnel Intensity", "Intensity of wireframe fresnel");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_update(prop, 0, "rna_userdef_gpu_update");
USERDEF_TAG_DIRTY_PROPERTY_UPDATE_DISABLE;
prop = RNA_def_property(srna, "show_addons_enabled_only", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(