Dynamic Vertex Update #604
-
Hi Robert, in my actual project I want to use dynamic vertex update like in the example vsgdynamicvertex. The example is easy to understand and works on Mac and Windows. I have this problem now: the dynamic vertex update has no visual effect (Mac & Windows). What works correctly:
What can inhibit the update of the modified scene graph? A brute force method would be to remove the scene node and create a new one based on updated data, what is a safe way to do this? Best |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
There are 3 key parts to utilizing the built-in dynamic data update support:
For scene graphs that you create and then compile after then initial viewer.compile() you'll need to do the compile traversal and the update the RecordAndSumbitTasks. There is an vsg::updateViewer(..) and function that includes these updates to the TransferTask. If you are curious about how the updateViewer(..) handles the additions to the TransferTask it's implemented by the updateTasks(..) method. If you are using vsg::VertexDraw and this contains dynamic data and you are using the VulkanSceneGraph-1.0.0 release then you'll need to update to VSG master or the 1.0 branch as I've found and fixed a bug in vsg::CollectResourceRequirements visitor so it properly handles the VertexDraw classes data arrays. |
Beta Was this translation helpful? Give feedback.
-
Thanks, it works now. I missed to set data->properties.dataVariance! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I have a related problem. I have a VertexDraw, and I could update the array vertices, mark it dirty, and the recompile using the updateViewer as above. Indeed, I now do that all over my code when I need to change vertex values and this works as long as I mark it dynamic. But, one particular vsg::VertexDraw I have will contain a vertex array that might need to change size once in a while (e.g. more or fewer triangles). I know would have to update the VertexDraw "vertexCount" when I change this array vertex count, the other arrays are not really being set, or they only have one value (e.g. normals, color, etc). I have tried to do this by allocating a new array, and copying the new values in. I then try to do an assignment to the "arrays" of the vsg::VertexDraw with the new vertices like: vd->arrays[0] = vsg::BufferInfo::create(new_vertices); When I try to compile the VertexDraw now that it has new vertex array, I get a an error like this: Warning: Existing deviceBufferInfo, ref_ptrvsg::BufferInfo(vsg::BufferInfo 0000020CC4B294D8), deviceBufferInfo->range = 28074420, 30651948 NOT compatible I'm assuming this is because the VertexDraw had a different size before. How can I make Vulkan happy? |
Beta Was this translation helpful? Give feedback.
There are 3 key parts to utilizing the built-in dynamic data update support:
For scene graphs that you create and then compile after then initial viewer.compile() you'll need to do the compile …