Skip to content
Discussion options

You must be logged in to vote

Hi @tomas16

I'm starting to think this isn't what the loop is intended for. Should I basically have a python loop over my original numpy array?

Indeed, if I understood your problem correctly, you don't need a loop at all. One way to think about writing Mitsuba/Dr.Jit code, is that every variable and operation is vectorized. We are basically only doing operations on arrays.
The most efficient implementation of your setup would be something like this:

n_points = get_points # dr.shape(n_points) == [3, N] 
repeated_points = dr.repeat(n_points, R) # # dr.shape(repeated_points) == [3, N * R] 
rays = spawn_ray(repeated points) # dr.width(rays) == N*R
si = scene.ray_intersect(rays)

The idea her…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tomas16
Comment options

@njroussel
Comment options

Answer selected by tomas16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants