diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-04-30 17:16:16 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-04-30 17:39:26 +0300 |
commit | 8e78282a941f0cc97d2cb0288817e650cc963e04 (patch) | |
tree | a19b8e4ff210b56cd143e768a1c593934a97d506 /source | |
parent | 0a73000dfc1d5a7ca286f21a3c3021943b45bc60 (diff) |
Eevee: Use GPU_RG16 for velocity pass instead of GPU_RG32F.
Diffstat (limited to 'source')
3 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 18a2198aa32..984ecfcea89 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -234,8 +234,7 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object * Motion vector buffer for correct TAA / motion blur. */ if ((effects->enabled_effects & EFFECT_VELOCITY_BUFFER) != 0) { - /* TODO use RG16_UNORM */ - effects->velocity_tx = DRW_texture_pool_query_2D(size_fs[0], size_fs[1], GPU_RG32F, + effects->velocity_tx = DRW_texture_pool_query_2D(size_fs[0], size_fs[1], GPU_RG16, &draw_engine_eevee_type); /* TODO output objects velocity during the mainpass. */ diff --git a/source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl b/source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl index 8d07ae45b6b..e118777f6c8 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl @@ -41,6 +41,9 @@ void main() float depth = texelFetch(depthBuffer, texel, 0).r; vec2 motion = texelFetch(velocityBuffer, texel, 0).rg; + /* Decode from unsigned normalized 16bit texture. */ + motion = motion * 2.0 - 1.0; + /* Compute pixel position in previous frame. */ vec2 screen_res = vec2(textureSize(colorBuffer, 0).xy); vec2 uv = gl_FragCoord.xy / screen_res; diff --git a/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl index 9c118277212..8324c25225c 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl @@ -16,4 +16,7 @@ void main() vec2 uv_history = project_point(pastPersmat, world_position).xy * 0.5 + 0.5; outData = uv - uv_history; + + /* Encode to unsigned normalized 16bit texture. */ + outData = outData * 0.5 + 0.5; } |