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).
This commit is contained in:
parent
a48bd0db71
commit
1758330220
Notes:
blender-bot
2023-02-14 08:33:26 +01:00
Referenced by issue #51904, Eevee Depth of Field: Issues with opengl viewport render
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue