zoukankan      html  css  js  c++  java
  • 在UnrealEngine中用Custom节点实现径向模糊

    //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;
     
  • 相关阅读:
    图像按钮
    提交按钮
    文件上传域
    Python创建虚拟环境
    Typecho使用技巧
    面向对象
    Python语法入门
    Python 基础数据类型
    与用户交互
    MySQL5.7安装教程
  • 原文地址:https://www.cnblogs.com/blueroses/p/6362948.html
Copyright © 2011-2022 走看看