Ok, so - I'm a complete idiot when it comes to shader programming, and while I suspect someone with some experience here may find this easy, I'm at a bit of a loss.
I'd like to create a shader that would be applied to walls, and if the wall was closer to the camera than the player is, the wall would gain alpha transparency (probably 10-20% visible). I had tried some things with a camera that pans, zooms, and moves overhead as needed to not occlude the player, but it's sloppy and just doesn't feel very nice. I had used an x-ray shader, that showed an outline of the player through the wall, and while it was "cool", it also didn't quite feel right. The camera and player will always be a fixed distance and angle apart (well, at least at a given resolution). Is there some way to use the draw buffer or otherwise calculate world space position to determine when alpha should be applied?
Any help is very much appreciated. Thanks!
EDIT: I was looking and found a lot of solutions like this one: https://forum.unity3d.com/threads/global-shader-to-apply-transparency-on-objects-depending-how-far-is-the-camera.188632/
But I'd rather have it contained entirely in the shader. Preferably something I could build into a copy of the Standard (Specular Setup) shader in Unity - that copy being applied only to wall objects.
EDIT #2: I understand that this could be done with two separate materials, using code to swap them with Raycasting (though it seems that that would only work specifically for objects directly between the camera and the player rather than objects closer to the camera than the player). But I'm growing more uncertain that the shader can be told anything about the position of the player as an object.