Jump to content

Volumesampleindex returning 0


outposttom

Recommended Posts

Hi,

I'm currently trying to implement a smoke volume that wraps around the X-axis. Essentially taking the values of the final voxels on the +X axis and applying them to -X. The VEX below should be doing what I want, but its returning zero every time. Am I missing something? I've tried deriving the voxel coordinate procedurally, as well as manually specifying a good known coordinate, and every time I get an empty result. Its driving me mad!

float scratchpad = chf('scratchpad');
int far_voxel = floor(ch('../smokeobject1/sizex') / ch('../smokeobject1/divsize'));
vector sample_pos = volumeindextopos(0, "density", set(far_voxel, @iy, @iz));
if(@ix == 0){
    //f@density = 1.0;
    //f@density = volumeindex(0, "density", set(far_voxel, i@iy, i@iz));
    //v@vel = volumeindex(0, "vel", set(far_voxel, i@iy, i@iz));
    f@density = volumesample(0, "density", sample_pos);
    v@vel = volumesamplev(0, "vel", sample_pos);
}

The commented out lines are different methods I've tried with no success. So far I've tried using volumeindex to read the voxel values directly, and volumesample using a position derived from volumeindextopos. No dice :(

Any ideas folks?

(the attached image shows the current behavior using the wrangle VEX above. What should be happening is the density and velocity values on +X boundary should be being copied into the -X boundary voxels)

 

wrapping_volume.PNG

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