Welcome to mirror list, hosted at ThFree Co, Russian Federation.

workbench_effect_smaa_frag.glsl « shaders « workbench « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8b9e3f968eac692bd81619b5ad50fd1a14332145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

#pragma BLENDER_REQUIRE(common_smaa_lib.glsl)

void main()
{
#if SMAA_STAGE == 0
  /* Detect edges in color and revealage buffer. */
  out_edges = SMAALumaEdgeDetectionPS(uvs, offset, colorTex);
  /* Discard if there is no edge. */
  if (dot(out_edges, float2(1.0, 1.0)) == 0.0) {
    discard;
  }

#elif SMAA_STAGE == 1
  out_weights = SMAABlendingWeightCalculationPS(
      uvs, pixcoord, offset, edgesTex, areaTex, searchTex, vec4(0));

#elif SMAA_STAGE == 2
  out_color = vec4(0.0);
  if (mixFactor > 0.0) {
    out_color += SMAANeighborhoodBlendingPS(uvs, offset[0], colorTex, blendTex) * mixFactor;
  }
  if (mixFactor < 1.0) {
    out_color += texture(colorTex, uvs) * (1.0 - mixFactor);
  }
  out_color /= taaAccumulatedWeight;
  /* Exit log2 space used for Antialiasing. */
  out_color = exp2(out_color) - 0.5;

  /* Avoid float precision issue. */
  if (out_color.a > 0.999) {
    out_color.a = 1.0;
  }
#endif
}