问题标签 [noise]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
5087 浏览

opengl - 柏林噪声的每顶点法线?

我在 Opengl 几何着色器中生成地形,并且在计算光照法线时遇到问题。我使用几何着色器中实现的 perlin 噪声函数在每一帧动态生成地形。因此,我需要一种有效的方法来计算每个顶点的法线基于噪声函数(没有纹理或任何东西)。我可以取 2 边的叉积来获得面法线,但它们是随几何图形动态生成的,因此我无法返回并平滑顶点法线的面法线。如何仅使用在 y 平面上生成地形高度的噪声函数(因此高度介于 1 和 -1 之间)来动态获取顶点法线。我相信我必须为每个顶点对噪声函数进行 4 次采样,但我尝试了以下类似的方法,但它没有用......

上面实际上生成了像柏林噪声一样移动的光照!那么关于如何正确获得每个顶点法线的任何建议?

0 投票
2 回答
1202 浏览

c# - 改进噪声的版本一直返回 0

我正在尝试在我的 XNA 游戏中实现改进的噪声,但我的改进噪声函数一直返回 0.0f。它与 Ken Perlin ( http://mrl.nyu.edu/~perlin/noise/ )的代码完全相同,只是移植到 C#。

我尝试过重写该类,甚至直接从站点复制和粘贴(当然,然后移植到 C#),但它除了 0 之外不会输出任何值。

这是我正在使用的代码:

为了测试它,我只是做了:

正如我上面所说,它总是输出 0。

0 投票
2 回答
2792 浏览

java - “动态”生成瓦片噪声图

我有兴趣为我正在开发的 2D 游戏生成 3D 高度图。我正在使用它来创建像 Minecraft 或 Dwarf Fortress 中的地块。

我之前创建了 2D 高度图,但我使用了一种非常基本的算法,该算法只是在完全随机噪声数组的点之间进行插值以创建固定大小的地图。但是,这不会平铺,因为如果我尝试在其旁边添加新地图,则它不会考虑现有地图的高度。

我已经阅读了有关 Perlin 和 Simplex 噪声的信息,但我现在对如何将 Perlin 或 Simplex 噪声应用于高度值的二维数组感到困惑。

对此的任何帮助将不胜感激。我不知道该怎么办了。乐谱上没有的“八度音阶”这个词让我害怕。

0 投票
4 回答
721 浏览

random - 在没有二元运算符的情况下制作噪声函数?

有没有任何可能的方法可以在没有任何二元运算符的情况下制作伪随机数?由于这是一张 3D 地图,我试图将其作为 X 和 Y 的函数,但希望在它们的某处包含一个随机种子,这样每次都不会相同。我知道您可以使用二元运算符制作这样的噪声函数:

但是因为我使用的是 lua 而不是 C++,所以我不能使用任何二元运算符。我尝试了许多不同的东西,但没有一个有效。帮助?

0 投票
1 回答
2064 浏览

matlab - How to add white noise process term for a couple of ODEs, assuming the Gaussian distribution?

This question has already confused me several days. While I referred to senior students, they also cannot give a reply.

We have ten ODEs, into which each a noise term should be added. The noise is defined as follows. since I always find that I cannot upload a picture, the formula below maybe not very clear. In order to understand, you can either read my explanation or go the this address: Plos one. You could find the description of the equations directly above the Support Information in this address

  1. The white noise term epislon_i(t) is assumed with Gaussian distribution. epislon_i(t) means that for equation i, and at t timepoint, the value of the noise.
  2. the auto-correlation of noise are given:

(EQ.1) eq1

where delta(t) is the Dirac delta function and the diffusion matrix D is defined by

(EQ.2) eq2

Our problem focuses on how to explain the Dirac delta function in the diffusion matrix. Since the property of Dirac delta function is delta(0) = Inf and delta(t) = 0 if t neq 0, we don't know how to calculate the epislonif we try to sqrt of 2D(x, t)delta(t-t'). So we simply assume that delta(0) = 1 and delta(t) = 0 if t neq 0; But we don't know whether or not this is right. Could you please tell me how to use Delta function of diffusion equation in MATLAB?

This question associates with the stochastic process in MATLAB. So we review different stochastic process to inspire our ideas. In MATLAB, the Wienner process is often defined as a = sqrt(dt) * rand(1, N). N is the number of steps, dt is the length of the steps. Correspondingly, the Brownian motion can be defined as: b = cumsum(a); All of these associate with stochastic process. However, they doesn't related to the white noise process which has a constraints on the matrix of auto-correlation, noted by D.

Then we consider that, we may simply use randn(1, 10) to generate a vector representing the noise. However, since the definition of the noise must satisfy the equation (2), this cannot enable noise term in different equation have the predefined partial correlation (D_ij). Then we try to use mvnrnd to generate a multiple variable normal distribution at each time step. Unfortunately, the function mvnrnd in MATLAB return a matrix. But we need to return a vector of length 10.

We are rather confused, so could you please give me just a light? Thanks so much!

0 投票
2 回答
2126 浏览

android - 在 Android 上的 Audiotrack 上播放 mp3 的嗡嗡声

我尝试在我的 SDCard 中为我的 Android 模拟器播放一个 mp3 文件,但出来的只是一些奇怪的嗡嗡声。我确定采样率为 44.1k hz 我不知道还有什么问题

0 投票
1 回答
404 浏览

noise - 使用蒙版生成地形噪声?

我有一张黑白的 2D 地图,白色部分应该在海平面以上,黑色部分应该在海平面以下。我不确定如何生成适合该蒙版的地形。岛屿的轮廓是否不正确并不重要,重要的是噪声应该大致符合所描述的岛屿的轮廓。

我看过 Perlin 噪音,但我不确定如何让它适应我的场景。

0 投票
2 回答
5891 浏览

matlab - 用 Matlab 估计图像中噪声的方差

在 Matlab 中,我将噪声添加到具有已知方差的图像中。我知道我可以通过以下方式做到这一点:

很明显,生成的图像有噪点。但是,如果我尝试通过计算高通滤波器的中值来估计噪声方差,我真的看不到任何相关性

我很欣赏估计方差是一个难题,但我只想得到一个相当接近的结果,例如 50% 的误差是可以容忍的。我在做什么不正确?

0 投票
2 回答
28318 浏览

3d - 最快的 Perlin-Like 3D 噪声算法?

自 Ken Perlin 首次发明噪音以来,已经有 20 多年了。有没有人设法制造出一种更快的 3D 噪声生成器,其特性接近 Perlin 的(程序化、自然的分组、减少的条带、规则的特征大小等)?

我正在尝试构建一个程序世界生成器,但目前 Perlin 并没有削减它。我承认我的实现不是现在最好的,但如果我要重写它,我想知道是否有更好的算法可用。

0 投票
1 回答
2061 浏览

android - Add noise effect to a drawing

I'm in the process of creating a custom view for my android application and would like to add a noise overlay over my drawings.

My drawings are pretty standard, arcs, bezier curves, etc.

What would be the way to go with creating a noise overlay over arbitrary shapes, drawn with canvas?