Jump to content

VEX volume wrangle


alr77

Recommended Posts

Dear all,

Am actually encountering a problem. probably stupid for you as experienced users but like a "Huuuhh ?" for me.

So the goal is to "printf" the i@ix, i@iy, i@iz of any voxel in a volume. a vdb here.

 

So i type in a wrangle node : the source is a VDB from polygon in "surface" SDF mode

printf("vox id vector : %g\n",set(i@ix,i@iy,i@iz));

 

I swear nothing comes out from that line. And i just cannot understad why as normally the volume wrangle "might" browse each voxel one by one.

may be it is not the case ?

Is anybody had this problem before ? Is it a bug on my side ?

 

As well any advices are welcome, thank you already ! (i've probably made an error, probably basic but i cannot figure out what ^^)

all the bests, :)

 

 

 

 

 

 

Screenshot 2021-05-15 at 23.37.02.png

Link to comment
Share on other sites

Dear Atom,

First a big thank you to have answered to mys questionnings.

Saddly, it didn't worked (on my side).

BUT i've found a way to go over.

1.Step one was to record : volume origin and volume res (all in a classical detail wrangle)

vector volRes = volumeres(0,"surface");
vector volrOrigin = volumeindexorigin(0,"surface");
setprimattrib(0,"origin",0,volrOrigin,"set");

2.Step two was to "hard write" voxels ids in a vector array. This at the volume prim level :

function vector[] vxids(vector volorigin; int volres[])
{
    vector vxid[];   
    for(int vorx = volorigin.x; vorx < (volorigin.x + volres[0]); vorx++)
        for(int vory = volorigin.y; vory < (volorigin.y + volres[1]); vory++)
            for(int vorz = volorigin.z; vorz < (volorigin.z + volres[2]); vorz++)
                vxid[len(vxid)] = set(vorx,vory,vorz);        
    return vxid;
}

//WRITE VOXELS IDS :
vector volorigin = prim(0,"origin",0);
int volres[] = primintrinsic(0,"activevoxeldimensions",0);

vector voxels_ids[] = vxids(volorigin,volres);

setprimattrib(0,"voxels_ids",0,voxels_ids,"set");

3.Step 3, i just had to read the volume primitive attribute "v[]@voxels_ids".

My test example was to drop points at each active voxel centers (source shape is animated with a mountain node).

 

Conclusion : contrary to the volume vop, the volume wrangle doesn't read "easily" the i@ix, i@iy, i@iz.

It does BUT it is not obvius for me. (sorry for that).

to read them easily, it is better to hard-write them into a vector array attribute at the volume primitive level.

the funny thing (for me) is that now we could assign values into a volume from the created points. (humbly which looks easier for me as a beginner).

 

So thank you Atom ! :)

cheers, and all the bests.

I've joined a quick screenshot of the houdini scene.

if you want to have the .hipnc to add some corrections or even have a review on it, no problem, let me know !

 

alr77

 

 

Screenshot 2021-05-16 at 20.55.30.png

Edited by alr77
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...