Fix for the Perlin Noise 1D geometry modifier having a noise frequency

relative to the stroke length (i.e., the number of noise displacement
values was the same for strokes of different lengths).  This resulted
in very noisy short strokes and much less noisy long strokes.  Now the
noise frequency is relative to the distance from the starting point of
a stroke.  That is, two strokes of the same length will be distorted
by the same number of noise displacement values, whereas longer strokes
will have more noise displacement values along stroke.

Problem report by JO5EF through the BA Freestyle thread, thank you!
This commit is contained in:
Tamito Kajiyama 2011-11-12 09:02:24 +00:00
parent e7a4d45435
commit 2910427277

@ -463,10 +463,11 @@ class PerlinNoise1DShader(StrokeShader):
def getName(self):
return "PerlinNoise1DShader"
def shade(self, stroke):
length = stroke.getLength2D()
it = stroke.strokeVerticesBegin()
while not it.isEnd():
v = it.getObject()
nres = self.__noise.turbulence1(v.u(), self.__freq, self.__amp, self.__oct)
nres = self.__noise.turbulence1(length * v.u(), self.__freq, self.__amp, self.__oct)
v.setPoint(v.getPoint() + nres * self.__dir)
it.increment()
stroke.UpdateLength()