首页 > 其他 > 详细

在UnrealEngine中用Custom节点实现径向模糊

时间:2017-02-03 18:19:03      阅读:256      评论:0      收藏:0      [点我收藏+]
//input NotUse 为了开启SceneTextureLookup函数而连接的节点,但是不参与逻辑
//input UV 屏幕缓存的坐标坐标
//input Strength 力度
//input CenterPosition 模糊中心位置,默认为float2(0.5,0.5)也就是中心
//input ScreenMult 因为View和RenderTarget大小不同而造成的中心偏差比值
//14是原始颜色
int tIndex=14;
float Samples[10] =   
{  
   -0.08,  
   -0.05,  
   -0.03,  
   -0.02,  
   -0.01,  
   0.01,  
   0.02,  
   0.03,  
   0.05,  
   0.08  
};  
    float4 OutColor=SceneTextureLookup(UV,tIndex,false);
    float2 dir = UV+(CenterPosition-0.5)-0.5*ScreenMult;    
    float2 Pos;
for(int i=0;i<10;i++)
{
    Pos=UV+Samples[i]*dir*Strength;
    Pos=max(min(Pos, ScreenMult*float2(1.0, 1.0)), float2(0.0,0.0));
    OutColor+=SceneTextureLookup(Pos,tIndex,false);
}
    return OutColor/=11.0;
 
技术分享
技术分享

在UnrealEngine中用Custom节点实现径向模糊

原文:http://www.cnblogs.com/blueroses/p/6362948.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!