This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/modes/shaders/object_camera_image_frag.glsl
Jeroen Bakker fed6c1a970 Fix T62876: Camera Background Images
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 transparent pixels are treated as background pixels.
Also There are some artifacts when working with Holdouts and DoF, this
is because the draw engines do not pass the correct alpha values.

Reviewers: fclem, brecht

Differential Revision: https://developer.blender.org/D4638
2019-06-21 09:53:51 +02:00

24 lines
594 B
GLSL

in vec2 texCoord_interp;
out vec4 fragColor;
uniform sampler2D image;
uniform float alpha;
uniform bool imagePremultiplied;
void main()
{
#ifdef DRW_STATE_DO_COLOR_MANAGEMENT
/* render engine has already applied the view transform. We sample the
* camera images as srgb*/
vec4 color = texture_read_as_srgb(image, imagePremultiplied, texCoord_interp);
#else
/* Render engine renders in linearrgb. We sample the camera images as
* linearrgb */
vec4 color = texture_read_as_linearrgb(image, imagePremultiplied, texCoord_interp);
#endif
color.a *= alpha;
fragColor = color;
}