Last active
October 7, 2021 01:44
-
-
Save tomlooman/e75f6ef0ab0b53063677db3b7dd0ffd9 to your computer and use it in GitHub Desktop.
Spiral Blur modified to sample Custom depth buffer for soft object outlines.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(CustomDepthTexture,CustomDepthTextureSampler,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 += ceil(Texture2DSample(CustomDepthTexture,CustomDepthTextureSampler,NewUV))*distpow; | |
accumdist += distpow; | |
} | |
SubOffset +=RadialOffset; | |
i++; | |
} | |
CurColor = CurColor; | |
CurColor /=accumdist; | |
return CurColor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this a whole, functioning HLSL statement? why is Unreal asking me for Variable definitions when i plug this in to a custom node?