Jump to content

setting value per voxel in VEX from point level


legomir

Recommended Posts

Guest mantragora

Don't have time to look at this more, but in VolumeVOP look at

ix, iy, iz
indices, to get where you are, compare it and set density value if True etc.
Link to comment
Share on other sites

Maybe name of this topic is a little to generic so be precisely i want access to setting voxel value by it indexes. Is this possible in VEX in efficient and elegant way or rather i must be using HDK or Python for solve this problem 

post-11651-0-65743000-1446113355_thumb.j

Edited by legomir
Link to comment
Share on other sites

Guest mantragora

From help:

ix, iy, iz

Voxel indices. For Volumes these ranging from 0..resolution-1. For VDBs, they refer to the absolute location. Use volumepostoindex with the orig to get the lowest value of the ix,iy,iz for the current VDB.

so this:

vector res = volumeres(geoself(), 0);
if (@iy == (int(res.y / 2)) && @iz == res.z / 2)
    @density = 10;
else @density = 0;       
wil make stright density line.

Or do you rather want Voxel center?

vector pos = volumeindextopos(geoself(), 0, set(@ix, @iy, @iz));
addpoint(geoself(), pos);
Otherwise I'm not getting what you are asking about.

Image doesn't help. What you show there? Couple voxels from which you want the middle one? Center of a voxel?

PS. You can try do the same with HDK, but I don't think that C++ will be more elegant than VEX. It will require a lot more lines of code for sure.

Edited by fântastîque Mântragorîè
Link to comment
Share on other sites

The question is about setting voxel's density in o(1) time, without iteration. For example, if he already iterating while iterating.

setprimattrib(0, "attrib", @primnum, value);             // For primitives we use this.
setvoxeldensity(0, volumeprimnum, @ix, @iy, @iz, value); // For voxels we want that. There is no such function.
Edited by f1480187
Link to comment
Share on other sites

 

The question is about setting voxel's density in o(1) time, without iteration. For example, if he already iterating while iterating.

setprimattrib(0, "attrib", @primnum, value); // For primitives we use this.
setvoxeldensity(0, @ix, @iy, @iz, value);    // For voxels we want that. There is no such function.

Yep. This is exactly who i want to do :) Sorry for my unclear explanations

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...