Page MenuHome

Fix T67832: Camera Background Images View Transform
Needs RevisionPublic

Authored by Jeroen Bakker (jbakker) on Mon, Mar 9, 12:32 PM.

Details

Summary

This patch will apply the view transform when a movie clip is used as
camera background image. It does this by rendering the image in the
color buffer when it needs the view transform. For other images it uses
the overlay buffer.

This will introduce a limitations that we need to check how we want to
solve it:

Camera Background images only work in the next configurations:

  • Wireframe mode/Solid mode
  • Material Preview mode with custom HDRI and World Opacity less than zero.
  • Render mode when Film transparency is on.

Diff Detail

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

Event Timeline

Brecht Van Lommel (brecht) added inline comments.
source/blender/draw/engines/overlay/overlay_image.c
151

For images, set r_use_view_transform to true if IMA_VIEW_AS_RENDER is enabled.

source/blender/draw/engines/overlay/overlay_image.c
151

Yes, that was the idea.
but would first want the rendering part of the patch to be correct.

Yes you can reintroduce DRW_STATE_BLEND_UNDER.

And while you are at it you can also refactor DRWState to pack some mutually exclusive options to free some bits 😄 .

source/blender/draw/engines/overlay/overlay_image.c
58

Why do you use DRW_STATE_WRITE_DEPTH and DRW_STATE_DEPTH_LESS_EQUAL?

71

Why alpha premul here and not for image_foreground_ps? Seems like one of them is wrong.

466

Style: Split this into its own function OVERLAY_image_scene_background_draw and remove the framebuffer restore. Call OVERLAY_image_scene_background_drawat the very begining of OVERLAY_draw_scene. Also add a little comment saying this function draws background images that needs to be color corrected using scene transform, and that it draws in main color buffer.

Jeroen Bakker (jbakker) marked an inline comment as done.Tue, Mar 10, 10:07 AM

There is a separate patch for the DRWState bits D7088: DrawManager: Pack Draw State Bits

Jeroen Bakker (jbakker) marked 3 inline comments as done.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Fixed issues from code review

Clément Foucault (fclem) requested changes to this revision.Tue, Mar 10, 3:21 PM
Clément Foucault (fclem) added inline comments.
source/blender/draw/engines/overlay/shaders/image_frag.glsl
32

always premultiply here for consistency. and change the drawstate of the passes accordingly.

source/blender/draw/intern/draw_manager_exec.c
264

glBlendFuncSeparate(GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA, GL_ONE, GL_ONE); means alpha is accumulated (added even)

you want
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);

and rename DRW_STATE_BLEND_UNDER to DRW_STATE_BLEND_ALPHA_UNDER_PREMUL for consissteency.

This revision now requires changes to proceed.Tue, Mar 10, 3:21 PM