legomir Posted October 28, 2015 Share Posted October 28, 2015 (edited) Is possible to setting value of voxel in vex like this way: density[j][k] = some_value; or I will have to use python or HDK? Edited October 29, 2015 by legomir Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted October 28, 2015 Share Posted October 28, 2015 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. Quote Link to comment Share on other sites More sharing options...
legomir Posted October 29, 2015 Author Share Posted October 29, 2015 (edited) 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 Edited October 29, 2015 by legomir Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted October 29, 2015 Share Posted October 29, 2015 (edited) 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 October 29, 2015 by fântastîque Mântragorîè Quote Link to comment Share on other sites More sharing options...
f1480187 Posted October 29, 2015 Share Posted October 29, 2015 (edited) 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 October 29, 2015 by f1480187 Quote Link to comment Share on other sites More sharing options...
legomir Posted October 29, 2015 Author Share Posted October 29, 2015 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 Quote Link to comment Share on other sites More sharing options...
ranxerox Posted October 29, 2015 Share Posted October 29, 2015 what is it that you actually want to do ? If it's actually a question about performance you are going to be better off sticking with the volume VOP/wrangle paradigm as that is easily multithreaded. -G Quote Link to comment Share on other sites More sharing options...
legomir Posted October 29, 2015 Author Share Posted October 29, 2015 I try compute custom weighting function for every step on simulation for nearest voxel around point. Quote Link to comment Share on other sites More sharing options...
ranxerox Posted October 29, 2015 Share Posted October 29, 2015 could you do it in reverse ? Ie. for each voxel calculate your weight to the point in question ? It does seem odd that there isn't a vex function to set specific voxels. -G Quote Link to comment Share on other sites More sharing options...
legomir Posted October 29, 2015 Author Share Posted October 29, 2015 Is not possible to do this in this way(weighting by particle), but volume vop and point vop are building on cvex context so maybe is some way to do this? Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted October 29, 2015 Share Posted October 29, 2015 (edited) Check this file. Not too much optimized, but I hope that this is what you were looking for. for_legomir.hipnc Edited October 30, 2015 by fântastîque Mântragorîè 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.