shader_type spatial; void vertex() { // Called for every vertex the material is visible on. } uniform sampler2D mesh_texture; void fragment() { // Called for every pixel the material is visible on. ALBEDO = texture(mesh_texture, UV).rgb; } uniform vec3 shade_tint = vec3(.01,.01,.01); uniform vec3 middle_tint = vec3(.20,.1,.1); uniform vec3 overall_tint = vec3(.70,.70,.70); uniform float specular = 1.0; void light() { // Called for every pixel for every light affecting the material. // Uncomment to replace the default light processing function with this one.j float shade_front = dot(NORMAL, LIGHT); float specular_point = shade_front; float smooth_shade = shade_front; float extra_shade = dot(NORMAL, LIGHT) + 0.25; shade_front = smoothstep(0.37, 0.39, shade_front); specular_point = smoothstep(0.998,0.999, specular_point); smooth_shade = smoothstep(0.1,1.0, smooth_shade) ; extra_shade = smoothstep(0.14, 0.19, extra_shade); vec3 color_back = (shade_front * ALBEDO ) + vec3(0.01) + (extra_shade * middle_tint + (smooth_shade * overall_tint)); // Light energy had to be sclaed down because our shader makes it too bright // but now we at least can adjust the object based on the type of light in the scene // so color, for example, tints the object appropriatelly DIFFUSE_LIGHT = (ATTENUATION * color_back * LIGHT_COLOR/4.0) + shade_tint; SPECULAR_LIGHT = specular_point * vec3(0.95) * specular; } .