jmhannu Posted February 13, 2018 Share Posted February 13, 2018 (edited) Hi all, I'm trying to write some vex in a volume wrangle but I'm really struggling atm, not sure if the problem is the syntax or my inexperience with voxels. I have a volume which I set up with random densities and then, in the next step, the density of a voxel should be affected by the surrounding voxels. I've done the first step but can't figure out how to access the "closest neighbour voxels". I guess they have some sort of index but can't figure out which voxel has which index or if I should access them by their position. Tried to use the function volumeindex() to find index and volumesample() to take a sample from a position but both only returns 0 so I'm obviously doing something wrong. I wrote it like this: vector pos = {2, 2, 2}; float temp = volumeindex(0, "@A", pos); printf("%f\n", temp); @A += temp; It doesn't seem to matter what position I use for the vector pos, the functions always return 0 either way. So if someone knows anything about this it would be great volumeRandom.hipnc Edited March 7, 2018 by jmhannu SOLVED Quote Link to comment Share on other sites More sharing options...
f1480187 Posted February 13, 2018 Share Posted February 13, 2018 Never used it, but it seems that volumeindex() function already returns actual value from ix, iy, iz: volumeindex Use "A" as volume name. To access different neighbours, increment voxel indices. Current voxel's indices stored in i@ix, i@iy, i@iz variables. Quote Link to comment Share on other sites More sharing options...
jmhannu Posted February 13, 2018 Author Share Posted February 13, 2018 Thanks! But when I use volumeindex() I only get 0.00000 in return so I guess it's something wrong with how I set the "voxel vector". This might be a very basic question but what is the voxel vector? I tried this: float temp = volumeindex(0, "@A", set(i@ix, i@iy, i@iz)); printf("%f\n", temp); @A += temp; Quote Link to comment Share on other sites More sharing options...
f1480187 Posted February 13, 2018 Share Posted February 13, 2018 That should work if you will use "A" as volume name (not "@A"). Quote Link to comment Share on other sites More sharing options...
jmhannu Posted February 13, 2018 Author Share Posted February 13, 2018 Aaaah you're right, thanks!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.