Re: IDirect3DSurface9 and alpha channels

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Just to clear something, if your target hardware doesn't support fast
textures rendering, then rest assured it doesn't support alpha blending at
all. Even sofware rasterizers can give decent performance with texture
mapping. You must be doing something very wrong to get so bad performance
out of textures...

--
Wessam Bahnassi
Microsoft DirectX MVP,
Lead Programmer
In|Framez
--
In|Structurez Arabic Gamedev Community
www.instructurez.com


"hamlatzis" <hamlatzis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1C70BFA7-F86A-4BD9-919D-6AA3627E4082@xxxxxxxxxxxxxxxx
> For the moment I can partially answer your questions. Regarding the
> hardware
> I'll take a raincheck for tomorrow, when I'll be at the office. I work
> from
> home over the weekend.
>
> Now as far as your question about the images and their alpha channel, I
> believe it's up to me to decide which image to draw first and which
> image's
> alpha channel I should use. A graphic designer provides me with the images
> along with some guidelines around the special effect, in this case
> blending
> percentage of the two images.
>
> "Eyal Teler" wrote:
>
>> What kind of hardware graphics card are you using? For years cards
>> have been able to use non-power-of-2 textures (with some conditions).
>> Also, what kind of per-pixel operations does this card support?
>>
>> Also, what kind of blending do you want? I can understand blending two
>> images with one alpha channel (determining who much of each to
>> choose), but if both have alpha channels, how are you planning to use
>> this?
>>
>> Eyal
>>
>> hamlatzis wrote:
>> > Thanks alot.
>> >
>> > The reason I'm loading the images onto surfaces has to do with memory
>> > consumption and frame rates. I'm implementing a game that runs full
>> > screen
>> > 800x600 and I am given a minimum hardware that has to run onto. This PC
>> > has
>> > an onboard AGP card and it supports textures with power of 2
>> > dimensions. When
>> > I've tested the software even without blending (for special effects)
>> > but
>> > using textures, the frame rate dropped to a point that there were no
>> > fps to
>> > apply the game's logic. On the other hand when using surfaces, again
>> > obviously without any blending, the rendering speed was acceptable to
>> > perform
>> > the game's logic.
>> >
>> > 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.
>> >
>> > If using GDI I could do a crude transparency with:
>> >
>> > BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);
>> > BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);
>> >
>> > why shouldn't I be able to do the same or even a more sophisticated
>> > (semi)transparency with alpha channels using directX?
>> >
>> > Back to drawing board.
>> >
>> > "Wessam Bahnassi" wrote:
>> >
>> >
>> >>There isn't a HW-accelerated way to blend two IDirect3DSurface9 objects
>> >>together.
>> >>You can however lock them and do the blending by hand if you don't need
>> >>real-time operation. BTW, even if your images are 800x600, I don't see
>> >>any
>> >>reason stopping you from putting them into textures... You can either
>> >>stretch them to cover a full 1024x1024 texture or just make them use a
>> >>sub
>> >>rect of that texture...
>> >>
>> >>--
>> >>Wessam Bahnassi
>> >>Microsoft DirectX MVP,
>> >>Lead Programmer
>> >>In|Framez
>> >>
>> >>"hamlatzis" <hamlatzis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> >>news:9ADB122D-6C5E-4EBA-BE1F-E61EC0B4B037@xxxxxxxxxxxxxxxx
>> >>
>> >>>I'm loading two images that have alpha channels using
>> >>
>> >>D3DXLoadSurfaceFromFile
>> >>
>> >>>and want to use each image's alpha channel to blend them together, but
>> >>>obviously I'm doint something wrong as I only see the top image. I
>> >>>dont'
>> >>
>> >>want
>> >>
>> >>>to use textures as my images are 800x600 pixels.
>> >>>
>> >>>Can someone help me?
>> >>>
>> >>>Thanks
>> >>>
>> >>>Iosif
>> >>
>> >>
>> >>
>>


.



Relevant Pages

  • 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: creating RGBA textures from images with JOGL
    ... i did some further tests (glGetTexLevelParameter + blending) ... the textures created with TextureIO are RGBA textures ... the color values seem to be premultiplied with the alpha values ...
    (comp.graphics.api.opengl)
  • Re: Making quads transparent?
    ... blending with textures in. ... I'm more like looking for something to do with setting an alpha color ... transparent or less transparent. ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: creating RGBA textures from images with JOGL
    ... i did some further tests (glGetTexLevelParameter + blending) ... the textures created with TextureIO are RGBA textures ... the alpha values of the textures are correct ...
    (comp.graphics.api.opengl)