当前位置:   article > 正文

UE4滤镜:边缘模糊_ue4模型边缘虚化怎么做

ue4模型边缘虚化怎么做
  1. float2 blurRadius = KernelSize / TextureSize;
  2. float4 finalColor =Texture2DSample(Tex, TexSampler, UVs);
  3. if(KernelSize==0){
  4. return finalColor.a;
  5. }
  6. if(NumSamples==0){
  7. return finalColor.a;
  8. }
  9. float2 newUV = UVs;
  10. float alpha = 0;
  11. for (int i=0;i<NumSamples;++i)
  12. {
  13. float2 pdf = CosineSampleHemisphere(Hammersley(i, NumSamples, 0)).xy;
  14. float2 uvOffset = pdf * blurRadius;
  15. float2 uvShifted = UVs + uvOffset;
  16. float4 hitColor = Texture2DSample(Tex, TexSampler, saturate(uvShifted));
  17. alpha += hitColor.a;
  18. }
  19. alpha = alpha/NumSamples;
  20. if (alpha > finalColor.a)
  21. {
  22. return alpha;
  23. }
  24. return finalColor.a;

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/107568?site
推荐阅读
相关标签
  

闽ICP备14008679号