Moshe Nissim (moshe++at++orad.co.il)
Mon, 08 Jun 1998 20:26:55 +0300
> No, what's being requested is _very_ strange and has limited
> application.
> Perhaps you have something else in mind, but it's unclear exactly what.
I think what I have in mind is what the original post requested.I will mention later why it is not so strange.
A texture environment that blends texture color with fragment color, (instead
of multiplying them), according to a constant alpha value. This constant alpha
can be the alpha component of the texture environment color (Cc).
GL_MODULATE multiplies Ct and Cf. This may contradict intuition (of some).
For example, if lighting is enabled, the material colors are greenish,
and the texture is bluish, the resulting color is blackish.
In our Performer loader for SoftImage, this is the exact problem we
are encountering. SoftImage may define a texture-material interaction which
is blending by a speficied factor. To implement this in Performer (and OpenGL),
there is no direct texture environment that is applicable. Like I mentioned,
GL_MODULATE does not blend at all. GL_ADD is closer, but it does not multiply
the fragment color (Cf), just the texture color (Ct). The only way to do it
(without resorting to multipass rendering...)
is with GL_DECAL, and RGBA texture, with the blend factor written all accross the
alpha channel of the texture. Then it does Cv=(1-At)Cf+AtCt. However, we need
to sacrifice the texture's alpha channel for this constant value.
I would love to see the following texture environemnt:
Cv=(1-Ac)Cf+AcCt
Av=(1-Ac)Af+AcAt
I am including the formula tables from glTexEnv
You could argue that also some of these are _very_ strange and have limited
application :)
A texture function acts on the fragment to be textured using the texture
image value that applies to the fragment (see glTexParameter) and
produces an RGBA color for that fragment. The following tables show how
the RGBA color is produced for each of the texture functions. C is a
triple of color values (RGB) and A is the associated alpha value. RGBA
values extracted from a texture image are in the range [0,1]. The
subscript f refers to the incoming fragment, the subscript t to the
texture image, the subscript c to the texture environment color, the
subscript b to the texture environment bias color, and subscript v
indicates a value produced by the texture function.
A texture image can have up to four components per texture element (see
glTexImage1D and glTexImage2D). In an image of GL_LUMINANCE format Lt
indicates the single component. In an image of GL_ALPHA format At
indicates the single component. In an image of GL_INTENSITY format It
indicates the single component. A two-component image uses Lt and At. A
three-component image has only a color value, Ct. A four-component image
has both a color value Ct and an alpha value At. If a color triple is
shown to be equal to a single component format, this denotes that each
component of the color triple is set equal to the single component.
Similarly when 2 color triples are shown as being multiplied, this
denotes that each component of the first triple is multiplied by the
corresponding component of the second triple.
________________________________________________________________________
| number of || texture functions |
|____components_____||GL_MODULATE_______GL_DECAL___________GL_BLEND_____|
| GL_LUMINANCE || Cv=LtCf | | Cv=(1-Lt)Cf+LtCc |
| 1 || Av=Af | undefined | Av=Af |
|___________________||____________|__________________|__________________|
| GL_ALPHA || Cv=Cf | undefined | Cv=Cf |
|___________________||__Av=AtAf___|__________________|_____Av=AtAf______|
| GL_INTENSITY || Cv=ItCf | | Cv=(1-It)Cf+ItCc |
| || Av=ItAf | undefined | Av=(1-It)Af+ItAc |
|___________________||____________|__________________|__________________|
|GL_LUMINANCE_ALPHA || Cv=LtCf | undefined | Cv=(1-Lt)Cf+LtCc |
|________2__________||__Av=AtAf___|__________________|_____Av=AtAf______|
| GL_RGB || Cv=CtCf | Cv=Ct | Cv=(1-Ct)Cf+CtCc |
| 3 || Av=Af | Av=Af | Av=Af |
|___________________||____________|__________________|__________________|
| GL_RGBA || Cv=CtCf | Cv=(1-At)Cf+AtCt | Cv=(1-Ct)Cf+CtCc |
|________4__________||__Av=AtAf___|______Av=Af_______|_____Av=AtAf______|
______________________________________________________
| number of || texture functions |
|____components_____||GL_REPLACE_EXT______GL_ADD_____|
| GL_LUMINANCE || Cv=Lt | Cv=Cf+LtCc+Cb |
| 1 || Av=Af | Av=Af |
|___________________||_______________|_______________|
| GL_ALPHA || Cv=Cf | Cv=Cf |
|___________________||____Av=At______|____Av=AtAf____|
| GL_INTENSITY || Cv=It | Cv=Cf+ItCc+Cb |
| || Av=It | Av=Af+ItAc+Ab |
|___________________||_______________|_______________|
|GL_LUMINANCE_ALPHA || Cv=Lt | Cv=Cf+LtCc+Cb |
|________2__________||____Av=At______|____Av=AtAf____|
| GL_RGB || Cv=Ct | Cv=Cf+CtCc+Cb |
| 3 || Av=Af | Av=Af |
|___________________||_______________|_______________|
| GL_RGBA || Cv=Ct | Cv=Cf+CtCc+Cb |
|________4__________||____Av=At______|____Av=AtAf____|
Bye,
Moshe
-- Moshe Nissim, Orad Hi-Tec Systems Tel: (972) - 9 - 7676862 Fax: (972) - 9 - 7676861 Email: moshe++at++orad.co.il
======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:31 PDT