Alpha rejection material cost..
-
syedhs
- Silver Sponsor

- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
Alpha rejection material cost..
Artist have gotten lazy and they simply use material with alpha_rejection in all meshes regardless of the texture transparency. A lot of the textures are not transparent - so the question is, is it worthwhile to remove 'alpha_rejection' for texture with no transparency in it? Will there be any speed increase or fps smoothness? Currently, the speed is not that great and there are fps hiccups here and there.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
-
dark_sylinc
- OGRE Team Member

- Posts: 5537
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1395
Re: Alpha rejection material cost..
Well, the benefits depends on the bottlenecks and performance patterns.
However, yes alpha_rejection isn't free.
It prevents early depth from kicking in. So if you've got heavy pixel shaders and you're rendering front to back, you won't get the performance boost of having the Z Buffer kill the pixel shaders before they even get to run for the pixels that are hidden.
It also may disable Z compression.
It's still however, much faster than doing regular alpha blending. And if there's no heavy overdraw or pixel shaders are cheap, then there's not a noticeable difference.
On tilers (i.e. most mobile GPUs; no desktop GPU); alpha_rejection can be very expensive as the GPU must deal it like a special case. In some cases it may even be better to do alpha blending instead (depends on a lot of factors).
However, yes alpha_rejection isn't free.
It prevents early depth from kicking in. So if you've got heavy pixel shaders and you're rendering front to back, you won't get the performance boost of having the Z Buffer kill the pixel shaders before they even get to run for the pixels that are hidden.
It also may disable Z compression.
It's still however, much faster than doing regular alpha blending. And if there's no heavy overdraw or pixel shaders are cheap, then there's not a noticeable difference.
On tilers (i.e. most mobile GPUs; no desktop GPU); alpha_rejection can be very expensive as the GPU must deal it like a special case. In some cases it may even be better to do alpha blending instead (depends on a lot of factors).
-
syedhs
- Silver Sponsor

- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
Re: Alpha rejection material cost..
Thank you dark_sylinc for the reply.
I have done simple test.. ie comment all the lines in the materials containing 'alpha_rejection'.. and I have got nice boost.. 35 fps to 45~47.. probably the actual FPS will come down to the worst 42fps..
Probably I will end up with C++ code that reparse material files to remove the alpha_rejection when the texture doesn't contain transparency.
On the other hand, I read that DXT1 can contain 1 bit alpha, probably I can squeeze something here..
My scene is pretty simple.. all materials are just slapped with diffuse texture (and they are either solid or have transparency).dark_sylinc wrote: It prevents early depth from kicking in. So if you've got heavy pixel shaders and you're rendering front to back, you won't get the performance boost of having the Z Buffer kill the pixel shaders before they even get to run for the pixels that are hidden.
I have done simple test.. ie comment all the lines in the materials containing 'alpha_rejection'.. and I have got nice boost.. 35 fps to 45~47.. probably the actual FPS will come down to the worst 42fps..
Yes the alpha blending has already been eliminated altogether!It's still however, much faster than doing regular alpha blending.
Probably I will end up with C++ code that reparse material files to remove the alpha_rejection when the texture doesn't contain transparency.
On the other hand, I read that DXT1 can contain 1 bit alpha, probably I can squeeze something here..
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me