About Store Forum Documentation Contact



Post Reply 
Blend Type Shading and Z depth/sort
Author Message
ronalmb Offline
Member

Post: #1
Blend Type Shading and Z depth/sort
Hello, I am experiencing a problem with some objects that i place that share the "Blend" Type and camera angle that I think is related to the Z-depth Z-sorting. I do not know how to fix it or if it is even something I can even fix - maybe its a feature (bug) of the Blend Type.

When viewed at a "level angle" the objects display in proper order/shading as shown in the first example below.

   

When i move the camera angle (or am below the object, looking "up"), no longer are the objects being drawn in proper order and instead the object furthest away seems to be given precedence. The other objects ARE still there - you may not be able to see it from the example below, but they can be made out faintly behind the larger piece. See the example below:

   

When I was using the Multiverse toolset (ugh), I recall an issue that was similar to this that I had and it was related to the Z-depth sorting. Is this a similar issue? Is there something that I can do, as a game artist, to correct it? I can't imagine that this is an issue that cannot be resolved.

Thank you for your time reading this and any help you can provide.

Michael

Edit: reduced size of images to not be so ridiculously huge
(This post was last modified: 01-22-2012 07:24 PM by ronalmb.)
01-22-2012 07:20 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Blend Type Shading and Z depth/sort
Hi,

blend objects are sorted by MeshPart's

If you compose the final effect from multiple objects/meshes/meshparts, then all meshparts will be sorted according to their distance from center position to camera forward plane

This can be solved in 2 ways:

1- non-code : use only one object with 1 mesh and 1 meshpart

2- code: use only one game object (can use multiple meshes meshparts) but:
don't do any draw calls in Game::Obj::drawPrepare-

extend this method, and just request blend rendering mode
drawPrepare()
{
return IndexToFlag(RM_BLEND); // will trigger blend mode call
}

now in blend mode call:
drawBlend()
{
draw all meshes/meshparts in constant order and immediate mode:
mesh.drawBlend(..);
}
01-24-2012 12:01 PM
Find all posts by this user Quote this message in a reply
Post Reply