国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

UE4/5 風(fēng)格化材質(zhì)---描邊部分HLSL代碼分享

2023-03-01 20:38 作者:蟲棍俠  | 我要投稿

視頻指路:[UE4/UE5]水墨(彩墨)風(fēng)格化材質(zhì)制作流程分享 (bilibili.com)

此文章為該視頻內(nèi)使用的部分代碼


//-----邊緣檢測算法-----

//首行填充函數(shù)

return 0;}

//--------//

#ifndef _LAPLACETRANSFROM_

#define _LAPLACETRANSFROM_


float GetPixelDepth(FMaterialPixelParameters _Parameters,float2 Offset,float DilationRate){


? ? float2 uv=GetDefaultSceneTextureUV(_Parameters,14);

? ? Offset*=ViewportUVToBufferUV(View.ViewSizeAndInvSize.zw);

? ? float2 newUV=uv+Offset*DilationRate;

? ? return SceneTextureLookup(newUV,1,false);

}


float LaplaceTransform(FMaterialPixelParameters _Parameters,float Thickness){

? ? float3x3 LaplaceMat={0,1,0,

? ? ? ? ? ? ? ? ? ? ? ? ?1,-4,1,

? ? ? ? ? ? ? ? ? ? ? ? ?0,1,0};

? ? float OutDepth=0.0;

? ? for(int i=0;i<=2;i++){

? ? ? ? for(int j=0;j<=2;j++){

? ? ? ? ? ? float2 offset=float2(i-1.0,j-1.0);

? ? ? ? ? ? float temp=GetPixelDepth(_Parameters,offset,Thickness)*LaplaceMat[i][j];

? ? ? ? ? ? OutDepth+=temp;

? ? ? ? }

? ? }

? ? return abs(OutDepth);

}


#endif //#ifndef _LAPLACETRANSFROM_

//--------//

//末行填充函數(shù)

void FixFunc(){


//------描邊

float OutlineFunction(){

? ? float OutDepth=LaplaceTransform(Parameters,Thickness);

? ? float Outline=1-saturate(1/OutDepth);

? ? float CustomDepth=SceneTextureLookup(GetDefaultSceneTextureUV(Parameters,14),13,false).r;

? ? float SceneDepth=SceneTextureLookup(GetDefaultSceneTextureUV(Parameters,14),1,false).r;

? ? Outline=lerp(Outline,0,step(CustomDepth,SceneDepth));

? ? Outline*=step(Threshold,OutDepth);

? ? return Outline;

}


//-----擾亂描邊

float DisturbThicknessWithDepth(float Noise,float Thickness,float SceneDepth){

? ? Noise=(Noise-0.5)*Thickness;

? ? Thickness=(Thickness+Noise)*SceneDepth;

? ? return Thickness;

}



UE4/5 風(fēng)格化材質(zhì)---描邊部分HLSL代碼分享的評論 (共 條)

分享到微博請遵守國家法律
大理市| 汾阳市| 罗平县| 盐城市| 遵义县| 三门县| 颍上县| 三都| 鹿邑县| 宁陕县| 怀化市| 大丰市| 新安县| 山东| 青州市| 潍坊市| 商丘市| 彭水| 温州市| 刚察县| 芜湖市| 河西区| 开原市| 阳江市| 类乌齐县| 静乐县| 扎兰屯市| 深州市| 明水县| 车致| 河间市| 玉龙| 漳平市| 义乌市| 北安市| 勃利县| 柳河县| 淮阳县| 周宁县| 阿克| 奉节县|