Viewport 2.0 draw multiple kLineStrip & update problems.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys,
I'm recently trying to port a node I wrote a while ago to VP2.0, that renders curves (hairs/grass). It is not very different from an instancer, where I draw always the same geo multiple times in the same node.
I'm trying to wrap my head around this API, using as an example the foorNodeGeometryOverride and reading the documentation, but I encountered some problems (please note that, while I feel comfortable writing nodes and commands, I'm a rookie when it comes to draw stuff in viewport).
First of all, I am trying to understand the concept behind the renderItems: initially I thought I should have created a renderItem for every curve, and tag that very curve as "kLineStrip", but from what I see I should give a different name to every curve... is that correct? Considering that I want to draw ten of thousands curves, I wonder if that is an efficent way to do it.
In the meanwhile, I tried to use only one render item to draw all my curves, but I don't know how to specify multiple kLineStrip(s) in the same render item (or if that is even possible). Currently I'm using kLine, basically doubling the number of indices to correctly draw my curves, but it sounds like a big waste of resources to me.
Finally, I have a problem understanding how to update the index buffer: I don't have any problems updating the vertexBuffer (maybe because is not dependant from the render items?), but the indices array seems to be unable to update its size: it always retains its original length.
In my case, the index array should be able to dinamically change its size, when the "numberOfHairs" attribute changes.
I've read that one way to notify the renderer of "topology changes" is to call MHWRender::MRenderer::setGeometryDrawDirty(), but this didn't work for me.
Thank you!