Internal function to return a noise value for three dimensions
Source code in Projects/ShaderFlow/ShaderFlow/Modules/Noise.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77 | def at(self, x: float=0, y: float=0, z: float=0) -> float:
"""Internal function to return a noise value for three dimensions"""
noise = numpy.zeros(self.dimensions, dtype=numpy.float32)
for dimension in range(self.dimensions):
for octave in range(self.octaves):
# The "position velocity" due frequency of this octave
# · One octave up, double the frequency
# · Scale linearly with self.frequency
k = (2**octave) * self.frequency
# Amplitude of this octave so noise remains bounded
# · Double the octave, half the amplitude
amplitude = self.amplitude * (self.roughness)**octave
# Sum this octave's noise to the total
# Fixme: x=0, y=0, z=0 yields the same noise for all octaves
noise[dimension] += self.__simplex__[dimension].noise3(x*k, y*k, z*k) * amplitude
return noise
|