[Bf-blender-cvs] [17583302204] blender2.8: Fix viewport rendering with anti-aliasing - workaround

Dalai Felinto noreply at git.blender.org
Mon Jun 26 18:43:50 CEST 2017


Commit: 17583302204a728a7c88de096b2ad93c7868eff8
Author: Dalai Felinto
Date:   Mon Jun 26 18:30:21 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB17583302204a728a7c88de096b2ad93c7868eff8

Fix viewport rendering with anti-aliasing - workaround

This commit makes the fullsample option for viewport renderings always
on: Render > OpenGL Render Options > Full Sample.

(The UI still allows users to set this, so we will need to revisit this
before 2.8 releases).

Even in computers that can handle MSAA we had issues.
The way Blender gpu_* implementation is handling anti-aliasing is buggy.
For example, in Blender 2.7x if you have depth of field in a viewport
with multi-sampling, the DoF gives us jagged edges.

Since Eevee uses framebuffers for a lot of things, this issue was
leading to very visible buggy render in some computers, and more subtle
inconsistent buggy renders in others (easy to test with the depth of
field in Eevee).

===================================================================

M	source/blender/editors/render/render_opengl.c

===================================================================

diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 93cc9f30868..65b0eb2b005 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -562,6 +562,24 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 	}
 }
 
+static bool screen_opengl_fullsample_enabled(Scene *scene)
+{
+	if (scene->r.scemode & R_FULL_SAMPLE) {
+		return true;
+	}
+	else {
+		/* XXX TODO:
+		 * Technically if the hardware supports MSAA we could keep using Blender 2.7x approach.
+		 * However anti-aliasing without full_sample is not playing well even in 2.7x.
+		 *
+		 * For example, if you enable depth of field, there is aliasing, even if the viewport is fine.
+		 * For 2.8x this is more complicated because so many things rely on shader.
+		 * So until we fix the gpu_framebuffer anti-aliasing suupport we need to force full sample.
+		 */
+		return true;
+	}
+}
+
 static bool screen_opengl_render_init(bContext *C, wmOperator *op)
 {
 	/* new render clears all callbacks */
@@ -575,7 +593,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
 	OGLRender *oglrender;
 	int sizex, sizey;
 	const int samples = (scene->r.mode & R_OSA) ? scene->r.osa : 0;
-	const bool full_samples = (samples != 0) && (scene->r.scemode & R_FULL_SAMPLE);
+	const bool full_samples = (samples != 0) && screen_opengl_fullsample_enabled(scene);
 	bool is_view_context = RNA_boolean_get(op->ptr, "view_context");
 	const bool is_animation = RNA_boolean_get(op->ptr, "animation");
 	const bool is_sequencer = RNA_boolean_get(op->ptr, "sequencer");




More information about the Bf-blender-cvs mailing list