Skip to content

Commit

Permalink
Proposed fix in prt_util shunsukesaito#69
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyu committed Sep 5, 2020
1 parent 7303437 commit 0aff0b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/prt_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def getSHCoeffs(order, phi, theta):

def computePRT(mesh_path, n, order):
mesh = trimesh.load(mesh_path, process=False)
vectors, phi, theta = sampleSphericalDirections(n)
SH = getSHCoeffs(order, phi, theta)
vectors_orig, phi, theta = sampleSphericalDirections(n)
SH_orig = getSHCoeffs(order, phi, theta)

w = 4.0 * math.pi / (n*n)

Expand All @@ -99,8 +99,8 @@ def computePRT(mesh_path, n, order):
normals = np.repeat(normals[:,None], n, axis=1).reshape(-1,3)
PRT_all = None
for i in tqdm(range(n)):
SH = np.repeat(SH[None,(i*n):((i+1)*n)], n_v, axis=0).reshape(-1,SH.shape[1])
vectors = np.repeat(vectors[None,(i*n):((i+1)*n)], n_v, axis=0).reshape(-1,3)
SH = np.repeat(SH_orig[None,(i*n):((i+1)*n)], n_v, axis=0).reshape(-1,SH_orig.shape[1])
vectors = np.repeat(vectors_orig[None,(i*n):((i+1)*n)], n_v, axis=0).reshape(-1,3)

dots = (vectors * normals).sum(1)
front = (dots > 0.0)
Expand Down Expand Up @@ -139,4 +139,4 @@ def testPRT(dir_path, n=40):
parser.add_argument('-n', '--n_sample', type=int, default=40, help='squared root of number of sampling. the higher, the more accurate, but slower')
args = parser.parse_args()

testPRT(args.input)
testPRT(args.input)

0 comments on commit 0aff0b5

Please sign in to comment.