Hey there,
I was wondering if it is possible to let a mesh appear to be in front of another mesh even though it is behind it world space. I need it for an optical illusion.
I figured there is a Option in ShaderLab called ZTest Always.
In this example I’ve seperated the mesh into two pieces. The one behind the other has a shader with ZTest Always. Thats what it looks like:
It kind of does what I want it to do but there is a problem with this method.
If there is anything else, like a cube, on top of the mesh it appears to be behind the mesh again but it shouldn’t. That is the problem.
So I was wondering if there is a way to render the mesh only in front of a specific mesh but not all meshes.
I also stumbled across the option of sorting layers like it’s used by the SpriteRenderer only for the MeshRenderer (here) but it didn’t work for me.
I’ve also tried to change the “Custom Render Queue” of the Material but it didn’t work too.
I also couldn’t succeed with the Queue in the shader itself. I’ve tried something like this:
Shader "Queue"
{
SubShader
{
Tags { "Queue"="Geometry+1" }
Pass
{
....
What did I do wrong?
Thank you for reading.