Feathering with Alpha Blending

Started by
11 comments, last by DonnieDarko 17 years, 11 months ago
I'm thinking an even better approach would be to render all my vegetation with alpha testing first(before i was doing two passes on each object consecutively), and then re-render the close stuff with alpha blending. This way the only blending glitches will be edge-edge, instead of edge-entire object, if you know what I mean. It will also cut down on fill rate since only the edges in the second blending pass will pass the test, like donnie said. What do you guys think?
Advertisement
You should try alpha to coverage.

It's screen door transparency with dithering and when MSAA is enabled the dithering is almost invisible (unless you have large parts of the images covered with it, and that you shouldn't anyway).

Enabling Alpha to coverage is explained there :
Antialiasing with transparency
(it's called transparency multisampling in this document but it's really alpha to coverage).

Advantages : feathered borders, single pass, no sorting
Drawbacks : dithering, you need at least 4x MSAA to enable the effect (but then if you rendered without antialiasing you probably didn't care about your vegetation aliasing..). Not available on all hardwares (geforce 7 and later, it should be integral part of the D3D10 API).

LeGreg
I tried a technqiue where the passes are reversed a slightly mofified. It seems to work fine and theres no overdraw.

Btw. is there any performance benfit from reducing overdraw with depth buffer over alpha test?

technique Foliage{   pass P0   {	AlphaBlendEnable = False;	AlphaTestEnable = True;	AlphaRef = 255;	AlphaFunc = Equal;                VertexShader = compile vs_1_1 vs();        PixelShader  = compile ps_2_0 psTex();    }    pass P1    {    	AlphaTestEnable = False;	AlphaBlendEnable = True;	SrcBlend = SrcAlpha;	DestBlend = InvSrcAlpha;		ZFunc = Less;	ZWriteEnable = False;            VertexShader = compile vs_1_1 vs();        PixelShader  = compile ps_2_0 psTex();    }}

This topic is closed to new replies.

Advertisement