diff --git a/cura/ConvexHullNode.py b/cura/ConvexHullNode.py index 703dfb0bed..232b30e317 100644 --- a/cura/ConvexHullNode.py +++ b/cura/ConvexHullNode.py @@ -23,7 +23,7 @@ class ConvexHullNode(SceneNode): self._original_parent = parent # Color of the drawn convex hull - self._color = Color(35, 35, 35, 192) + self._color = Color(0.4, 0.4, 0.4, 1.0) # The y-coordinate of the convex hull mesh. Must not be 0, to prevent z-fighting. self._mesh_height = 0.1 diff --git a/resources/shaders/transparent_object.shader b/resources/shaders/transparent_object.shader index a3790901bc..cd27a40769 100644 --- a/resources/shaders/transparent_object.shader +++ b/resources/shaders/transparent_object.shader @@ -1,7 +1,7 @@ [shaders] vertex = - uniform highp mat4 u_viewProjectionMatrix; uniform highp mat4 u_modelMatrix; + uniform highp mat4 u_viewProjectionMatrix; uniform highp mat4 u_normalMatrix; attribute highp vec4 a_vertex; @@ -10,7 +10,6 @@ vertex = varying highp vec3 v_vertex; varying highp vec3 v_normal; - varying highp vec2 v_uvs; void main() { @@ -19,56 +18,47 @@ vertex = v_vertex = world_space_vert.xyz; v_normal = (u_normalMatrix * normalize(a_normal)).xyz; - - v_uvs = a_uvs; } fragment = uniform mediump vec4 u_ambientColor; uniform mediump vec4 u_diffuseColor; uniform highp vec3 u_lightPosition; - uniform highp vec3 u_viewPosition; + uniform mediump float u_opacity; - uniform sampler2D u_texture; varying highp vec3 v_vertex; varying highp vec3 v_normal; - varying highp vec2 v_uvs; void main() { - // Copied from platform.shader, removed texture - mediump vec4 final_color = vec4(0.0); + mediump vec4 finalColor = vec4(0.0); /* Ambient Component */ - final_color += u_ambientColor; + finalColor += u_ambientColor; highp vec3 normal = normalize(v_normal); - highp vec3 light_dir = normalize(u_lightPosition - v_vertex); + highp vec3 lightDir = normalize(u_lightPosition - v_vertex); /* Diffuse Component */ - highp float n_dot_l = clamp(dot(normal, light_dir), 0.0, 1.0); - final_color += (n_dot_l * u_diffuseColor); + highp float NdotL = clamp(abs(dot(normal, lightDir)), 0.0, 1.0); + finalColor += (NdotL * u_diffuseColor); - final_color.a = u_opacity; - - gl_FragColor = final_color; + gl_FragColor = finalColor; + gl_FragColor.a = u_opacity; } [defaults] -u_ambientColor = [0.3, 0.3, 0.3, 1.0] -u_diffuseColor = [1.0, 1.0, 1.0, 1.0] +u_ambientColor = [0.1, 0.1, 0.1, 1.0] +u_diffuseColor = [0.4, 0.4, 0.4, 1.0] u_opacity = 0.5 -u_texture = 0 [bindings] -u_viewProjectionMatrix = view_projection_matrix u_modelMatrix = model_matrix +u_viewProjectionMatrix = view_projection_matrix u_normalMatrix = normal_matrix u_lightPosition = light_0_position -u_viewPosition = camera_position [attributes] a_vertex = vertex a_normal = normal -a_uvs = uv0