水波纹效果与颜色的差异

问题描述:

我正在用c#制作水波纹效果程序,现在我希望在波纹的运动中加入颜色扩散效果。我怎么能这样做?

I am making a water ripple effect program in c# and now i want to include a color difussion effect with the movement of the ripple. how can i do this?

假设你的意思是水滴涟漪,你可以在这里拿我的代码:

声学模拟的传输线矩阵 [ ^ ]

或更简单方法(在我的文章中引用):

http: //stuff.seans.com/2008/08/24/raindrop-animation-in-wpf/ [ ^ ]

基于这个原则:

http://freespace.virgin.net/hugo.elias/graphics/x_water.htm [ ^ ]
Assuming you mean water ripples by water drops you can just take my code here:
Transmission Line Matrix for Acoustic Simulations[^]
or the simpler approach (referenced in my article) here:
http://stuff.seans.com/2008/08/24/raindrop-animation-in-wpf/[^]
Based on this principle:
http://freespace.virgin.net/hugo.elias/graphics/x_water.htm[^]


谁告诉过你水波纹效应与颜色扩散有关?它不是。



即使你可以考虑扩散,与曲面的光反射/折射相比,它的作用微不足道的。第二个可见因素仅出现在浅水中:然后你必须显示从底部散射的光线,这将转化为地板上特有的阴影。人们有时只将它们称为阴影,但它们并非如此:它的表面具有复杂的光源,较暗的斑点和高光,回到观察者,在同一个弯曲的水源中反射/折射。至于深水,你也不需要考虑扩散太多,更重要的是,你必须考虑到大量水中吸收的光,这在深水中是相当可观的,甚至是干净的。只有当您还想要显示沾水的水时,以及当您观察到来自光源的直射光时,您可能需要考虑扩散。实际上,没有任何扩散的涟漪效应可能非常逼真。



我可以快速概述你需要先考虑的物理,如果你想诚实地模拟这样的效果。首先,你需要模拟水面的形状及其运动,这比电磁波要小得多。粗略地说,根据比例,水波可以是毛细管或引力,但在现实生活中有两者。请参阅:

http://en.wikipedia.org/wiki/Capillary_wave

http://en.wikipedia.org/wiki/Gravity_wave

http://en.wikipedia.org/wiki/Airy_wave_theory



为简单起见,上面考虑的波可以被认为是由一些弱的强迫和自我传播激发的,被认为是抽象形式,最初产生波浪的能量源。也许,您不想考虑更复杂的风浪 http:// en .wikipedia.org / wiki / Wind_wave



浅水波也很复杂:

http://en.wikipedia.org/wiki/Wave_shoaling

http://en.wikipedia.org/wiki/Shallow_water_equations



模型波浪可以更简单:-)。请查看 Boussinesq近似 http://en.wikipedia.org/wiki/Boussinesq_approximation_ %28water_waves%29



现在,我们来谈谈光学和光学。为了解决问题,我可以说,即使所有光学元件同时都是量子光学和波动光学,原则上你只能使用光学光束的经典光学元件。同时,很容易观察到反射/折射的偏振效应,主要是因为水在光学上是电介质(非金属)。



经典反射/折射现象由Maxwell公式描述: http://en.wikipedia.org/wiki/Maxwell%27s_equations 。 />


即使方程描述了波动光学,你也可以从光的波动性质中抽象出来,因为在人类感知的范围内,你可以将光视为光的组合。 平波的碎片穿过水面的每个碎片,在某个角度考虑局部平坦。方程式所需要的就是计算给定角度和极化时传递给反射波和折射波的能量。当找到它时,你可以忘记波并忽略波的相位(不是光不是相干)和光波在波纹表面上的衍射(波纹太大而不能产生相当大的波纹)衍射效应)。换句话说,您可以使用经典的折射和反射定律,并且可以从一些初步计算表,插值或一些简化的近似函数中获取取决于角度和极化的两种波中的光的功率。此外,您可以平均极化。请参阅:

http://en.wikipedia.org/wiki/Refractive_index

http://en.wikipedia.org/wiki/Reflection_%28physics%29

http://en.wikipedia.org/wiki/Refraction



这取决于你想要建模的东西。清澈湛蓝的光线具有清晰可见的偏振。在最简单的情况下,你可以模拟点非极化光源的光线,但效果看起来太苛刻了。



注意吸收光的分辨率不与折射波分开考虑。简单地说,它由折射率的虚部描述。请参阅:

http://en.wikipedia.org/wiki/Refractive_index#Complex_refractive_index

http://en.wikipedia.org/wiki/Absorption_%28electromagnetic_radiation %29



很简单,不是吗?对不起这个描述(双关语意外:-));这需要花费太多时间来详细概述。



-SA
Who told you that water ripple effect is related to color diffusion? It is not.

Even though you can take diffusion into account, its role in insignificant compared to light reflection/refraction from a curved surface. The second visible factor comes only in the shallow water: then you have to show the light diffused from the bottom, which will translate into characteristic "shadows" on the floor. People only call them "shadows" sometimes, but they are not: its rather lighting of the surface with a complicated light source, darker spots and highlight, coming back to the observer, with reflection/refraction in the same curved water source. As to the deep water, you also don't need to consider diffusion too much, more importantly, you have to take into account light absorbed in the mass of water, which is quote considerable in deep water, even clean. Only if you also want to show dusted water, and when you observe direct light from light source, you may need to take diffusion into account. Practically, ripple effect without any diffusion at all can be very realistic.

I can quickly overview physics you need to take into account first, if you want to "honestly" model such effects. First, you need to model the shape of the water surface and its motion, which is much less trivial than say, electromagnetic wave. Roughly speaking, depending on the scale, water wave can be capillary or gravitational, but in real life there are both. Please see:
http://en.wikipedia.org/wiki/Capillary_wave,
http://en.wikipedia.org/wiki/Gravity_wave,
http://en.wikipedia.org/wiki/Airy_wave_theory.

For simplicity, the waves considered above could be considered as excited by some weak forced and self-propagated, considered abstracted form the source of energy creating waves originally. Probably, you don't want to consider wind waves, which are even more complex: http://en.wikipedia.org/wiki/Wind_wave.

Wave on shallow water are also way to complicated:
http://en.wikipedia.org/wiki/Wave_shoaling,
http://en.wikipedia.org/wiki/Shallow_water_equations.

The model of waves can be even simpler :-). Please look at Boussinesq approximation: http://en.wikipedia.org/wiki/Boussinesq_approximation_%28water_waves%29.

Now, let's go to light and optics. For your relief, I can state that, even though all optics is quantum optics and wave optics at the same time, you can use, in principle, just the classical optics of optics beams. At the same time, polarization effects of reflection/refraction are easily to observe, mostly because water is optically a dielectric (non-metal).

Classical reflection/refraction phenomena is described by Maxwell's equations: http://en.wikipedia.org/wiki/Maxwell%27s_equations.

Even though the equations describe wave optics, you can later abstract from the wave nature of light, because, in the scale of human perception, you can consider light as combination of the fragments of flat waves moving through each fragment of water surface, consider as locally flat, at certain angle. All you need from equation is to calculate the amount of energy passed to the reflected and refracted waves, for a given angle and polarization. When this is found, you can forget the wave and ignore phase of the wave (not that the light is not coherent) and diffraction of the light wave on the rippled surface (ripples are too big to create considerable diffraction effect). In other words, you can use the classical refraction and reflection law, and power of the light in both waves depending on angle and polarization can be taken from some preliminary calculated tables, interpolated, or from some simplified approximation function. Also, you can average out polarization. Please see:
http://en.wikipedia.org/wiki/Refractive_index,
http://en.wikipedia.org/wiki/Reflection_%28physics%29,
http://en.wikipedia.org/wiki/Refraction.

It depend on what you want to model. The light from clear blue sly has clearly observable polarization. In simplest case, you can model the light of point non-polarized source, but the effect would look too harsh.

Note that the absorbtion of light is not considered separately from refracted wave. Simply speaking, it is described by the imaginary part of refractive index. Please see:
http://en.wikipedia.org/wiki/Refractive_index#Complex_refractive_index,
http://en.wikipedia.org/wiki/Absorption_%28electromagnetic_radiation%29.

Simple enough, isn't it? Sorry for this very shallow description (pun unintended :-)); it would take too much time to overview it all in detail.

—SA