Replies: 1 comment
-
You appear to be mixing vsg::ShaderSet/GraphicsPipelneConfigurator usage with rolling your own state and scene graph elements. Normally one uses one or the other. ShaderSet/GraphicsPipelineConfigurator provides an extensible way of setting up how shader combinations map the state and mesh setup, which is why you'll see it's usage in vsg::Builder and vsgXchange::assimp, you may find it useful to look at how they manage things as they do include sharing state where possible. The use of ShaderSet in these contexts somewhat decouples the shaders you want to use from the scene graph creation so you can inject your own shaders/layouts into scene graph creation code that knows nothing about your shaders. It's also perfectly fine to just roll your own scene graph elements - I think it's helpful to know how to roll your own even if you eventually choose to use ShaderSet/GraphicsPipelinConfigurator as it provides users with an understanding of the scene graph and how different elements related to each other. As for using different uniforms and mesh in different combinations, there are many ways to combine things, the best way will depend exactly upon your needs. Your topic starts with a general question then dives off in specific elements of possible implementations, but diving into specific implementations might be premature. It's hard for me to know exactly what you already understand and can do, so pitching an answer at the right level is hard. In general one puts unfiroms in DescriptorBuffer that are assigned DescriptorSet that are bound to the graphics pipeline via BindDescriporSet(s), which can be placed directly into the scene graph as a child, but often the more flexible way to do so is to assign them to a StateGroup that decorates your mesh subgraphs. For meshes I would recommend use VertexIndexDraw/VertexDraw as it has lower CPU overhead and more self contained than adding BindVertexBuffers/BindIndexBuffer/DrawIndex commands to a group. There are times when keeping things fine grained make sense but mostly using VertexIndexDraw/VertexDraw will be most convenient and efficient. You can put multiple mesh subgraphs below a single StateGroup, or have multiple StateGroup that all share the same mesh subgraphs, or any combination. Again I have to stress how helpful is is to state the task you are trying to achieve to give us context, the scene graph is very flexible and there are many different ways to achieve similar results, not knowing what the end goal is makes it hard from all the different combinations of usage is the one that will best suit your task. Jumping directly into here's the solution I've chosen and need help with is a hindrance to actually help you. It's far better to start with a short succinct post that gives us context to what you want to achieve, then follow up with specifics about what you've done. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Let's say i have a pipeline like this:
And i have a Group of meshes, created like this:
This Group have no predefined size and changes very often (adding and deleting meshes). For every mesh a want to have different uniforms (textures for example).
In example project "vsgtexturearray" i saw it's possible to create multiple descriptor bindings:
but it's not what i want with changing mesh count.
And i found this peace of code in that example:
It looks like it doing work a want to achive - bind different uniforms for different meshes. Is code above a correct way of handling situation like this? Or maybee there is another way?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions