URP custom shadow quality decreasing at a distance

Hi!

I’m developing a custom shader for a game using URP and Shader Graph. It is intended to look scratchy, almost drawn on. To this end, I’ve implemented a custom unlit shader that recreates shadows and lighting using a procedural cross-hatch texture- it’s applied to each material in the scene. I have created no functionality of depth checking, so this issue is entirely a default behaviour somehow.

My problem arises when trying to view objects with this shader from a short distance away- the quality drops significantly, creating clear lines where the shadow texture looks significantly different.

For example, this is how the ground looks while zoomed in

And this is how it looks when zoomed slightly out


You can see in both images where the quality suddenly drops.

This looks very noticeable in the game as it’s third-person and the camera can be a fair distance away from the ground.

I’ve already played around with the shadow and rendering settings on the renderer assets, global settings, the lighting menu, camera settings, settings within the shader graph, and just about anything I could think of- it made the shapes of shadows more correct at a distance, but it hasn’t solved this problem of the texturing itself cutting out. I’ve got a lead that says it’s to do with a depth checker, but I’m not quite sure where I could access any part of it as a setting.

Any help would be much appreciated :smile: Thanks!

Edit: I have confirmed that this does occur in build as well. Maybe an LOD thing?

Solved it!

The answer was texture mip maps. The scratch texture itself was moving through mip maps depending on the distance, and because the space between lines would get bigger it eventually became entirely clear.

To fix this, I just went into the scratch texture and disabled “Generate Mip Maps”- the scratches now remain visible regardless of distance :))