Best way to mirror volume

   2132   2   1
User Avatar
Member
383 posts
Joined: June 2010
Offline
Whats the fastest way to mirror a volume ?
I really want to mirror the density field not just the transformation matrix.
ATM I am using a little python script, which is very slow ..

import numpy

node = hou.pwd()
geo = node.geometry()

# Add code to modify contents of geo.
# Use drop down menu to select examples.
volume = geo.prims()
np = numpy.array(volume.allVoxels()).reshape(volume.resolution(), order='F')
# Now we have our numpy 3d array… have fun!

np = np
# set the values of the volume back in Houdini
volume.setAllVoxels( np.flatten(order='F') )
www.woogieworks.at
User Avatar
Staff
6237 posts
Joined: July 2005
Offline
Volume Wrangle?

vector idx;
idx.x = @ix;
idx.y = @iy;
idx.z = @iz;
// Mirror
idx.z = @resz - 1 - @iz;
@density = volumeindex(0, 0, idx);
User Avatar
Member
383 posts
Joined: June 2010
Offline
Thanks a lot !
This is so much faster than my python code !!
I didnt realize that there is a volumeindex function.
www.woogieworks.at
  • Quick Links