Page MenuHome

Camera Background Images
Needs ReviewPublic

Authored by Jeroen Bakker (jbakker) on Apr 3 2019, 3:08 PM.

Details

Summary

Migrate old legacy code to the draw mamager/object mode. The old legacy
version did not work with wireframe. By migrating the code
to modern draw manager code we have mode control on the drawing process.

Still background images do not work with OIT, the cause seems to be that the alpha of transparent pixels ZERO and are treated as background pixels.
This patch does not solve the OIT .

Fix: T62876, T63237

Diff Detail

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

Event Timeline

WIP: Refactor Camera Background Images

Migrating legacy drawing code for camera background images
to be compatible with draw manager.

two questions still needs to be validated:

  1. Is there a better way to calculate the matrices. I simulate a screen/viewrect space transformation.
  2. GPU textures of the MovieClip are not freed when scrubbing this leads to memory issues. Need a clever way for freeing unused images.
Jeroen Bakker (jbakker) retitled this revision from Camera Background Images to WIP: Camera Background Images.Apr 3 2019, 3:17 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
source/blender/draw/modes/object_mode.c
1147

update comment

1602

remove line

source/blender/draw/modes/shaders/object_camera_image_frag.glsl
7

Add depth to the gl_Position?

source/blender/draw/modes/shaders/object_camera_image_vert.glsl
14

Better names for pos_s, pos2d

19

in stead of booleans we can use a vec2.

source/blender/draw/modes/object_mode.c
1254

Change to vec2

source/blender/gpu/intern/gpu_draw.c
403

Merge with gpu_get_image_gputexture code

Use premul for in front rendering and use OIT blending for rendering in back.
As rendering in back is additive the visual results differ from what users
might expect when changing the alpha value.

Issue is related that IOT transparent objects have an alpha value of 0.0 in the DST buffer.
This will give other artifacts (transparent pixels are seens as background and overwritten at all.

This is a shortcoming of having all these options to help the user and how we render them in the pipeline.

Set background images to use premul blending.

Jeroen Bakker (jbakker) retitled this revision from WIP: Camera Background Images to Camera Background Images.Apr 10 2019, 12:56 PM

Rebased with master (clang-format)