-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting of blended object is incorrect in the latest dev branch #605
Comments
It's simple to produce this bug: var cube:Mesh = new Mesh(new CubeGeometry(), new ColorMaterial(0xFF0000, 0.7)); var sphere:Mesh = new Mesh(new SphereGeometry(), new ColorMaterial(0x00FF00, 0.7)); If you move and rotate the camera, you can easily discover the sorting order is not always correct. |
your example does not use blending - can you post an exact test class exhibiting the problem that we can review? |
daiwei1999 talk about transparent meshes and its sorting. |
Hey, if this issue is correct, that will be nice. @rob-bateman |
@daiwei1999 |
I fix the issue by only add two lines to the beginning of EntityCollector.clear method: |
@daiwei1999 But I tested with more many meshes, and I found a little artifact of z-sorting.
If faces of a mesh are intersected with other mesh's faces, Anyway, your code improves Away3D's z-sorting problem comparatively. Cheers. |
looks like the suggested fix works great! thanks guys @GoroMatsumoto the artifacts you describe are a limitation of the blending system. when rendering objects this way, individual materials are rendered in a fixed order depending on their blend mode and object depth. as a result, intersecting objects are to be avoided if possible |
I've downloaded last dev, and issue still persist for me. Meshes are included in ObjectContainer3D and then added to scene in order to group them, if it helps. Maybe "entity.x y z" are not in global coordinates? Any idea how to solve it? |
Yes... the relative coordinates of entities are not valid for z-ordering. var dx:Number = _entryPoint.x - entity.x;
var dy:Number = _entryPoint.y - entity.y;
var dz:Number = _entryPoint.z - entity.z; var dx:Number = _entryPoint.x - entity.scenePosition.x;
var dy:Number = _entryPoint.y - entity.scenePosition.y;
var dz:Number = _entryPoint.z - entity.scenePosition.z; Do you know if using scenePosition affects performance? |
Oh man - thank you Mario 👍 the entity.scenePosition check is still not in the dev branch of aw3d but finding your post got me a solution i was trying to figure out all day yesterday - i have a complex sphere-like object constructed out of hexagonal "tiles" that are using transparent png textures and the wrong sorting order totally messed it up - i was about to call the designer to request an interface revamp to accommodate non-transparent tiles |
I found EntityCollector._entryPoint and _cameraForward attribute is not updated every frame, this will cause the calculation of zIndex of RenderableListItem incorrectly which used to sort blended object.
The text was updated successfully, but these errors were encountered: