gglow.shader 612 B

12345678910111213141516171819202122
  1. shader_type spatial;
  2. render_mode blend_add,depth_draw_opaque,cull_back,unshaded;
  3. uniform vec4 colorx:hint_color;
  4. void fragment() {
  5. ALBEDO = colorx.rgb;
  6. vec3 rd=normalize(((CAMERA_MATRIX*vec4(normalize(-VERTEX),0.0)).xyz));
  7. float intensity = pow(0.122 + max(dot(NORMAL, normalize(VIEW)),0.), 010.85);
  8. ALPHA=intensity;
  9. //depth only to have smooth edges on intersect objects
  10. float depth = texture(DEPTH_TEXTURE, SCREEN_UV).r;
  11. depth = depth * 2.0 - 1.0;
  12. float z = -PROJECTION_MATRIX[3][2] / (depth + PROJECTION_MATRIX[2][2]);
  13. z*=0.31;
  14. depth=1.+z;
  15. depth=1.-clamp(depth,0.,1.);
  16. ALPHA=ALPHA*depth;
  17. }