Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render faster #3

Closed
wpalfi opened this issue Jan 18, 2022 · 3 comments
Closed

render faster #3

wpalfi opened this issue Jan 18, 2022 · 3 comments

Comments

@wpalfi
Copy link

wpalfi commented Jan 18, 2022

fyi you can speed up rendering by ~50%. Replace

# Sample incoming radiance
pixel_normals = dr.interpolate(n[None, ...], rast, f)[0]
# Sample envmap using the SH approximation
light = self.sh.eval(pixel_normals)

by

vert_light = self.sh.eval(n).contiguous()
light = dr.interpolate(vert_light[None, ...], rast, f)[0]
@bathal1
Copy link
Collaborator

bathal1 commented Feb 9, 2022

Nice, thanks! Do you have any insight as to why swapping those two lines speeds up computation so much?

@wpalfi
Copy link
Author

wpalfi commented Feb 9, 2022

Because the diffuse shading is view-independent and there are less vertices than pixels.

  • The argument shapes of dr.interpolate() are the same in both cases.
  • The argument size of self.sh.eval() is B*H*W*3 = 16*512**2*3 =~ 1e7 in the original code, but only V*3 =~ 1e5 in my version.

@bathal1
Copy link
Collaborator

bathal1 commented Jun 1, 2022

Thanks! This has been updated now.

@bathal1 bathal1 closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants