Problem with Alpha

Blitz3D Forums/Blitz3D Programming/Problem with Alpha

Gabriel(Posted 2003) [#1]
I have an object which has a bunch of polys which overlap. I won't go into the why's and wherefores, but suffice it to say, it's the only practical way to do it.

Now I want it to be black and not be affected by lights. No problem there. But if I make it transluscent and try to blending it with whatever's on the other side.. it doesn't work. You can see darker lines where the polys overlap. I've fooled around with alpha, entityfx, blending modes, etc, but I can't find a combination which will give me a flat colour with less than 1.0 alpha.

Am I missing something or is it just not possible?


poopla(Posted 2003) [#2]
Double post.


poopla(Posted 2003) [#3]
Loop through all the vertices and set their alpha, and set the mesh to use vertex color instead of blitz lighting. I don't really understand what your talking about, perhaps a better description would help?


Gabriel(Posted 2003) [#4]
I have tried setting the alpha with EntityAlpha() and with VertexColors(). It makes no difference.

I don't know how I can describe it better. I want the object to be uniform in colour, but with an alpha of 0.5 or whatever. But anywhere that polys overlap, it's darker.


jhocking(Posted 2003) [#5]
Every polygon will blend with what's below and if polygons are overlapping the overlaps will get darker. Assuming what you say is correct, that there is absolutely no way to do the models without overlapping polygons, there is no way to do this with alpha.

There are ways to achieve what you are trying to do however. A trick I've used (plus it is used extensively in most dynamic shadow systems, including sswift's) is a multiple render pass technique in which you render the object alone and use that rendering as a sprite. If you don't flip after the render of the object alone the player will never see that render. To get the object uniform in color you set it to fullbright, strip off the texture, and then use EntityColor. Meanwhile set the clearscreen color to white (assuming multiply blending) so that the background of the sprite becomes transparent when you apply blending to it.


Gabriel(Posted 2003) [#6]
Thanks Joe. That'll work just great. The extra renderpass won't be too costly, I don't think, and I can actually play with other effects such as blur doing it that way. Perfect.