PixelDepth and tesselation/displacement?

Hi! I have a landscape material that I wish to improve by including a displacement map for one of my more rocky layers, I managed to create the map and implement it to the material on its own fine. But I cannot seem to figure out how to make it play nicely with existing properties of my material. I get tons of errors when I implement it, but they seem to all stem from PixelDepth.
I use pixeldepth to determine the distance from the player and scale the UV’s of my materials accordingly, so that I get large textures that look better and don’t repeat in the distance.

How can I make use of both? Or is there perhaps an alternative to pixeldepth I can use?

The error I get isn’t very helpful, just “Invalid node in domain/shader input”.

Edit: I found a suggested fix, which is of instead of using pixeldepth, you manually calculate the distance from the camera.
But how would I actually do this in practice?

Edit2: Turns out there’s literally a world position node, a camera position node, and a distance node. I guess it couldn’t actually be simpler.
Now the displacement works perfectly, though the blend transition has quite a bit of artifacting and I still have one last error with the tesselation.

I don’t want to waste tons of tesselation on layers that don’t have displacement, but it doesn’t seem to like my world aligned blend nodes
I cannot tell which if it’s not all, as it’s not showing me any error lables on my nodes and I cannot tell what the problem is. Any suggestions?

Distance between camera position and absolute world position, divide and clamp, then lerp works great. But tessellation multiplier should just lerp between two numbers. The displacement is where you put your textures.

The big issue I found with tessellation is how expensive it is.If you do any kind of shadowing especially, you balloon the cost of all those effects. Keep in mind the calculations for the higher poly mesh have to be done in realtime, and you need a LOT of polys to capture any kind of decent detail. I switched to POM for my landscape, and while it does have some issues, they’re really hard to notice. It’s actually much better on performance.

I’m using tesselation quite sparingly at low levels of interpolations luckily, so hopefully it shouldn’t be too bad.

That’s actually what I do, the distance part is for the most part working fine other than some artifacting with opacity masks and wobbling (but I was able to hide it enough with some tweaking).
The problem I have now is mixing tesselation with the layer blending for painted layers. It works fine when I take the vertex normal output of one of world aligned blends as an alpha for the lerp.
But when I try to make use of the material attributes that get mixed together through layer blend (landscape painting) as well as a couple of world aligned blends (for the base automatic application of the material), I get this error leading back to worldalignedblend.

The material attributes use a combination of vertex normal and explicit normals for the blending of my materials.
It doesn’t throw the error when I just use vertex normal, but then I don’t get the neat transitions i want.

Edit: I suppose could split off out the lerping for tesselation and only use vertex normals, but I’m not sure how I would do that since it all gets mixed up with the layer blend anyway. Obviously I can’t skip the layer blend since the painting is part of the point of the material.

Edit2: I was able to avoid explicit normals and use my heightmask directly instead to achieve a similar effect, it now works great and even looks better. :smiley:

Yeah, tessellation is meant to be displaced with displacement maps in the direction of the vertex normal.