diff options
Diffstat (limited to 'source/blender/draw/modes/shaders/object_camera_image_frag.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/object_camera_image_frag.glsl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/object_camera_image_frag.glsl b/source/blender/draw/modes/shaders/object_camera_image_frag.glsl new file mode 100644 index 00000000000..5d8ad3c79ea --- /dev/null +++ b/source/blender/draw/modes/shaders/object_camera_image_frag.glsl @@ -0,0 +1,23 @@ +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; +} |