PixarAnimationStudios / OpenSubdiv

An Open-Source subdivision surface library.

Home Page:graphics.pixar.com/opensubdiv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updating existing smooth uvs as opposed to call InterpolateFaceVarying operating on whole mesh

perrauo-adsk opened this issue · comments

I am sorry for bringing up this old issue, I am not sure if this has been fixed.
As part of issue #74 now closed, user applezhao asked about the possibility of updating existing smooth UV buffers as opposed of computing uvs for the whole mesh?

i'm wondering how to update fvardatas~ i mean i use fvardata as (u,v,groupID)~ this may be frequently modified. everytime need i rebuild the hbrmesh? or there's something like GpuVertexBuffer.updateData()?

The lack of such feature makes it slow to obtain smooth mesh preview during any kind of interactive manipulation of a mesh. Are there any work arounds for such a situation? Are there any plans for this.

Thank you

Hi, there have been many changes to OpenSubdiv since that issue was closed.

Specifically, we recommend not using the Hbr interfaces for new or ongoing development.

The current interfaces in Far and Osd are consistent in their handling of different interpolation modes (i.e. vertex, varying, face-varying) and you can and should have to update only aspects of your mesh data that are actually changing during each edit or frame change in an interactive preview.

Can you tell us more about your use case and which aspects seem slow to update during your smooth mesh preview?

We are using ::Far::PrimvarRefinerReal::InterpolateFaceVarying to compute smoothed uvs from our mesh's entire uv buffer every frame during the manipulation of a uv in the uv editor. InterpolateFaceVarying seem to operate on the whole mesh am I wrong? Could I provide only the dirty range and obtain the same result?

After, looking more closely at what the user is referring to, I am indeed not using hbrmesh. Sorry for the confusion.

However the general idea remains, I am not sure if InterpolateFaceVarying is the right api to update only segments of the smooth uvs which have been dirtied by manipulation of the corresponding non-smooth uvs.

I see. Assuming your manipulation in the uv editor is changing only uv values (and not the uv topology) you might try using a face varying stencil table to apply updates to your uv buffer.

A stencil table is a sparse matrix representation of the interpolation that is performed by the primvar refinement methods like InterpolateFaceVarying. The Osd Evaluator APIs expose ways to apply stencil tables in using CPU or GPU kernels which might be much faster than using InterpolateFaceVarying directly for large mesh topologies, but there is additional up-front processing cost to create a stencil table.

That sounds great thanks. Are there any examples for this in the OpenSubdiv repo?

Here's one example in examples/glFVarViewer and there's another slightly different example in examples/glEvalLimit

Thank you

Marking this closed since we believe the question has been resolved.

We also want to encourage anyone following this to take a look at the opensubdiv/bfr API and tutorials/bfr which provide additional and often simpler ways of dealing with surface evaluation, though the approach discussed above may still be best for the use case presented.

Thanks!