Closed orchidshelley closed 1 year ago
The VSG records commands to the Vulkan CommandBuffer in order of traversal unless you use rendering bins that control the record/draw order. The VSG has the vsg::DepthSorted node that you can use to decorate subgraphs that you intend to be depth sorted, the VSG's compile traversal will configure the vsg::Bin these will drop into on each frame, these are placed into the associated vsg::View.
There isn't present an vsgExample that illustrates this but the vsgXchange::assimp implementation supports transparency using vsg::DepthSorted so can be looked as an example.
https://github.com/vsg-dev/vsgXchange/blob/master/src/assimp/assimp.cpp#L706
Describe the bug I have two nodes to add scenegraph, one is transparent , another is opaque . I hope the rendering is correct regardless of whether the transparent node is added first or later. I found if I add opaque first, then add transparent , the rendering is correct. But if I add transparent first , then add opaque, the rendering is incorrect.
The code looks like this: first create root sceneGraph:
then create transparent subscenegraph:
then create opacity subscenegraph
I add them to root scenegraph. If I add opacity first, then transparent, the result is correct, code is below:
But If I add transparent first, then opacity , the result is incorrect, code is below:
Expected behavior I don't think I need care about which one add first. Am I using it wrong?
Screenshots there are two planes, the position of opaque plane is below transparent plane. opaque add first ,the rendering is correct:
transparent add first, the rendering is incorrect: