🔒 Locked
transparency
Advertisement
Original Post
What is the best way to fix overlapping transparent polys (or polys that partially break the plane of another poly)? z-sorting alone doesn't fix the problem. I started writing some complicated code to check the half space of a poly vs another polys verts... but there are some issues. Will directx zbias take care of this problem? I need a simple solution...
Split the polys at their intersection and z-sort, try additive blending, or live with it.
Quote:
Original post by superpig Quote:
Original post by Squirm
glBlendFunc(GL_ONE, GL_ONE);
but no idea what the DX call looks like.
Shouldn't that be glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)?
That's for standard order dependent transparency. Assuming Squirm's reply was to wxb1's inquiry about additive blending, then yes, it's glBlendFunc(GL_ONE, GL_ONE);
I always end up using (GL_SRC_ALPHA, GL_ONE) for additive blending, but its pretty much the same idea really.
Ok...
I used this:
D3DBlendFunc (D3DBLEND_ONE , D3DBLEND_ONE );
And the transparent parts of the model lit up white, and the whole model was transparent...
Then I tried:
D3DBlendFunc (D3DBLEND_SRCALPHA , D3DBLEND_ONE );
And the transparent parts stayed transparent but the whole model was transparent...
I think I need to state that I'm trying to render a model like a tree which has leaves that have transparency. But the trunk of the tree should be solid! Now the tree is mapped with one texture as well...
I used this:
D3DBlendFunc (D3DBLEND_ONE , D3DBLEND_ONE );
And the transparent parts of the model lit up white, and the whole model was transparent...
Then I tried:
D3DBlendFunc (D3DBLEND_SRCALPHA , D3DBLEND_ONE );
And the transparent parts stayed transparent but the whole model was transparent...
I think I need to state that I'm trying to render a model like a tree which has leaves that have transparency. But the trunk of the tree should be solid! Now the tree is mapped with one texture as well...
For something like a tree additive blending will just look weird. You'll need to use (SRC_ALPHA, ONE_MINUS_SRC_ALPHA) with proper sorting to get correct results.
However for trees you can avoid using blending altogether. Use the alpha test instead and no blending. Since you get a binary pass/fail you can still use depth testing and don't need to sort anything. With a suitable test value (somewhere between 0.4 and 0.6 is usually good) you can get nice fake curved edges much like you would from blending.
However for trees you can avoid using blending altogether. Use the alpha test instead and no blending. Since you get a binary pass/fail you can still use depth testing and don't need to sort anything. With a suitable test value (somewhere between 0.4 and 0.6 is usually good) you can get nice fake curved edges much like you would from blending.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement