I modified the Unity water shader (not water4, the other one), but i got some trouble with lighting. There are two issues;
EDIT:
I rewrote the shader to a surface shader instead of fragment, so I don’t need a refraction camera anymore and the shadows also show under the plane, the only problem left is the shadows on the surface itself. how can the surface receive shadows. I got a little idea to create a ortho-cam facing from the surface to the main light (sun light), and check in the renderer texture in the shader by color picking or a depth texture. anyone knows how to do this?
OLD (fragment shader issue):
First, the shadows stop under water, this is because the render textures don’t render the shadows. I already tried to use forward rendering path, but no effect.
And last, I used this: “How do I sample a shadowmap in a custom shader? - Unity Answers” to get shadows casting on the water surface. but when enabling “Receive shadows” in the mesh renderer component, it becomes completely transparent. But I can manage to get the shadows on the surface but then the depth texture don’t work anymore.
Does anyone know how to fix this?
(And sorry for my bad English…)
Note the shadows stop when reaching the plane