Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Cubiquity / OpenGL creating/loading VDB
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=23&t=708
Page 1 of 1

Author:  xtitus [ Thu Apr 12, 2018 4:51 pm ]
Post subject:  Cubiquity / OpenGL creating/loading VDB

First off, I've played some with PolyVox first but moved on to Cubiquity as it seems to have what i'm looking for in it and I think I can expand the needed editing functionality myself.

I took the OpenGL example and have integrated it with my simple OpenGL engine.

Below is a just a test rendering.

Image

So, this is made by doing:

Code:
uint32_t Application::createTest()
{
    uint32_t handle;

    cuNewEmptyColoredCubesVolume(0, 0, 0, 64, 64, 64, "blah.vdb", 64, &handle);

    for(int x=0; x<64; x++)
    {
        for(int y=0; y<64; y++)
        {
            for(int z=0; z<64; z++)
            {
                float n = glm::simplex(glm::vec3(x,y,z));

                if (n > 0.7)
                {
                    Cubiquity::Color c;
                    c.setBlue(255);
                    c.setAlpha(255);

                    cuSetVoxel(handle, x, y, z, &c);
                }
            }
        }
    }

    return handle;
}


Works fine (as you see above). So, when I run it again it errors as "blah.vdb" is already there.

So, I run this instead:

Code:
validate(cuNewColoredCubesVolumeFromVDB("blah.vdb", CU_READONLY, 32, &volumeHandle));


I do see the messages print out for resyncing mesh and it does seem to adjust as I move the camera around, but nothing renders...

I noticed in the render routine that an if check fails that there isn't any indices

Code:
if (openGLOctreeNode->noOfIndices > 0 && openGLOctreeNode->renderThisNode)


Does cubiquity automatically sync out to the file? Do I need to "add" something? I can use the example VDB that came with the OpenGL example and it loads ok. The problem seems to be with loading one that I created in the last run. Any thoughts? Thanks!

Author:  David Williams [ Fri Apr 13, 2018 10:32 pm ]
Post subject:  Re: Cubiquity / OpenGL creating/loading VDB

Hi, welcome to the forums!
xtitus wrote:
Does cubiquity automatically sync out to the file? Do I need to "add" something?

Yes, I believe you need to call 'cuAcceptOverrideChunks(...)' after you have finished modifying the data.

When you modify the volume data it actually writes to a separate 'override' table in the database. The idea would usually be that someone playing your game loads the level, proceeds to destroy/change parts of it, but that if they restart then it should be returned to its initial state. This is also used in Unity when returning to 'edit' mode from 'play' mode. So you call the function above if you actually want to commit the changes to the database.

Anyway, let me know if that works. I do feel obliged to tell you that Cubiquity is no longer under active development (though a successor is very slowly moving forward) and the OpenGL example is really not that well tested. I wouldn't use it for anything too critical as I won't be fixing any bugs at this point. But the core library does basically work, and formed the basis of the Unity/Unreal plugins.

Author:  xtitus [ Mon Apr 16, 2018 4:18 pm ]
Post subject:  Re: Cubiquity / OpenGL creating/loading VDB

Yes, worked perfectly! I knew I was missing something. ;)

And yes, I have been reading your postings on discontinuing development of both polyvox and cubiquity. Both libraries do lack a level of documentation to understand best practices / under the hood, but I think cubiquity is even more lacking. Totally understand though as you just made it available after discontinuing it's development. Which I appreciate you opening up the library! I've wrestled whether I should just use polyvox or continue working with cubiquity... I think I'll try a little more with cubiquity as it has the main stuff I need and didn't really want to re-invent the wheel on saving/loading, converting models and such. We'll see how it goes. Main issue can be I don't always have the "context" to why certain things function a certain way. But, happy to put some time in figuring it out as it's nice lib.

Author:  David Williams [ Wed Apr 18, 2018 7:06 pm ]
Post subject:  Re: Cubiquity / OpenGL creating/loading VDB

xtitus wrote:
Yes, worked perfectly! I knew I was missing something. ;)

Great!
xtitus wrote:
I think I'll try a little more with cubiquity as it has the main stuff I need and didn't really want to re-invent the wheel on saving/loading, converting models and such..

For what it's worth, Cubiquity 2 will (unsurprisingly) be more like Cubiquity than PolyVox. Actually the C API to Cubiquity is reasonably nice (except for the duplication between volume types perhaps) as this is what was exposed to Unity/Unreal, but it's the internals that I'm not so happy with. Also I think synchronising the octree is fairly fiddly, and I have ideas to improve that but I don't know if they will work.
xtitus wrote:
Main issue can be I don't always have the "context" to why certain things function a certain way.

Just ask if you get stuck on something :-)

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/