How to make POM + VT work?

Hi, i have issue with POM + Virtual Textures, how can i fix it? I use default Parallax Occlusion Mapping node, and i don’t see any code incompatibles. What can it be?
The code:

float rayheight=1;
float oldray=1;
float2 offset=0;
float oldtex=1;
float texatray;
float yintersect;
int i=0;

while (i<MaxSteps+2)
{
texatray=dot(HeightMapChannel, Tex.SampleGrad(TexSampler,UV+offset,InDDX, InDDY));

if (rayheight < texatray)
{
float xintersect = (oldray-oldtex)+(texatray-rayheight);
xintersect=(texatray-rayheight)/xintersect;
yintersect=(oldray*(xintersect))+(rayheight*(1-xintersect));
offset-=(xintersect*UVDist);
break;
}

oldray=rayheight;
rayheight-=stepsize;
offset+=UVDist;
oldtex=texatray;

i++;
}

float4 output;
output.xy=offset;
output.z=yintersect; output.w=1;
return output;


Снимок экрана 2024-04-15 144832

1 Like