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

effect_velocity_resolve_frag.glsl « shaders « eevee « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7d701bce5cb048b51fd1fa37eae8c4bc33ca06c5 (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

uniform mat4 currPersinv;
uniform mat4 pastPersmat;

out vec2 outData;

void main()
{
  /* Extract pixel motion vector from camera movement. */
  ivec2 texel = ivec2(gl_FragCoord.xy);
  vec2 uv = gl_FragCoord.xy / vec2(textureSize(depthBuffer, 0).xy);

  float depth = texelFetch(depthBuffer, texel, 0).r;

  vec3 world_position = project_point(currPersinv, vec3(uv, depth) * 2.0 - 1.0);
  vec2 uv_history = project_point(pastPersmat, world_position).xy * 0.5 + 0.5;

  outData = uv - uv_history;

  /* HACK: Reject lookdev spheres from TAA reprojection. */
  outData = (depth > 0.0) ? outData : vec2(0.0);

  /* Encode to unsigned normalized 16bit texture. */
  outData = outData * 0.5 + 0.5;
}