[Bf-blender-cvs] [8e78282a941] blender2.8: Eevee: Use GPU_RG16 for velocity pass instead of GPU_RG32F.
Clément Foucault
noreply at git.blender.org
Mon Apr 30 16:39:37 CEST 2018
Commit: 8e78282a941f0cc97d2cb0288817e650cc963e04
Author: Clément Foucault
Date: Mon Apr 30 16:16:16 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8e78282a941f0cc97d2cb0288817e650cc963e04
Eevee: Use GPU_RG16 for velocity pass instead of GPU_RG32F.
===================================================================
M source/blender/draw/engines/eevee/eevee_effects.c
M source/blender/draw/engines/eevee/shaders/effect_temporal_aa.glsl
M source/blender/draw/engines/eevee/shaders/effect_velocity_resolve_frag.glsl
===================================================================
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;
}
More information about the Bf-blender-cvs
mailing list