How wrap image around cylinder in Silverlight

我的未来我决定 提交于 2019-12-07 06:36:39

问题


I am trying wrap image around cylinder in silverlight. I looked a lot in Google but don't found anything. As I know it can be done with pixel shader, but don't know how.
Is it possible?
Thanks.


回答1:


It's not a complete wrap onto cylinder, but you will get a starting idea/example:

(code is in GLSL, not in HLSL, but i think it will be not hard to convert it)

uniform sampler2D tex;

void main()
{
 vec2 cen = vec2(0.5,gl_TexCoord[0].y)-gl_TexCoord[0].xy;
 cen = vec2(pow(cen.x,1.7),pow(cen.y,2.2));
 cen.y = 3.9*sin(1.8*gl_TexCoord[0].x-2.3);
 vec2 mcoord = 1.65*vec2(-0.22+gl_TexCoord[0].x,1.95+gl_TexCoord[0].y);
 gl_FragColor = texture2D(tex, mcoord+cen);
}

From this

you will get something like that

Good luck




回答2:


You may want to try Zam3d. I have used trial versions previously, and you can get the 3D shape and try and set the background to an image. Have a look and see if that helps.



来源:https://stackoverflow.com/questions/3607748/how-wrap-image-around-cylinder-in-silverlight

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