diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-06-26 19:30:21 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-06-26 19:30:21 +0300 |
commit | 17583302204a728a7c88de096b2ad93c7868eff8 (patch) | |
tree | 8d3749e6330251ce19225ad39648ebf52d1b0d40 /source/blender/editors/render/render_opengl.c | |
parent | a48bd0db71dc322b6ccc6ccf491109a0dd0bce13 (diff) |
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).
Diffstat (limited to 'source/blender/editors/render/render_opengl.c')
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 20 |
1 files changed, 19 insertions, 1 deletions
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"); |