I've encountered and error I can't seem to find online. I get it on all the water shaders I test, and any thing else that I have a depth node + depth render script on the camera for.
I'll share a bit more information about what we're doing in the game.
This artifact changes as we pinch-zoom on Android. So I wonder if the Render Depth script doesn't like that we are changing the zoom/depth for some reason? Maybe it has something to do with how we are handling out cameras movement in Unity?
It is adding more depth information somehow, because the shader is reacting to the artifact. Depending on where the line cuts, the other details will warp to meet it.
This problem doesn't show on all phones. Mostly Android, newer versions, but wasn't showing up on an older S5.
Some other things I've tried within the shader are different shader models 2.5 & 3.0.
Any suggestions on tests I can do, or ideas on what might be the issue?
Here are the nodes I use for the opacity / depth
Currently we've got the controls on one camera, and the depth script on another. Update, I've found someone talking about a similar sounding problem, but I'm not sure how to do this myself.
Thread here -- https://forum.unity.com/threads/depth-texture-not-working-on-some-devices.319568/
"If I set my RenderTexture Depth format to 16 bits instead of 24 bits it's working!" -- How do I do this? Can I edit my Camera script to do this?
The Camera script seems simple, but I'm not sure how to make it render 16bits instead of 24 bits to test this out.
// Toony Colors Pro+Mobile 2
// (c) 2014-2018 Jean Moreno
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
// Makes the Camera render a depth texture.
// This is needed for some water shaders that use depth-based effects such as edge intersection.
[ExecuteInEditMode, RequireComponent(typeof(Camera))]
public class TCP2_CameraDepth : MonoBehaviour
{
public bool RenderDepth = true;
void OnEnable()
{
SetCameraDepth();
}
void OnValidate()
{
SetCameraDepth();
}
void SetCameraDepth()
{
var cam = this.GetComponent<Camera>();
if (RenderDepth)
cam.depthTextureMode |= DepthTextureMode.Depth;
else
cam.depthTextureMode &= ~DepthTextureMode.Depth;
}
}
Thanks!