Volume voxel analysis. Wfc3d and 3d KD-tree-Algorithm

   1674   5   2
User Avatar
Member
255 posts
Joined: Sept. 2012
Offline
Hello All

I have trying to "modulize" a form, a volume, or should i say LEGOlize it
with some piece of different size and slope attribute.

So far my result are not always successfull and on terrain i have some area i fail to catch the right slope and direction.
I think im not using the right approach. Have you tried?
Kind of similar to 3d WFC where you have to look for each voxel in around no?

The idea of subdividing the 3d space for volume using a 3d KD Tree like algorithm is off course very attractive, as we all know how much volume and even spare vdb volume could be memory hungry.
So far im surprised to have seen much talk about . Im have read the official research paper, maybe it's what nano Vdb are in fact.

https://www.researchgate.net/figure/The-example-of-the-KD-tree-Algorithms-2D-3D_fig3_263937521 [www.researchgate.net]

Looking forward to talk with you about, cheers

Attachments:
image.png (177.1 KB)
Capturetemp.PNG (1.1 MB)

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
User Avatar
Member
116 posts
Joined: Aug. 2017
Offline
use prim-intrinsic -> bound and packing algorithm(with attribute mirror for archy stuff combining with QuadTree) and shift those boxes(corresponding by your choice) in RBD solver by index ...
int dotranslate = chi("dotranslate");
int dotrotate = chi("dotrotate");
int doscale = chi("doscale");
int uniformscale = chi("uniformscale");
vector min0,max0,min1,max1;
getbbox(0,min0,max0);
getbbox(1,min1,max1);
vector size0 = max0-min0;
vector center0 = (max0+min0)/2;
vector size1 = max1 -min1;
vector center1 = (max1+min1)/2;

matrix T = 1 ;
matrix R = 1 ;
matrix S = 1 ;

if ( dotranslate){
    vector t = center1 -center0;
    translate(T,t);
    }

if (dotrotate){
    float size0_array[]= set(size0);
    float size1_array[]= set(size1);
    
    int size0_argsort[]= argsort(size0_array);
    int size1_argsort[]= argsort(size1_array);
    vector newsize = size0;
    
    vector mr[];
    for(int i;i<3; i++){
        vector axis;
        axis[size1_argsort[i] ]=1;
        mr[size0_argsort[i] ]=axis;
        
        newsize[size0_argsort[i]]= size0[size0_argsort[i]];
        }

        
    size0 = newsize;
    //mr[2]= cross(mr[0],mr[1]);
    R = set(mr);

}
if(doscale){
    //@P = fit(@P,min0,max0,min1,max1);
    vector s = size1/size0;
    if (uniformscale){
        s = min(s);
        }
        scale(S,s);
}

vector p = center0;matrix X = 1;translate(X,p);

matrix xform = invert(X)*R*S*T*X;

string prim_type_name = primintrinsic(0,"typename",@primnum);
if(match('Packed*',prim_type_name)){
    matrix xform0 = getpackedtransform(0,@primnum);
    setpackedtransform(0,@primnum,xform0*xform);
    }else{
        @P *= xform;
    }
    

just some idea

Attachments:
wave44ffffrrr.gif (3.3 MB)

Conservation of Momentum
User Avatar
Member
255 posts
Joined: Sept. 2012
Offline
Do you mean something like this? Because maybe im missing something but I don't see how it will help much in this case.
For a given extract cell for the form to process, how to know the right corresponding piece?

Attachments:
temp.png (226.5 KB)
temp2.PNG (899.9 KB)

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
User Avatar
Member
255 posts
Joined: Sept. 2012
Offline
There are is the marching cube algorithm, do you know it?

https://en.wikipedia.org/wiki/Marching_cubes [en.wikipedia.org]
Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
User Avatar
Member
116 posts
Joined: Aug. 2017
Offline
On Indie Zone(Asia( channel on YouTube) for Houdini you can find some nice Functions vex and other Stuff..I found there some vex for point direction and copy stamp functions ..
Pdf that interesting and you referencing for some Examples. (JacksonStern_SyntheticDigitalEcologies.pdf)


//for orient att and finding same DIR and angles

int differ_angle = chi("differ_angle");

int q[] = {};
int angle[] = {};

int indegree[] = {};
int flag[] = {};
int cell[] = {};

for (int i = 0; i < npoints(0); i++){
    int _angle = point(0, "angleY", i);
    append(angle, _angle);
    int _indegree = point(0, "indegree", i);
    append(indegree, _indegree);
    append(flag, 0);
    
    append(cell, -1);
    if (_indegree == 0){
        append(q, i);
        flag[i] = 1;
        cell[i] = 0;
    }
}

while (len(q)){
    int next_pts[] = point(0, "next_pts", q[0]);
    foreach (int next_pt; next_pts){
        if (flag[next_pt])  continue;
        indegree[next_pt]--;
        if (indegree[next_pt] == 0){
            int pre_pts[] = point(0, "pre_pts", next_pt);
            
            int fault_angle[] = {};
            foreach (int pre_pt; pre_pts){
                int start_angle = angle[pre_pt] - differ_angle;
                int end_angle = angle[pre_pt] + differ_angle;
                for (int cur_angle = start_angle; cur_angle <= end_angle; cur_angle++)
                    append(fault_angle, cur_angle < 0 ? 360 + cur_angle : cur_angle > 360 ? cur_angle - 360 : cur_angle);
            }
            int perhaps_angle[] = {};
            for (int i = 0; i < 360; i++)
                if (find(fault_angle, i) < 0)
                    append(perhaps_angle, i);
            if (find(fault_angle, angle[next_pt]) >= 0)
                if (len(perhaps_angle) > 0){
                    int index = floor(fit01(rand(next_pt),0, len(perhaps_angle)));
                    angle[next_pt] = perhaps_angle[index];
                 }
            flag[next_pt] = 1;
            cell[next_pt] = cell[q[0]] + 1;
            append(q, next_pt);
        }
    
    }
    removeindex(q, 0);
}

for (int i = 0; i < npoints(0); i++){
    setpointattrib(0, "angleY", i, angle[i], "set");
    setpointattrib(0, "cell", i, cell[i], "set");
}


to orient
f@angleY += fit01(rand(@ptnum), 5, -5);
v@angle.y = f@angleY;
matrix3 m = maketransform(2, v@angle);
p@orient = quaternion(m);

You can Post some easy setup what you doing don't be Shy ...Share knowledge

Attachments:
0544477.jpg (635.8 KB)

Conservation of Momentum
User Avatar
Member
255 posts
Joined: Sept. 2012
Offline
I think it's safe to say my brain works differently than yours, less hard core Vex based in one cup
So far, it have 2 main issues, one is not taking care of the diagonals i believe but it's what i have now

Attachments:
Lego_Houdini_3DWaveFunction.gif (2.1 MB)

Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
  • Quick Links