Generating 3D noise quickly in python

浪子不回头ぞ 提交于 2020-01-01 03:09:13

问题


I need a method to generate 3D simplex noise in python rather quickly. What methods are there out there to solve this problem?


回答1:


$ pip install noise
  • http://pypi.python.org/pypi/noise/

This package is designed to give you simple to use, fast functions for generating Perlin noise in your Python programs. Perlin noise is famously called the "salt" of procedural generation, as it adds considerable flavor in its application. Noise is commonly used for imparting realism in textures, animation and other procedural content generation -- placement of hairs, heights of mountains, density of forests, waving of a flag, etc. etc.. ....

The noise library includes native-code implementations of Perlin "improved" noise and Perlin simplex noise.

Example code is included in the package, e.g. 2dtexture:




回答2:


use a mod function with a suitable period. there are quite a few pages around the www explaining mod functions.

just make sure it is also suitable for 3 dimensions, some mods that are suitable for 1 or 2 dimensions may not be suitable over 3.




回答3:


For more info.

http://snup.org/code-snippets/1153/python-n-dimensional-simplex-noise/

It has a simple code to generate simplex noise.



来源:https://stackoverflow.com/questions/4467638/generating-3d-noise-quickly-in-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!