UE4_如果快速做出毛玻璃效果_假景深

UE4_如果快速做出毛玻璃效果_假景深

2022-08-20 15:02

一个SpiralBlur-SceneTexture材质节点完成效果,启用半透明材质

通过修改BlurAmount数值大小调整效果

spiralBlur-SceneTexture

custom节点,HLSL语言

float3 CurColor = 0;

float2 BaseUV = MaterialFloat2(ScreenAlignedPosition(Parameters.ScreenPosition).xy);

float2 NewUV = BaseUV;

float StepSize = Distance / (int) DistanceSteps;

float CurDistance = 0;

float2 CurOffset = 0;

float TwoPi = 6.283185;

float Substep = 0;

float2 ScenePixels=View.BufferSizeAndInvSize.xy*BaseUV;

ScenePixels+=View.TemporalAAParams.r;

float2 RandomSamp = ((uint)(ScenePixels.x) + 2 * (uint)(ScenePixels.y)) % 5;

RandomSamp+=Texture2DSample(Tex,TexSampler,ScenePixels);

RandomSamp/=5;

RandomSamp-=0.5;

TempAARotation*=RandomSamp;

TempAADistance*=StepSize*RandomSamp;

int i=0;

if (DistanceSteps<1)

{ return DecodeSceneColorForMaterialNode(NewUV);

} else

{ //CurDistance += 0.5*StepSize;

while ( i < (int) DistanceSteps)

{

//CurDistance+=StepSize;

for (int j = 0; j < (int) RadialSteps; j++)

{ CurOffset.x = cos(TwoPi*((TempAARotation+Substep) / RadialSteps));

CurOffset.y = sin(TwoPi*((TempAARotation+Substep) / RadialSteps));

CurOffset *=DistanceMask;

NewUV.x = BaseUV.x + (CurOffset.x * (CurDistance+(RandomSamp*TempAADistance)));

NewUV.y = BaseUV.y + (CurOffset.y * (CurDistance+(RandomSamp*TempAADistance)));

CurColor += DecodeSceneColorForMaterialNode(NewUV);

//CurDistance+=(StepSize+(TempAADistance))/RadialSteps;

Substep++;

} CurDistance+=StepSize;

Substep+=RadialOffset;

i++;

} CurColor = CurColor / ((int)DistanceSteps*(int)RadialSteps);

return CurColor;

}

spiralBlur-Texture

float3 CurColor=0;

float2 NewUV = UV;

int i=0;

float StepSize = Distance / (int) DistanceSteps;

float CurDistance=0;

float2 CurOffset=0;

float SubOffset = 0;

float TwoPi = 6.283185;

float accumdist=0;

if (DistanceSteps < 1)

{ return Texture2DSample(Tex,TexSampler,UV);

} else

{ while ( i < (int) DistanceSteps)

{ CurDistance += StepSize;

for (int j = 0; j < (int) RadialSteps; j++)

{

SubOffset +=1;

CurOffset.x = cos(TwoPi*(SubOffset / RadialSteps));

CurOffset.y = sin(TwoPi*(SubOffset / RadialSteps));

NewUV.x = UV.x + CurOffset.x * CurDistance;

NewUV.y = UV.y + CurOffset.y * CurDistance;

float distpow = pow(CurDistance, KernelPower);

CurColor += Texture2DSample(Tex,TexSampler,NewUV)*distpow;

accumdist += distpow;

}

SubOffset +=RadialOffset;

i++;

} CurColor = CurColor;

CurColor /=accumdist;

return CurColor;

}

评论(0)

相关推荐
go_bai22 分钟前
Linux环境基础开发工具——(2)vim
linux·开发语言·经验分享·笔记·vim·学习方法
明灯L32 分钟前
《函数基础与内存机制深度剖析:从 return 语句到各类经典编程题详解》
经验分享·python·算法·链表·经典例题
100分题库小程序37 分钟前
2025年机动车授权签字人考试判断题分享
经验分享·笔记
mycm030411 小时前
新闻发稿媒体投稿软文推广有哪些需要注意的事项
经验分享·媒体
碣石潇湘无限路14 小时前
【奇点时刻】GPT-4o新生图特性深度洞察报告
人工智能·经验分享·chatgpt·gpt4o·新生图特性
汇能感知17 小时前
光谱相机的光谱数据采集原理
经验分享·笔记·科技
moongoblin17 小时前
杂篇-行业分类一二-2(通、专用设备制造,汽车制造)
经验分享·汽车·制造
『六哥』18 小时前
Windows 10 如何设置右击鼠标快速进行“关机”
windows·经验分享·编辑器
odoo-卜永19 小时前
ubuntu22.04连接爱普生打印机型号L385
linux·经验分享·ubuntu
渗透测试老鸟-九青20 小时前
面试经验分享 | 成都渗透测试工程师二面面经分享
服务器·经验分享·安全·web安全·面试·职场和发展·区块链