I’m trying to make simple raymarching in unreal engine but I have problem In projection matrix (Clipping Plane Pos)
http://acegikmo.com/shaderforge/wiki/index.php?title=Raymarching
this is my custom node for raymarching
My Code Is here:
float3 initPos = CamPos + ViewDir + ClippingPlanePos;
float3 sample = initPos;
float3 sampleOffset = ViewDir * StepSize;
float4 color = float4(0,0,0,0);
for(int i = 0;i < StepMax;i++)
{
if(distance(sample,SpherePos) <= SphereRadius)
{
color = float4(sample,1.0);
break;
}
sample += sampleOffset;
}
return color;