where both coefficients are the same in between axises (weird but working I was expecting I would need to have different coefficients between axises). After this is just a matter of finding the correct phase for each axis so I add phase shift controlled by mouse position (tx,ty) <0.0,1.0> so I got the final:float x = sin( 25.0*p.y + 30.0*p.x + 6.28*tx) * 0.05;float y = sin( 25.0*p.y + 30.0*p.x + 6.28*ty) * 0.05;然后我玩鼠标(打印它的位置),直到我足够接近以匹配您想要的输出时 tx=0.3477,ty=0.7812 这样您就可以硬编码Then I play with mouse (printing its position) until I got close enough to match your desired output which was when tx=0.3477,ty=0.7812 so you can hard-codefloat x = sin( 25.0*p.y + 30.0*p.x + 6.28*0.3477) * 0.05;float y = sin( 25.0*p.y + 30.0*p.x + 6.28*0.7812) * 0.05; 这篇关于如何在着色器中制作波浪变形效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-23 04:13