TextureFlag 2, alpha problems!
Blitz3D Forums/Blitz3D Programming/TextureFlag 2, alpha problems!
| ||
Hi! I'm having troubles with entities that use an alpha channel: I can see leaves of trees that suppose to be behind other trees, being rendered in FRONT. What is going wrong? :-( The crystal should be behind the tree, not in front. The trees on the right are transparant, when the sea is behind them. Thanks |
| ||
Try looking into entityorder I think it is.. to set when you want something drawn to screen. Hope this helps. |
| ||
No it hasn't to do anything with entityOrder....only the alpha textures give the problem, the mesh in its whole is drawn correctly as you can see on the screenshots. |
| ||
I'm new to b3d, but I've encountered this in other packages. It's the sorting. Your alpha maps are showing in front of everything else... Is there some control on the sorting? |
| ||
that's my question as well :) |
| ||
Sorry, there's a piece of code dealing with sorting in the code section.. perhaps that would help? |
| ||
Have you tried 'entityfx 34' (vertexalpha + vertex color) - not sure if that would work with 'entityalpha' but if you use vertexcolors I'm sure alpha always screwed up? I don't think entitorder will help as this apparently disables the z-buffer altogether for that entity. |
| ||
Alternatively you could use masking instead of alpha, it doesn't have the same problem. Another solution is to sort your polygons manually. MasterBeaker has made some great functions for this, which you can scoop out of the code archives. |
| ||
This might help : http://www.blitzbasic.com/codearcs/codearcs.php?code=850 Anyway, I have to say, thats a damn mighty fine lookin' project you goin' there, you make the graphics yerself? |
| ||
It seems Blitz does not z-order alpha textures, which is IMHO really, really bad. The code Genexi2 suggested seems to do the job, but unfortunately I haven't got any results yet (nothing happens :-) |
| ||
It seems Blitz does not z-order alpha textures, which is IMHO really, really bad. It's not really Blitz's fault, but rather HW and DX related "problem". Most 3D-engines (even games) have the same problem and because of the nature of alpha, there is no automatic way to z-order it. Only way to do this is to sort every polygon "manually" in every frame, and that is VERY cpu-time consuming. I doubt that DarkBasic for example is any better in this matter. |
| ||
Indeed.. For textures with an 8-bit alpha channel, any part of the poly with that texture might end up being partially transparent. Transpareny doesn't jive with the Z-buffer, so polygon ordering needs to be done. B3D will order these polys by their entitys' origins, so you can only get your Alpha leaves to be properly transparent if each of them is a separate entity with an origin near its middle. There is another option... Try using the "Masked" flag (4) instead of the "Alpha" flag (2). Masked is a binary alpha channel; Any part of the image that is true black won't be rendered, and anything else will be fully opaque. The texture will never need to have partial transparency, so while it may have some jaggies, it can use the Z-buffer just like a normal surface -- you con't have to do anything to get your polys in order. |
| ||
Here's an example of the Masked flag from something I'm working on.. Here's a tree that uses it seen from quite a long way away: And here's a close-up of a branch, where you can see the jaggies I was talking about: |
| ||
> where you can see the jaggies I was talking about: There any way around that by any chance? Just in other games I've played like FFXI, there are no jaggy outlines, but the pixels themselves just keep gettin smooth\rounder\blurrier up close, kinda like vector art in Flash. :-/ |
| ||
Anthony Flack had come up with a clever masking solution for "Cletus." I don't recall the post/URL but he might pipe up here, or just email him. |