Curious differences in the Perlin noise implementation

31 views
Skip to first unread message

Wenzel

unread,
Apr 4, 2011, 5:11:48 PM4/4/11
to pbrt
Hi all,

while tracking down some differences between PBRT's Perlin noise
implementation and the reference implementation by Ken Perlin, I found
the following two lines in Grad() to be responsible:

float u = h<8 || h==12 || h==13 ? dx : dy;
float v = h<4 || h==12 || h==13 ? dy : dz;

whereas Ken Perlin's paper (http://mrl.nyu.edu/~perlin/noise/) uses

double u = h<8 ? x : y,
v = h<4 ? y : h==12 || h==14 ? x : z;

In PBRT's Grad() function the previous two lines would correspond to
computing:

float u = h<8 ? dx : dy;
float v = h<4 ? dy : h==12 || h==14 ? dx : dz;

I'm curious about the rationale -- is this an intentional change that
leads to better noise characteristics, or is it simply a typo?

Thanks!
Wenzel

Matt Pharr

unread,
Apr 4, 2011, 10:57:23 PM4/4/11
to pb...@googlegroups.com
I'm pretty sure there was a reason, but now I can't remember what it was. I dug around for e.g. errata from his 2002 paper (which is the sort of thing I would have guessed would be the explanation), but with no luck. There certainly wasn't a deep reason for that change, but I do think it was intentional. (Unless it matches the version from the siggraph 2002 proceedings, but the version online has a bug fixed.)

Sorry for not having a better answer.

Thanks,
-matt

> --
> You received this message because you are subscribed to the Google Groups "pbrt" group.
> To post to this group, send email to pb...@googlegroups.com.
> To unsubscribe from this group, send email to pbrt+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pbrt?hl=en.
>

Reply all
Reply to author
Forward
0 new messages