mark
Hmmm… These seem to be one dimensional arrays, no?
Why not use the spline functions.
Yes; these are 1D static arrays, and yes, using the spline functions is a very good suggestion indeed. Thanks Mark!

Here is a quick modification of the generator (along with its output) for both Mark's and Edward's suggestions:
Edward:
generator [
members.rogers.com],
output [
members.rogers.com].
Mark:
generator [
members.rogers.com],
output [
members.rogers.com].
A few notes:1. I've no idea what the maximum number of arguments might be for VEX (or even if there is a cap at all), so I just took a guess at 100, which it seems to accept OK. If the limit is much higher (or doesn't exist), then the spline version wouldn't need to be split into blocks of 100 args each as it is now, making it run faster…. (Mark?)
2. This call is made once per sample, so it's pretty important that the solution be as fast as possible. I did a quick profile on both solutions and, not surprisingly, the spline version ran faster. What *did* surprise me was just how *much* faster it ran:
if-chain: 7.41 secs (355,081,424 instructions)
lspline(): 0.55 secs (15,189,372 instructions)
That's close to 14 times faster! (and about 23 times less instructions!!) :shock:
… guess the optimizer can't do much with the if() statements (even though they're all immediate returns of a static value), and probably ends up with all the overhead of a full branching. Also; the if-chain can't solve this in constant time (linear with a worst-case at index=N-1). Anyhoo… interesting results… and the spline() function seems to be the VEX-method-of-choice for all your static lookup needs

3. I'll likely start looking into the dipole diffuse (multiple scattering) section when I get a chance (this is fun but I still got a job to finish

). But in the meantime:
A) Has anyone had any ideas about how to construct a light->NDC matrix from within the light context? – or an alternative solution for the whole matrix thing?
B) Anybody think my interpretation of how the poisson dist. is meant to be applied (highest density at center of beam -> 0.5) is way off?
C) Anyone disagree with the modifications I made to the code in the slides (based on my comparisons to the Jensen paper) ?
D) Would anybody care to have a go at a version of this using rayhittest() instead of all those maps? (rayhittest() will likely play a big role in the dipole function)…. Jim?

TTYL,