lmas / opensimplex

This repo has been migrated to https://code.larus.se/lmas/opensimplex
MIT License
241 stars 29 forks source link

Add support for the generation of seamlessly-looping animated textures and closed shapes #35

Closed Dennis-van-Gils closed 2 years ago

Dennis-van-Gils commented 2 years ago

Hi @lmas. I found your OpenSimplex Python library and am very pleased by it. Great work. I intend to use your library to drive a turbulence generator for a scientific water tunnel I am designing. The coherent nature of Simplex noise is ideal here. The noise pattern we need should loop seamlessly over time, hence my pull request to incorporate two functions called polar_loop_2D_stack() and double_polar_loop_1D_stack().

These functions can also be very useful to others for e.g. the generation of seamlessly-looping animated textures or closed shapes. Perhaps a friendlier name for the functions would be looping_animated_closed_shape() and looping_animated_texture()? Open for debate.

I'll just point you to \examples folder and the animated gif, 2D and animated gif, 1D to show you what the new functions do. Keeps this message still somewhat short. The inspiration is taken from https://www.youtube.com/watch?v=ZI1dmHv3MeM.

Both functions are fully optimized for numba and can show a progress bar during the noise generation which I find very helpful. I tested that the functions work both with numba and numba-progress in the environment, and without.

Dennis-van-Gils commented 2 years ago

I'll cancel my pull request for the moment. I am now working on the generation of seamlessly tileable 2D textures and this makes me reconsider the algorithm behind the polar_loop_2D_stack() and double_polar_loop_1D_stack() functions. I'll be back with a new pull request once I have convinced myself I am happy with the algorithm. Best, Dennis

lmas commented 2 years ago

Continued in #36