ivr Posted July 9, 2019 Share Posted July 9, 2019 Hello, everyone! I'm writing my own Gas Field to Particle to project a velocity field to my particles. I have tried with both a Point and an Attribute Wrangle connected to my particles and the velocity field. First I'm getting the voxel index at the position of the particle: vector voxelindex = volumepostoindex(1, 'velN', @P); Each particle needs to consider information from surrounding voxels. So I'm taking the voxel index at the position of the particle and add to it voxel index shifts. I'm storing these shifts in a vector array. foreach(vector index; voxel_shifts_array) { current_voxel_index = voxelindex + index; current_voxel_pos = volumeindextopos(1, 'velField', current_voxel_index); vector vel = volumesamplev(1, 'velField', current_voxel_pos); //weight calculation based on distance between particle position and voxel position foreach(index1, i; abs(@P - current_voxel_pos)){ } vel_pic = vel_pic + @TimeInc * weight * set(getcomp(vel, 0), getcomp(vel, 1), getcomp(vel, 2)); } The foreach loop contains the weight calculation based on the distance between the particle and the current voxel. I believe there is something wrong with my volume sampling but I cannot pinpoint what. Quote Link to comment Share on other sites More sharing options...
anim Posted July 10, 2019 Share Posted July 10, 2019 why don't you just sample the vector field directly at the particle position? vector vel = volumesamplev(1, 'velField', @P); it will automatically interpolate the value from neighboring voxels, you don't have to do that part Quote Link to comment Share on other sites More sharing options...
ivr Posted July 12, 2019 Author Share Posted July 12, 2019 (edited) Thanks, Tomas! I was doing that because I didn't know how many voxels Houdini was considering when interpolating values inside Gas Particle to Field. So I was experimenting with writing my own. I thought the volume sample was only returning the value of that particular voxel. Also, I couldn't find much information about the interpolation function used inside the Gas microsolver interpolations, so I wanted to be able to control that aspect as well. Edited August 11, 2019 by ivr 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.