Page MenuHome

Fix T80748: Render Emissive Colors in Compositor Backdrop
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Nov 4 2020, 2:05 PM.

Details

Summary

This change will use the image engine to draw the backdrop of the compositor. With this patch the alpha blending will be done in Linear Scene Reference space and shows pure emissive colors.

Technical changes

As only the backdrop drawing is done using the draw manager there are some technical changes.

  1. The overlay buffer is partly drawn outside the draw manager. When drawing the backdrop image the overlay buffer needs to be masked to simulate premultiplied alpha under.
  2. The backdrop of the node editor is done in region pixel space. A DRWView is constructed with this space.
  3. UDIM textures uses world position to generate the UV coordinates. This has been implemented more strict by the IMAGE_DRAW_FLAG_USE_WORLD_POS. When the flag isn't used the local coordinates are used to generate the UV coordinates what is image space.
  4. The draw manager now checks the actual eSpaceType of the space data to use different code paths. In the future the movie clip editor will be added.
NOTE: The preview images in nodes are drawn in display space and cannot show pure emissive colors. As preview images are used on more locations it is best to fix this in a separate patch.

Diff Detail

Repository
rB Blender
Branch
T80748 (branched from master)
Build Status
Buildable 11185
Build 11185: arc lint + arc unit

Event Timeline

Jeroen Bakker (jbakker) requested review of this revision.Nov 4 2020, 2:05 PM
Jeroen Bakker (jbakker) created this revision.
Jeroen Bakker (jbakker) retitled this revision from Fix T80748: Render Emissive Colors in Compositor to [WIP] Fix T80748: Render Emissive Colors in Compositor.Nov 4 2020, 2:07 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Nov 4 2020, 2:51 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Mask background based on the depth and alpha channel

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Nov 4 2020, 3:03 PM

Remove unneeded code, some small tests

Commit at the end of the day.

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Nov 9 2020, 8:41 AM
  • Setup correct view for drawing backdrop.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Nov 9 2020, 9:42 AM
  • Setup correct view for drawing backdrop.
  • Renamed SIMA_DRAW_FLAGS to IMAGE_DRAW_FLAGS
  • Activate the image engine view only when drawing.
  • Use world position to extract UV coordinates for UDIM textures
  • Cleanup: Commits should start with an uppercase
  • Don't rebind old framebuffer as srgb target.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Nov 9 2020, 10:16 AM
  • Do not draw callbacks and gizmos when drawing the backdrop
  • Setup correct view for drawing backdrop.
  • Renamed SIMA_DRAW_FLAGS to IMAGE_DRAW_FLAGS
  • Activate the image engine view only when drawing.
  • Use world position to extract UV coordinates for UDIM textures
  • Cleanup: Commits should start with an uppercase
  • Don't rebind old framebuffer as srgb target.
  • Do not draw callbacks and gizmos when drawing the backdrop
Jeroen Bakker (jbakker) retitled this revision from [WIP] Fix T80748: Render Emissive Colors in Compositor to Fix T80748: Render Emissive Colors in Compositor Backdrop.Nov 9 2020, 11:27 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Nov 9 2020, 1:38 PM
Clément Foucault (fclem) requested changes to this revision.Nov 23 2020, 3:48 PM

For the background masking, I suggest (instead of adding another special case for blending) to use multiply blending with a solid white background color. This should occlude the alpha parts from the render nicely.

This revision now requires changes to proceed.Nov 23 2020, 3:48 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
  • Replaced mask background blend mode with multiply

Looks good to me. Just have few minor observation.

source/blender/draw/engines/overlay/shaders/background_frag.glsl
36

You could put this inside the switch statement like this

case BG_MASK:
  fragColor = vec4(vec3(1.0 - alpha), 0.0);
  return;
source/blender/editors/space_node/drawnode.c
3560

Make a comment to indicate that this is drawing the render preview.

3612

Is this needed?

This revision is now accepted and ready to land.Nov 24 2020, 1:06 PM
Jeroen Bakker (jbakker) marked 3 inline comments as done.
  • Minor changes before landing into master
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Nov 24 2020, 1:21 PM