Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl
- This file was moved from source/blender/draw/modes/shaders/paint_weight_frag.glsl.
| in vec2 weight_interp; /* (weight, alert) */ | in vec2 weight_interp; /* (weight, alert) */ | ||||
| out vec4 fragColor; | out vec4 fragColor; | ||||
| uniform float opacity = 1.0; | uniform float opacity = 1.0; | ||||
| uniform sampler1D colorramp; | uniform sampler1D colorramp; | ||||
| uniform bool useAlphaBlend = false; | |||||
| uniform bool drawContours = false; | uniform bool drawContours = false; | ||||
| float contours(float value, float steps, float width_px, float max_rel_width, float gradient) | float contours(float value, float steps, float width_px, float max_rel_width, float gradient) | ||||
| { | { | ||||
| /* Minimum visible and minimum full strength line width in screen space for fade out. */ | /* Minimum visible and minimum full strength line width in screen space for fade out. */ | ||||
| const float min_width_px = 1.3, fade_width_px = 2.3; | const float min_width_px = 1.3, fade_width_px = 2.3; | ||||
| /* Line is thinner towards the increase in the weight gradient by this factor. */ | /* Line is thinner towards the increase in the weight gradient by this factor. */ | ||||
| const float hi_bias = 2.0; | const float hi_bias = 2.0; | ||||
| ▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | if (drawContours) { | ||||
| weight_color = grid + weight_color * (1 - grid.a); | weight_color = grid + weight_color * (1 - grid.a); | ||||
| } | } | ||||
| /* Zero weight alert color. Nonlinear blend to reduce impact. */ | /* Zero weight alert color. Nonlinear blend to reduce impact. */ | ||||
| color = mix(weight_color, colorVertexUnreferenced, alert * alert); | color = mix(weight_color, colorVertexUnreferenced, alert * alert); | ||||
| } | } | ||||
| #ifdef DRW_STATE_BLEND_ALPHA | if (useAlphaBlend) { | ||||
| /* alpha blending mix */ | |||||
| fragColor = vec4(color.rgb, opacity); | fragColor = vec4(color.rgb, opacity); | ||||
| #else | } | ||||
| else { | |||||
| /* mix with 1.0 -> is like opacity when using multiply blend mode */ | /* mix with 1.0 -> is like opacity when using multiply blend mode */ | ||||
| fragColor = vec4(mix(vec3(1.0), color.rgb, opacity), 1.0); | fragColor = vec4(mix(vec3(1.0), color.rgb, opacity), 1.0); | ||||
| #endif | } | ||||
| } | } | ||||