Skip to content

Commit 1885318

Browse files
authored
Update PerlinSDF to yield noise on [0,1] (#63)
1 parent 8778ff1 commit 1885318

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/EBGeometry_AnalyticDistanceFunctions.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ class PerlinSDF : public SignedDistanceFunction<T>
927927
{}
928928

929929
/*!
930-
@brief Signed distance function.
930+
@brief Signed distance function. Generates a distance on [0,curAmplitude]
931931
@param[in] a_point Input point
932932
*/
933933
virtual T
@@ -939,7 +939,7 @@ class PerlinSDF : public SignedDistanceFunction<T>
939939
T curAmp = 1.0;
940940

941941
for (unsigned int curOctave = 0; curOctave < m_noiseOctaves; curOctave++) {
942-
ret += this->noise(a_point * curFreq) * curAmp;
942+
ret += 0.5 * curAmp * (1 + this->noise(a_point * curFreq));
943943

944944
curFreq = curFreq / m_noisePersistence;
945945
curAmp = curAmp * m_noisePersistence;

0 commit comments

Comments
 (0)