|
|
Re: Alpha Test + Alpha Blending
[Re: mpdeveloper_B]
#149206
08/24/07 22:23
08/24/07 22:23
|
Joined: Oct 2003
Posts: 4,131
Matt_Aufderheide
Expert
|
Expert
Joined: Oct 2003
Posts: 4,131
|
Quote:
two-pass rendering, alpha-to-coverage, or edge detection and blurring.
These are three methods I know of to get soft edges and still correct sorting.
2-pass: render the model once with alphatestenable=true and zwriteenable=false. render it in a second pass with alphatestenable=false, alphablendenable=true and zwrite false.. also set zfunc=less
Drawback is that you must do two passes, not a problem unless you have a lot of models..
//////////////////////////////////////////////////////////////////////////////// alpha-to-coverage: hardware method that requires anti-aliasing to be forced on, and hardawre support. you must simply enable the alpha-to-coverage render state, however you may have to do it in a dll usig d3d, very simple todo it though..this line does it:
pointertod3ddevice-> SetRenderState(D3DRS_ADAPTIVETESS_Y, (D3DFORMAT)MAKEFOURCC('A', 'T', 'O', 'C'));
////////////////////////////////////////////////////////////////////////////////
edge detection and blurring:
more complex and sophisticated method, requires knowledge of sahders and render-to-texture.
Grab the backbuffer into a texture that's larger than the screen resolution. Then render a screen-aligned-quad with a special shader. In this shader do a Sobel 6-tap edge detection filter, and also store the average of the rgb 6-tap (which is a blur) .. use the edge results to lerp the blur with the plain sample of the back buffer tex...then you have soft edge globally like super anti-aliasing.
...if you dont understand this last section, just ignore this option 
|
|
|
|
|
|