• Advertisement
Sign in to follow this  

Need help on color blending

This topic is 4149 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys! I am trying to get some basic blending to work here. I have read the faq but I still couldnt get a simple blend operation to work so far. First, I output a FP16F rendersurface with color half4(0.5,1,0,0) from the pixelshader. No blendstates are set yet. For the next render pass, I output to the same rendersurface a color of half4(0.2,0,0,0). I am trying to add the result to see if I get half4(0.7,1,0,0). my renderstates for this second pass:
CullMode = CCW;
		
SrcBlend = One;
DestBlend = One;
BlendOp = Add;
AlphaBlendEnable = true;
		
ColorOp[0] = Add;
ColorArg0[0] = Current;
ColorArg1[0] = Texture;
		
AlphaOp[0] = Add;
AlphaArg0[0] = Current;
AlphaArg1[0] = Texture;
		
ZEnable = false;
ZWriteEnable = false;
ColorWriteEnable = RED|GREEN|BLUE|ALPHA;


I am not understanding something? In any case, I am not sure what to set for ColorArg0,ColorArg1,AlphaArg0,AlphaArg1. Do I need to set the BlendOp? Does setting AlphaBlendEnable also enables color blending? pardon me, my blending really sux. So I hope I can get some insight. I have search google for a while but I cant seem to find anything useful other than msdn. Edit: I tried doing it on an A8R8G8B8 and it works but not on an FP16F rendersurface. I am using X800. thx! Edwin [Edited by - edwinnie on October 15, 2006 6:25:40 AM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
I tried doing it on an A8R8G8B8 and it works but not on an FP16F rendersurface. I am using X800.
I reckon this is your problem - not your code.

Using the blending hardware on FP inputs/outputs is not universally supported and I'm very sure the X800 series doesn't allow it. It wasn't until ATI's later X1000 (R5xx series) GPU's that it was possible.

I had to implement this manually using a pixel shader on a Radeon 9800 last year - it knocked about 10% of the performance which wasn't ideal but hardly fatal.

Use IDirect3D9::CheckDeviceFormat() with D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING to see if your hardware supports it or not. Having it dynamically switch between fixed-function and programmable blending isn't too hard to implement, so you can get the benefit where possible and still have it run okay on older hardware.

hth
Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement