I am implementing Shen and Chen paper on Lattice Boltzmann Multi phase method into houdini. I have a custom grid and array of densities and velocities i have already calculated in the grid.
I want to visualize this in houdini. If someone could guide me to code this density array into a voxel based system.
Currently to visualize I am randomly adding particles to each grid based on the density and just using particleFluidSurface to make it into a mesh.
I do not like the result as it just looks like noise to me.
I know my data is right but the random point spreading is not visualizing the density right.
So what I want to do is
1) transfer my custom voxel grid( c++ array) into HDK voxel grid
2) transfer my density and velocity calculations (c++ arrays) into that HDK voxel grid.
If anyone could help that would be great. I am attaching my hdk visualization code but I know its not the right way to do it.
void LBMFluid::Emit(UT_Vector3D pos, double density)
GA_Offset srcptoff = GA_INVALID_OFFSET;
GA_Offset vtxoff = my_gpp->giveBirth();
GA_Offset ptoff = gdp->vertexPoint(vtxoff);
void LBMFluid::visualize(int NX, int NY, int NZ, fpreal now, vector <double> rho)
int pSize = my_gpp->getNumParticles();
for(GA_Size i = 0; i < pSize ; i++)
GA_Offset ptoff = my_gpp->vertexPoint(i);
int life = myLife.get(ptoff,0);
int death = myLife.get(ptoff,1);
if (life >=death)
//adding new points
for (int k = 0 ; k < NZ-1 ; k++)
for(int j = 0; j < NY-1; j++)
for(int i = 0; i < NX-1; i++)
int N = i + NX*j + NY*NY*k;
int size = (int)(rho * MAXPART(now) + 0.5);//rounding num particles
// cout << “Densities” << endl;
// cout << "Grid: " << size << endl;
for ( int n = 0 ; n < size; n++)
double x = i + ((double)rand()/RAND_MAX);
double y = j + ((double)rand()/RAND_MAX);
double z = k + ((double)rand()/RAND_MAX);
UT_Vector3D pos = UT_Vector3D(x,y,z);