z-order with intersecting meshes
BlitzMax Forums/MiniB3D Module/z-order with intersecting meshes
| ||
When I have two meshes at the same location, or in some way intersecting, the z-order seems to be confused. For example, if I create a spaceship by creating a spherical body, and then I have the sphere bisected by a double sided quad in order to be the "wing", I will be able to see the entire quad superimposed on the sphere. Is there any way to have meshes touching or intersecting each other without messing up the z-order (the z-order works perfect so long as the meshes are not touching). |
| ||
http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html |
| ||
Thanks for the info Beaker... However, I am nearly certain this is not the problem. I am using a modern DX10 era graphics card, and my camera range is set between 5 and 100 (which means that 16 bit should be more than enough, even if my card had a 16 bit z-buffer). |
| ||
It's the Near range that makes the difference, not really the Far. Having 5 is very good, that gives much more precision. Could you post a screenshot of the issue? |
| ||
I am on my phone now, but will post pictures later. Anyway, I discovered that this problem only occures for meshes that I have created from scratch. The functions like "createcube" work fine. Is there anything I could be doing wrong when I create the mesh that could cause z order problems? |
| ||
I have figured out the problem a little bit better. The object that is closest to the camera is always draw over the object farther away... Including when objects intersect. Thus if you had a very large box (let's say 10x10), located at 0,0,0... And you had a small box (let's say 1x1), inside the larger box... The small box would be drawn over the large box if it was closer to the camera. |
| ||
OK, I figured out the problem (which I am pretty sure is a minib3d bug), but not the solution. If I apply a brush to a mesh, and the brush has alpha blending on, it turns off z-ordering. With alpha blending off, it works fine. Since I need to use alpha on my textures, is there a work around? |
| ||
I'm not sure, but there is a default behaviour about z-ordering and alpha. If you draw an alpha object, objects that are behind it should still be drawn. Even if they are futher down the render queue. |
| ||
Is there at least a way to set the masked color on a brush? |