Page MenuHome

Multiview not working with OpenGL render using scene settings
Open, ConfirmedPublic

Description

System Information
Operating system: Ubuntu 18.10
Graphics card: NVIDIA Geforce GTX 1070

Blender Version
Broken: 2.79b (release and master 335e1b507b1), 2.80 (8c620c8e2b3 and 925380050d0)

Short description of error
When running bpy.ops.render.opengl(view_context=False), the multiview settings (bpy.context.scene.render.use_multiview = True, etc.) are ignored unreasonably.

Exact steps for others to reproduce the error

  1. Start Blender from command line
  2. Open multiview_render_test.blend
  3. Click "Run Script" button in the Text Editor

Console output of the result is as follows:

=== Multiview render tests ===

(1) Single Frame

a. Not OpenGL
Saved: '/tmp/test_L.png'
Saved: '/tmp/test_R.png'
 Time: 00:00.19 (Saving: 00:00.12)

b. OpenGL (view_context=True)
Saved: '/tmp/test_L.png'
Saved: '/tmp/test_R.png'
OpenGL Render written to '/tmp/test_R.png'
c. OpenGL (view_context=False)
Saved: '/tmp/test.png'
OpenGL Render written to '/tmp/test.png'

(1) Animation

a. Not OpenGL
Saved: '/tmp/test0001_L.png'
Saved: '/tmp/test0001_R.png'
 Time: 00:00.13 (Saving: 00:00.07)

Saved: '/tmp/test0002_L.png'
Saved: '/tmp/test0002_R.png'
 Time: 00:00.13 (Saving: 00:00.07)

Saved: '/tmp/test0003_L.png'
Saved: '/tmp/test0003_R.png'
 Time: 00:00.13 (Saving: 00:00.07)

Saved: '/tmp/test0004_L.png'
Saved: '/tmp/test0004_R.png'
 Time: 00:00.13 (Saving: 00:00.07)

Saved: '/tmp/test0005_L.png'
Saved: '/tmp/test0005_R.png'
 Time: 00:00.13 (Saving: 00:00.07)

b. OpenGL (view_context=True)
Saved: '/tmp/test0001_L.png'
Saved: '/tmp/test0002_L.png'
Saved: '/tmp/test0003_L.png'
Saved: '/tmp/test0004_L.png'
Saved: '/tmp/test0002_R.png'
Saved: '/tmp/test0001_R.png'
Saved: '/tmp/test0005_L.png'
Saved: '/tmp/test0004_R.png'
Saved: '/tmp/test0003_R.png'
Saved: '/tmp/test0005_R.png'
c. OpenGL (view_context=False)
Saved: '/tmp/test0001.png'
Saved: '/tmp/test0005.png'
Saved: '/tmp/test0002.png'
Saved: '/tmp/test0004.png'
Saved: '/tmp/test0003.png'

Only OpenGL render with view_context=False did single view rendering incorrectly.

Solution
I believe the following patch fixes the bug:

diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 78cedf099a1..e1d081d7e15 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -165,10 +165,10 @@ static bool screen_opengl_is_multiview(OGLRender *oglrender)
 	RegionView3D *rv3d = oglrender->rv3d;
 	RenderData *rd = &oglrender->scene->r;
 
-	if ((rd == NULL) || ((!oglrender->is_sequencer) && ((rv3d == NULL) || (v3d == NULL))))
+	if ((rd == NULL) || ((v3d != NULL) && (rv3d == NULL)))
 		return false;
 
-	return (rd->scemode & R_MULTIVIEW) && ((oglrender->is_sequencer) || (rv3d->persp == RV3D_CAMOB && v3d->camera));
+	return (rd->scemode & R_MULTIVIEW) && ((v3d == NULL) || (rv3d->persp == RV3D_CAMOB && v3d->camera));
 }
 
 static void screen_opengl_views_setup(OGLRender *oglrender)
@@ -212,7 +212,7 @@ static void screen_opengl_views_setup(OGLRender *oglrender)
 		}
 	}
 	else {
-		if (!oglrender->is_sequencer)
+		if (v3d)
 			RE_SetOverrideCamera(oglrender->re, V3D_CAMERA_SCENE(oglrender->scene, v3d));
 
 		/* remove all the views that are not needed */

Details

Type
Bug