Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
15
Indexable
Never
float getcolor = 0;
float2 newUV;
float maskY;
float maskX;
float final;
float2 dir[24] = {
    float2(1.0,1.0),
    float2(1.0,0.0),
    float2(-1.0,0.0),
    float2(-1.0,-1.0),
    float2(0.5,0.5),
    float2(0.5,-0.5),
    float2(-0.5,0.5),
    float2(-0.5,-0.5),
    float2(0.84,0.16),
    float2(0.68,0.33),
    float2(0.33,0.68),
    float2(0.16,0.84),
    float2(-0.84,0.16),
    float2(-0.68,0.33),
    float2(-0.33,0.68),
    float2(-0.16,-0.84),
    float2(-0.84,-0.16),
    float2(-0.68,-0.33),
    float2(-0.33,-0.68),
    float2(-0.16,-0.84),
    float2(0.84,-0.16),
    float2(0.68,-0.33),
    float2(0.33,-0.68),
    float2(0.16,-0.84),
};

for(int i = 0; i < 24; ++i)
{

	newUV = InUV + (dir[i] * InDistance);
		if ( newUV.x < 0 | newUV.x > 1 )
		{
		maskX =  0;
		}
		else 
		maskX = 1;

		if ( newUV.y < 0 | newUV.y > 1 )
		{
		maskY =  0;
		}
		else
		maskY = 1;

	float final = maskX * maskY;
	getcolor.x += (saturate(Texture2DSample(InTxt,InTxtSampler,newUV) - InWaterLvl)) * final;

}

return getcolor/24;