HLSL for getting cylinder effect

前端 未结 2 1579
渐次进展
渐次进展 2020-12-20 00:49

I need to write an application with Silverlight 4 and need to show images like wrapped on cylinder. I need some HLSL code, as I wont to do that with Effects of Silverlight.<

2条回答
  •  长情又很酷
    2020-12-20 01:42

    This seems to be the effect you want, you may wish to change the 0.2 value to increase or decrease the effect or make this adjustable in your shader but that's a simple change to do. I'd recommend Shazzam if your not using it for writing shaders for WPF or Silverlight.

    sampler2D input : register(s0);
    
    float4 main(float2 uv : TEXCOORD) : COLOR 
    { 
        float y = uv.y+(sin(uv.x*3.14) * lerp(-1,1,uv.y) * 0.2);
        if(y < 0 || y > 1)
            return float4(0,0,0,0);
        else
            return tex2D(input,float2(uv.x,y));
    }
    

提交回复
热议问题