Jump to content

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

Share this post

Link to post
Share on other sites

Try @P.x, @P.y and @P.z, The case is important.

Share this post

Link to post
Share on other sites
Posted (edited)

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");

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;

vector volorigin = prim(0,"origin",0);
int volres[] = primintrinsic(0,"activevoxeldimensions",0);

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


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 !





Screenshot 2021-05-16 at 20.55.30.png

Edited by alr77

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now