Re: multitexturing and combiners problems




"fungus" <umailMY@xxxxxxxxxxxxxxx> wrote in message
news:qdT%f.8685$un5.4830@xxxxxxxxxxxxxxx

Maybe it's just me, be patient.... :-)

First, let's put this back in the perspective of what the
OP wanted. The OP made it clear he is inexperienced
with multitexturing and register combiners (and by
implication, probably also with shader programming).
The OP also wrote
% I just need to apply two textures to a lit polygon,
% and the second texture has an alpha channel that
% has to be taken into account.

My interpretation of all this.
(1) He does not understand the OpenGL syntax for
setting up the register combiners.
(2) The polygon is lit first and he wants to apply textures
to it.
My posted code is a working program to show him the
syntax, addressing item (1). That code uses blending
equations to use lighting first, addressing item (2).
The "requirement" of lighting last was imposed by you,
independent of anything I saw the OP post here. Perhaps
he wants to reconsider the semantics (i.e. how to blend
things and in what order), but that is actually irrelevant
to his original post.

When the incoming texture color on unit 1 is 0xffffffff
then a[1]=255 and RGB[1] is "white", yes?

So result1 is going to be "white" regardless of lighting.

The OP mentions his texture1 has an alpha channel, and he
expressed an interest in blending the texture1 with the
contributions from lighting and texture0. I presume that to
do so, he is *not* going to set all the alpha values of
texture1 to 1, thereby producing an opaque image that
hides the lighting and texture0.

Based on the OP's other questions, he is not certain about
how blending works anyway, especially not understanding
that multitexturing (register combiners) do not need
glEnable(GL_BLENDING). That also begs the question of
whether or not he understands what all the source and
destination blending modes are. Since he never mentioned
*how* he wanted to blend lighting and textures, I took the
liberty of writing a sample program that uses the standard
alpha blending modes. It is up to him to decide if those are
acceptible or if some other modes are more suitable for what
he wants.

--
Dave Eberly
http://www.geometrictools.com


.



Relevant Pages

  • Re: IDirect3DSurface9 and alpha channels
    ... what kind of per-pixel operations does this card support? ... I can understand blending two ... >> an onboard AGP card and it supports textures with power of 2 dimensions. ... >> D3DXLoadSurfaceFromFile to load the image without losing the alpha channel on ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: IDirect3DSurface9 and alpha channels
    ... Now as far as your question about the images and their alpha channel, ... along with some guidelines around the special effect, in this case blending ... >> an onboard AGP card and it supports textures with power of 2 dimensions. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: IDirect3DSurface9 and alpha channels
    ... For years cards have been able to use non-power-of-2 textures. ... I can understand blending two images with one alpha channel, but if both have alpha channels, how are you planning to use this? ... The reason I'm loading the images onto surfaces has to do with memory consumption and frame rates. ... I thought there was a way to do blending with surfaces, as I can use D3DXLoadSurfaceFromFile to load the image without losing the alpha channel on a surface, I've tested this as I saved the image back to a temp file using D3DXSaveSurfaceToFile and haven't lost the alpha channel. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Improved graphics for Fallout 3
    ... used specular maps to make the textures pop more. ... It makes the lighting better on certain creatures and on humans. ... If you go by the video from Digital Foundry regarding the comparisons before and after, outside of what I mentioned in lighting and shininess, it didn't look any better or worse than the PC or PS3 version before the patch except really in one scene with the radroaches. ... I am amazed still at how smooth the game plays considering the details in the game. ...
    (alt.games.video.xbox)
  • Re: Amped 3
    ... better textures and lighting (ie Tomb Raider) or a lot more Developers ... I will often walk into a shop and just pick up a game, but when I do that now I see the price and walk away. ...
    (uk.games.video.xbox)