mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.12k stars 35.34k forks source link

SimplexNoise.prototype.noise4d #1993

Closed 525c1e21-bd67-4735-ac99-b4b0e5262290 closed 12 years ago

525c1e21-bd67-4735-ac99-b4b0e5262290 commented 12 years ago

@zz85 I noticed the 4D noise you've added to examples/js/SimplexNoise.js calls SimplexNoise.prototype.dot(3) as if it were SimplexNoise.prototype.dot(5)

https://github.com/mrdoob/three.js/commit/dd1f2149479fe69cb97fa14324cf0e7105d45060#L0R289 https://github.com/mrdoob/three.js/commit/dd1f2149479fe69cb97fa14324cf0e7105d45060#L0R295 https://github.com/mrdoob/three.js/commit/dd1f2149479fe69cb97fa14324cf0e7105d45060#L0R301 https://github.com/mrdoob/three.js/commit/dd1f2149479fe69cb97fa14324cf0e7105d45060#L0R306 https://github.com/mrdoob/three.js/commit/dd1f2149479fe69cb97fa14324cf0e7105d45060#L0R312

Either 4D noise is broken and needs a correct dot(5) function or the extra 2 arguments to dot(3) are unnecessary.

zz85 commented 12 years ago

@pyrotechnick good catch. how did you managed to detect this problem?

i realized that 3D noise is not using the correct dot operation either. the overloaded dot methods were missing from the java port. i'm surprise the noise still worked, although i always wondered if something was wrong somewhere.

anyways, could you check if the patched simplexNoise works for you?

https://gist.github.com/1214134#file_perlin_noise_simplex.js