Page MenuHome

Viewport Render doesn't render Grease Pencil Overlays, Shading
Confirmed, NormalPublicBUG

Description

System Information
Operating system: Windows 7 x64
Graphics card: NVIDIA GeForce GTX 580

Blender Version
Broken: 2.82 a854840e76ae

Short description of error
Rendering with the Viewport Render operator doesn't render Overlays and Shading settings pertaining to Grease Pencil objects. Regardless of the Fade Layers overlay setting or the Color Type setting, Grease Pencil objects render as if no Overlay settings are active and with the Material color type.

Exact steps for others to reproduce the error
Open attached .blend, confirm the Fade Layers Overlay setting and Random Color Type shading settings are active, call Viewport Render Image operator, resulting image differs from Viewport.

Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Developer to Reproduce.Fri, Jan 3, 1:37 PM

Can confirm the behavior, but I am unsure about the state of the Viewport Render operators (bpy.ops.render.opengl).

@Jeroen Bakker (jbakker): it may very well be that this is just a known limitation about these operators. Wouldnt these be removed/obsolete at some point with the workbench render engine anyways?
(btw. the workbench renderengine F12 lso doesnt respect the Random Color Type for Greasepencil objects...)

Actually, the render doesn't display any overlay in Grease Pencil.

As @Clément Foucault (fclem) is doing a refactor of the drawing engine, we must wait to see how this will be handle, because some of the current overlays in grease pencil engine it will be moved to overlay engine.

Campbell Barton (campbellbarton) changed the task status from Needs Developer to Reproduce to Confirmed.Tue, Jan 14, 11:15 AM

Checked on this and replacing DRW_state_is_image_render for DRW_state_is_scene_render seems to make this work as expected.

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index a1a1f7cc389..f4baf2c7837 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -439,7 +439,7 @@ void GPENCIL_cache_init(void *vedata)
       stl->storage->is_main_onion = false;
     }
     /* save render state */
-    stl->storage->is_render = DRW_state_is_image_render();
+    stl->storage->is_render = DRW_state_is_scene_render();
     stl->storage->is_mat_preview = (bool)stl->storage->is_render &&
                                    STREQ(scene->id.name + 2, "preview");
Campbell Barton (campbellbarton) changed the subtype of this task from "Report" to "Bug".Tue, Jan 14, 11:15 AM

I think it's safe to include this fix for 2.82 as the whole implementation has been rewritten for 2.83