﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ASource%2FImage%2FColor</id>
	<title>Dev:Source/Image/Color - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ASource%2FImage%2FColor"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Image/Color&amp;action=history"/>
	<updated>2026-08-01T05:50:02Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Source/Image/Color&amp;diff=114733&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Image/Color&amp;diff=114733&amp;oldid=prev"/>
		<updated>2018-06-28T19:52:21Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 19:52時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Source/Image/Color&amp;diff=114732&amp;oldid=prev</id>
		<title>2012年12月20日 (木) 18:34にwiki&gt;Brechtによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Source/Image/Color&amp;diff=114732&amp;oldid=prev"/>
		<updated>2012-12-20T18:34:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Color =&lt;br /&gt;
&lt;br /&gt;
For the current state of color management, see the [http://www.blender.org/development/release-logs/blender-256-beta/color-management/ color management release notes].&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
* '''Scene linear''': this is the central color space that is used for rendering and compositing, it should correspond to physical units of light for realistic result.&lt;br /&gt;
* '''sRGB''' / '''gamma corrected''': this is the color space used for display in Blender.&lt;br /&gt;
&lt;br /&gt;
* '''Key alpha''': color stored as (R, G, B, A). This is a format that is used in most paint programs. This makes it possible to have RGB colors in part of the image that are completely transparent. Also called: straight alpha, unassociated alpha, unpremultiplied alpha. This also dictates which over operation to use in compositing [(Over.RGB * Over.Alpha) + (Background.RGB * (1- Over.Alpha))].&lt;br /&gt;
* '''Premultiplied alpha''': color stored as (R*A, G*A, B*A, A). This is a format that is natural for texture filtering, blurring. Also called: associated alpha. This also dictates which over operation to use in compositing [Over.RGB + (Background.RGB * (1 - Over.Alpha))].&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
&lt;br /&gt;
==== Alpha I/O ====&lt;br /&gt;
&lt;br /&gt;
File formats usually have well defined alpha mode, premul or key, but we do not respect this. It's basically up to the user now to guess what the right mode is.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': image file I/O should take care of any needed conversion.&lt;br /&gt;
&lt;br /&gt;
==== Alpha &amp;amp; Rendering ====&lt;br /&gt;
&lt;br /&gt;
Game engine and viewport OpenGL drawing assume key alpha, while render engine needs premul alpha. This means that an image with alpha with only look right in one or the other. Image editor display always assumes premul alpha. For correct texture filtering premultiplied alpha should be used in OpenGL and rendering.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': we should either define on a single standard or give tag buffers as being in either format, and ensure this is handled everywhere.&lt;br /&gt;
&lt;br /&gt;
==== Color Managment &amp;amp; Alpha ====&lt;br /&gt;
&lt;br /&gt;
Color space conversion does not take premul alpha into account, which gives bad looking results in some cases.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': color space conversion usually should happen on RGB without alpha multiplied in. This should be done by default, but it should be possible to toggle this off in some cases as well. Neither solution is right since color space conversion on images with alpha is undefined.&lt;br /&gt;
&lt;br /&gt;
==== Compositing and Sequencer ====&lt;br /&gt;
&lt;br /&gt;
The sequencer and compositor code don't take into account if the image is premul or key, color correction or blurring nodes need to take into account which alpha type is used in the input image. If we go for a premultiplied alpha standard here, color correct nodes will need changes to work correct on premultiplied RGBA.&lt;br /&gt;
&lt;br /&gt;
'''Solution''': add an option to color correction nodes, enabled by default, that converts colors to key and back for the color correction operations. This is often the desired behavior but not always.&lt;br /&gt;
&lt;br /&gt;
==== Premultiplied ====&lt;br /&gt;
&lt;br /&gt;
Color correction/mapping/management operations often need to work on color without alpha, so for those we need to first divide by alpha, do the operation, and multiply by alpha again. This may not always be needed though, the right operation is not always well defined and may depend on the background we're compositing over.&lt;br /&gt;
&lt;br /&gt;
Negatives:&lt;br /&gt;
* Image color in parts with alpha &amp;lt; 1.0 will not be usable separately anymore. This is currently possible in the texture stack with color influence enabled but alpha not for key alpha file formats (png).&lt;br /&gt;
* All colors on data are key alpha (this is useful because modifying alpha does not also modify RGB, but needs conversion).&lt;br /&gt;
* Node sockets colors are stored in key alpha, so need conversions, confusing when mixed with premul buffers.&lt;br /&gt;
* Image painting code assumes key alpha, so would need to be converted to use premul.&lt;br /&gt;
&lt;br /&gt;
==== Key ====&lt;br /&gt;
&lt;br /&gt;
Blurring/filtering/interpolation type operations need to multiply each element by alpha, so its color gets weighted properly, and then at the end divided by the sum of alphas to convert it to key alpha again.&lt;br /&gt;
&lt;br /&gt;
Negatives:&lt;br /&gt;
* Extra multiplications/divisions for mipmap creation and texture filtering.&lt;br /&gt;
* Need conversion to premul for good OpenGL texture filtering.&lt;br /&gt;
* Need extra operations in blur/defocus/vblur/filter/..&lt;br /&gt;
* EXR is premultiplied standard, and used through the render pipeline, so this would need many conversion here.&lt;br /&gt;
* Premultiplied alpha is more natural for render, there is already no color in places with alpha 0.&lt;br /&gt;
&lt;br /&gt;
== Proposed Changes ==&lt;br /&gt;
&lt;br /&gt;
* Premultiplied as standard for float images.&lt;br /&gt;
* Key alpha for byte images, or at least have the images tagged depending on the alpha type (?)&lt;br /&gt;
* Image I/O is responsible for the correct conversion to of the file format.&lt;br /&gt;
* OpenGL textures must be ensured to be in premultiplied alpha format.&lt;br /&gt;
* Color correction / management / mapping operations should happen on RGB without alpha premultiplied by default.&lt;br /&gt;
* Image datablock should get Automatic / Premul / Key options to indicate the alpha type in the file.&lt;br /&gt;
* Images used as image textures in rendering/OpenGL need an option to indicate if their alpha channel should be used or not, to avoid premultiplying when alpha is not used.&lt;br /&gt;
&lt;br /&gt;
If we use a key alpha convention for byte images, the rendering and OpenGL code needs to be adapted. When used as image textures for rendering, premultiplied alpha should be used for correct mipmapping and texture filtering. It could do conversion for mipmapping and convert back, and then in the texture filtering code make it multiply with alpha on the fly. For OpenGL there's a similar issues where for best filtering the images should be stored premultiplied on the GPU, again this conversion could be done on the fly.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
* [http://keithp.com/~keithp/porterduff/ T. Porter and T. Duff Compositing Digital Images].&lt;br /&gt;
&lt;br /&gt;
* [http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.27.5956 Alvy Ray Smith Imaging Compositing Fundamentals].&lt;br /&gt;
&lt;br /&gt;
* [http://groups.google.com/group/ocio-dev/browse_thread/thread/65e84a85416a8637/962ea485d1a210a3?lnk=gst&amp;amp;q=thoughts+on+alpha#962ea485d1a210a3 Jeremy Selan's (Lead developer of Open Color IO) opinion].&lt;br /&gt;
&lt;br /&gt;
* [http://lists.openimageio.org/pipermail/oiio-dev-openimageio.org/2011-December/004709.html Larry Gritz's (Lead developer of Open Image IO) opinion].&lt;br /&gt;
&lt;br /&gt;
* [http://forums.adobe.com/thread/369637 Adobe's thread discussing workarounds for their unassociated alpha internals regarding EXR].&lt;/div&gt;</summary>
		<author><name>wiki&gt;Brecht</name></author>
		
	</entry>
</feed>