From 2910427277f5fc0c201d19d72cd8347e89164e45 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sat, 12 Nov 2011 09:02:24 +0000 Subject: [PATCH] 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! --- release/scripts/freestyle/style_modules/parameter_editor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py index 5531082e68b..6da3e509e86 100644 --- a/release/scripts/freestyle/style_modules/parameter_editor.py +++ b/release/scripts/freestyle/style_modules/parameter_editor.py @@ -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()