Page MenuHome

GPencil: Compositing different sized scenes with grease pencil crushes Blender
Closed, ResolvedPublic

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.86

Blender Version
Broken: version: 2.83.0, branch: master, commit date: 2020-06-03 14:38, hash: rB211b6c29f771
Worked: (newest version of Blender that worked as expected)

Short description of error
Compositing different sized scenes with grease pencil crushes blender.

For exmple, mixing two render layers in composite node, from Scene.A and Scene.B,
with different resolutions (640x360 and 960x540) crushes blender if active scene is Scene.A, smaller one.
If Scene.B is active, Grease pencil is composed strangely, as an image below.

Exact steps for others to reproduce the error
Open blender and make a new scene in addition to the default one.
(Rename Scene.A and Scene.B for simplicity)

Change the resolution of the scene.
(640x360 and 960x540, for example)

Set basic objects like camera and light for new secene.
Make grease pencil object and draw some strokes for both scene.

Open Compositor and enable composition node tree.
Make render layer from both scenes and mix them as an image below.


(Note that setting for for both scenes are needed.).

If active scene is Scene.A (smaller one), rendering crushes blender.
If active scene is Scene.B, grease pencil looks strangely.
The image looks as if that the size is evaluated wrongly.

I attacht simple .blend file with above setup.


render in Scane.A crushes blender (at least on my PC).

If grease pencil objects are removed, non-grease pencil object images are composed correctly

Event Timeline

Antonio Vazquez (antoniov) renamed this task from Comositing different sized scenes with grease pencil crushes Blender to Compositing different sized scenes with grease pencil crushes Blender.EditedJun 15 2020, 3:56 PM
Antonio Vazquez (antoniov) changed the task status from Needs Triage to Confirmed.

@Clément Foucault (fclem) could you please take a look at this issue? you know better than me this area of the code.

Antonio Vazquez (antoniov) renamed this task from Compositing different sized scenes with grease pencil crushes Blender to GPencil: Compositing different sized scenes with grease pencil crushes Blender.Jun 15 2020, 3:58 PM

@Philipp Oeser (lichtwerk) Not sure if it's really a GPencil issue or it's a problem with compositing.

This looks similar to rBce09b93955de to me. In this case the solution would be:

diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 10ef8d9c4c8..1b76b8c873c 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1701,7 +1701,7 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph
   drw_context_state_init();

   DST.viewport = GPU_viewport_create();
-  const int size[2] = {(r->size * r->xsch) / 100, (r->size * r->ysch) / 100};
+  const int size[2] = { engine->resolution_x, engine->resolution_y };
   GPU_viewport_size_set(DST.viewport, size);

   drw_viewport_var_init();

But perhaps refactoring the duplicated code would be even better. The code in DRW_render_gpencil is almost identical to DRW_render_to_image with minor differences, and it's not immediately clear whether these differences are intentional or not.

@Clément Foucault (fclem) @Jeroen Bakker (jbakker) Could you take a look to the proposed fix? I don't know enough about this area of draw manager to decide.