Building Primitives in World Space

If I wanted to build a primitive object such as a cube, in world space; based on my understanding of the programming guide the recommended workflow would look something like:

  1. Initialize an instance of gvdb
  2. define a Vector3DF list of the desired voxel locations in world space (we’ll call it “CubeList”)
  3. call gvdb.ActivateSPace on each point in “CubeList”
  4. define a compute kernel which uses surf3Dwrite to update channel 0 from a low value to a high value if the voxel’s world position matches a point in “CubeList”
  5. after the compute kernel call gvdb.UpdateAtlas() to update the apron

Does this seem like a good workflow, or is there a more efficient method that would be recommended? Also, after the compute kernel would I need to call: gvdb.RebuidTopology and gvdb.FinishTopology?

Thank you in advance for the insight!

Yes, that is a good workflow.

I’m not sure overall goal, but if you want faster topology update you can use the new dynamic topology. It is up to 100x faster than the ActivateSpace function. But you have to give it a list of all the locations in space for bricks you want to activate.

A good approach would be to write your cube sampling function on both CPU and GPU kernels, then you can use it either to activate space or to set individual voxels.

This worked well, thank you for the feedback. It seems that voxels can only have a positive value for location in world space, is this correct?

I have the same problem with negative world space, see my thread

Thanks for the link, it’s comforting to know others have similar problems as me. I’ve been trying to peruse the programming guide (V1.1) and on line 6 of page 65 it says:

“Translate: A world translation factor applied to all points. This is useful, when needed to ensre that the points all reside in the positive domain.”

This excerpt is explaining an input argument for the InsertPoints function, and it implies that we do have to have all of the points located in positive world space, though it doesn’t directly state it.