Skip to main content
gamedev.net
🔒 Locked

Alpha blending hardware device

Started by yurixd Oct 25, 2005 at 11:25 AM 4 replies 1.1k views
Original Post
yurixd
yurixd
Hi! I almost finish my project. Software emolution is working...but when i tried with hardware i have some problems. Im doing Alpha blending with hr |= this->direct3DDevice->SetRenderState( D3DRS_ALPHABLENDENABLE , true ); hr |= this->direct3DDevice->SetRenderState( D3DRS_SRCBLEND , D3DBLEND_ONE ); hr |= this->direct3DDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE ); The value of each pixel of my render target surface should be several additions of values as 0.1875, 0.0625, 0.5625 For example if I render three times to the position (0,0) with values 0.5625, 0.1875, 0.5625, the result in my render target at position (0.0) at the end will be 1.3125 Using the reference device (software) and software vertex processing, i got this value. But, using my hardware device all the results are smaller than one and exactly one of these values (0.1875, 0.0625, 0.5625 or 0) Anyone can give me a reason? And how to solve it?? Many thanks, for all your help duting this time!
jollyjeffers
jollyjeffers
Quote:
the result in my render target at position (0.0) at the end will be 1.3125

Right, this suggests to me that you're using a floating point render target? Correct?

For other, traditional, render target formats you should be clamped to 0.0 - 1.0 if you're expressing values on that scale, or the integer-rounded version of 1.3125 -> 1.0...

Two things tend to be lacking from all but the latest-n-greatest hardware when it comes to FP rendering:
1. Texture filtering (ATI even said this wasn't important to implement [rolleyes])
2. Post pixel shader blending - which is what you're trying to use.

I don't know what the D3D specification says about a device that uses blending when the hardware doesn't support it, but I'd hazard a guess that it's either undefined (matches with your results) or ignored (possibly matches your results).

The reference device, if that's what you've been using, tends to support both filtering and blending - which would be why it works as expected [smile]

Now, if I'm completely wrong and you're not using HDR/FP rendering, you'll have to explain where/what these small floating point values you're talking about are...

Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
yurixd
yurixd
I have a really good graphic card FX Quadro 4400 of Nvidia!
It supports alpha blending, and my render target is D3DFMT_A32B32G32R32F
But as you said, is not the first time someone tell me that precision of alpha blending is just fp16 ...! But, why my results are always less than 1 ???
How, I should change my prgoram and where to take significance abour fp16 instead of fp32 ? Creating my render target ? In the output of my pixel shader? And overall how ??
Thanks!!!
Jesus
jollyjeffers
jollyjeffers
I don't know exactly why you're getting different results... but it wouldn't be too strange to put it down to "undefined behaviour" when you're trying to use a feature that doesn't exist [grin]

Also, even with your nice graphics card, I haven't seen any commercial hardware yet that'll do filtering/blending on a 32F texture - so don't be too surprised if it's the same on yours. Quadro's are better than GeForce's, but my understanding is they're essentially derivatives of the same technology.

You need to implement some enumeration code - and on the strength of those results pick the result that suits you best...

Enumerating in the following order might be beneficial:

  • ARGB32F + Blending
  • ARGB16F + Blending
  • ARGB32F
  • ARGB16F

    If you enumerate using IDirect3D9::CheckDeviceFormat() with the usage flag of D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING | D3DUSAGE_RENDERTARGET you should be able to check that at least basic blending is acceptable. You probably also want to dig up the device caps and see what blending modes (and operators) it'll support...

    Whichever format comes up as the best choice, use that when creating your render target.

    hth
    Jack
  • <hr align="left" width="25%" />
    Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
    yurixd
    yurixd
    Thanks, you were right, but im going to put a new post!!!
    Any information will be great!
    But I founded that in nvidia site

    I founded That in nvidia page

    32-Bit Floating Point Precision
    Sets new standards for image clarity and quality through 32-bit floating point capabilities in shading, filtering, texturing, and blending. Enables unprecedented rendered image quality for visual effects processing. Only supported in the NVIDIA Quadro FX 4400, 4000, 3400 and Go1400 GPUs.

    So whats going on ?

    Topic Locked

    This topic has been locked by a moderator. New replies are not allowed.

    Sign in to reply to this topic.