[Paracomp-spec] RFC: Extension PC_COMP_ADD_EXT - an accumulation operator
Brought to you by:
shreekumar
|
From: Shree K. <shr...@hp...> - 2008-05-29 06:10:54
|
I'm proposing this extension on behalf of the Technical University of
Budapest. Their proposal has three parts - an ADD operator, plus
floating point and intensity datatypes. So I'm splitting their proposal
into three parts.
Motivation:
Paracomp currently supports two compositing modes - PC_COMP_DEPTH &
PC_COMP_ALPHA_SORT.
PC_COMP_ALPHA_SORT offers just a single blending mode from the 9x9=81
modes offered by OpenGL. Other blending modes also have importance in
particular algorithms. For example, if the material at sample points
have significant emission and are almost transparent (e.g. fire,
emission nebulae, astrophysics simulations, etc.), then the contribution
of sample points can be simply added without any previous depth sort.
Note that the elimination of the previous depth sort is a significant
advantage since it can simplify and speed up the implementation
considerably. Such operation, called accumulation, would be specified by
glBlendFunc(GL_ONE, GL_ONE) in OpenGL, and could be described by the
following equation:
(R,G,B,A) = (R1+R2, G1+G2, B1+B2, A2+A2)
Rough Extension Proposal:
Extend the API to include the ADD operation as follows:
1. pcContextCreateMaster accepts a new value for PC_COMPOSITE_TYPE -
PC_COMP_ADD_EXT. The accumulation is order independent.
2. Add a new context property, PC_ALPHA_BEHAVIOUR. This property
affects the add operator. This property can take two values
a. PC_ALPHA_SEPARATE: Implements glBlendFunc(GL_ONE, GL_ONE).
(Rs, Gs, Bs, As)+(Rd, Gd, Bd, Ad)=(Rs+Rd, Gs+Gd, Bs+Bd, As+Ad)
Where + means saturated addition. This is useful when
accumulation has to be performed for separate scalar values.
b. PC_ALPHA_PREMULTIPLED: Color values are multiplied by alpha
value before the compositing operation.
(Rs, Gs, Bs, As)+(Rd, Gd, Bd, Ad)=(As*Rs+Ad*Rd, As*Gs+Ad*Gd,
As*Bs+Ad*Bd, As*As+Ad*Ad)
Where + means saturated addition. This is useful when more
complicated compositing model is used with multiple compositing
contexts. For example an alpha blending context takes the
output of an intensity accumulation context as its input, or
vice versa.
3. pcFrameBegin ignores the "order" parameter if COMPOSITE_TYPE is
COMP_ADD_EXT, since the operation is order independent.
Comments/questions welcome.
Thanks in advance
-- Shree
|