Skip to content

Alpha blended mesh ordering issue #177

@MCArth

Description

@MCArth

Hi,

I've noticed some issues with alpha blended meshes, where the sorting order chosen by Babylon is wrong (and inconsistent as you move the camera)

It seems very likely its due to Babylon sorting meshes according to the center of the bounding sphere (at least from what I can tell):

Avoid having heavily-stretched alpha blended meshes (i.e. large planes); since the center of its bounding sphere is used for depth sorting, doing this may result in a mesh being sorted as far away from the camera but actually closer to many other meshes.

https://doc.babylonjs.com/divingDeeper/materials/advanced/transparent_rendering#rendering-order

It can be seen in test with the shadow:

image

(and when I zoom out)

image

I imagine this could be fixed by raycasting towards the mesh from the camera and manually setting alpha indexes dependent on if you hit a transparent voxel before reaching the mesh

I'm wondering if you've thought about this at all or have a simpler solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions