hi, i am trying to make a psychedelic game but im stuck badly on this issue. I need to make a gameobject visible through all other gameobjects in the scene even though it may be behind other gameobjects.
let me try to explain with this image

the blue vortex kind of thing in the image is nothing but planes with a transparent texture moving towards the camera from a fixed point in the z-axis to give the illusion of a vortex. These planes need to be visible even when behind other gameobjects. For example on the lower left of the image where it is behind the terrain and is not visible, but it should be.
I guess i need to write a shader for this, or is there anything inbuilt in unity? please help.
i know this is old but to keep shadows and model complexity use this one that makes 3D objects stay 3D and not have their own faces appear in front of them
Shader "Custom/Custom" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
}
SubShader {
Cull Off
Pass{
ZTest Greater
}
Pass{
ZTest Less
}
Pass{
ZTest Always
}
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Yes, you need a shader, but it’s not hard. The settings you need to ensure are set are:
Cull Off
ZTest Always
ZWrite Off
If you want an inbuilt example, look at the 3D text shader that comes with Unity, which renders text in front of everything else in the scene. More info at Unity - Manual: ShaderLab: commands
tl;dr: You can render these objects on a second camera
There is a non shader solution for this problem. The principle is to have a secondary camera that will take only your objects into account, then render on the top of the primary camera. It allows lighting, depth test between objects, and even shadows and post processing
_ set a special layer for the objects
to render above everything else,
_ use only this layer in the secondary
camera culling mask,
_ set the secondary camera clear flag
to “don’t clear”, so the empty space
will remain transparent,
_ set a greater depth for the secondary
camera, so it is rendered after the
primary one,
All other properties have to be exactly the same as the primary cam, including the transform.