Exemplo n.º 1
0
    def compute_sh_coeffs(self):
        print "Computing SH coefficients"

        for s_i, s in enumerate(self.mesh_samples):
            for l in range(self.n_frequencies):
                for m in range(-l, l + 1):
                    idx = l * (l + 1) + m
                    r = np.sqrt(np.sum(np.power(s, 2)))
                    self.sh_coeffs[idx] += sph_harm(
                        m, l, np.arctan2(s[2], s[0]),
                        np.arcsin(s[1] / r) +
                        np.pi / 2.).real * self.dist_to_origin(s)
            renderutils.progress(s_i, len(self.mesh_samples))
        norm_factor = 4 * np.pi / len(self.mesh_samples)
        self.sh_coeffs *= norm_factor

        print "Done."
Exemplo n.º 2
0
from renderutils import progress

import voxelizer as vox
import numpy as np
import sys
import glob

if __name__ == '__main__':
    voxels_path = glob.glob(sys.argv[1])

    print "Creating point cloud from ", sys.argv[1]

    count = 0
    total = len(voxels_path)
    for p in voxels_path:
        vs = np.load(p)
        pts = vox.volume_to_points(vs, threshold=0.1)
        path = p.split('.')[0]
        vox.write_points_obj(path + '.obj', pts)
        progress(count, total)
        count += 1
    print "Done."