When using shaders which omit themselves when
_VRChatCameraMode
is set to
0
, objects using these shaders are non-visible in the spout stream camera when the camera UI is closed.
This is not expected and presumably not intended behavior.
_VRChatCameraMode
is being set to 0 when the camera UI is closed, despite an active camera still going, and said shaders rendering properly when camera UI is open.
Example Shader:
Shader "LiveDimensions/ScreenSpaceTexture"
{
Properties
{
_Color("Shader Color", Color) = (0.3,0.3,0.3,1)
_MainTex ("Texture", 2D) = "white" {}
[Toggle] _NoPlayerRender ("Render Highlight in Camera Only", float) = 0
}
SubShader
{
Tags {"Queue" = "Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
blend One OneMinusSrcAlpha
//INSIDE OF SPHERE (USES RENDER TEXTURE)
Pass
{
//Cull back faces so we can write front faces over the last pass
Cull Front
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 vert(appdata_base v) : SV_POSITION
{
return UnityObjectToClipPos(v.vertex);
}
float _VRChatCameraMode;
fixed4 frag(float4 i : VPOS) : SV_Target
{
[branch] switch(_VRChatCameraMode){
case 0: {
return fixed4(0.0,0.0,0.0,0.0);
break;
}
default: {
fixed4 tex = tex2D(_MainTex, ((i.xy / _ScreenParams.xy)));
UNITY_OPAQUE_ALPHA(tex.a);
return tex;
break;
}
}
}
ENDCG
}
//OUTSIDE OF SPHERE (USES RENDER TEXTURE * COLOR)
Pass
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off
// AlphaTest Greater 0.01
// blend SrcAlpha OneMinusSrcAlpha
blend OneMinusDstColor One, One OneMinusSrcAlpha
//Cull front faces first
Cull Back
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f {
float4 vertex : SV_POSITION;
UNITY_FOG_COORDS(0)
UNITY_VERTEX_OUTPUT_STEREO
};
fixed4 _Color;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
float _VRChatCameraMode;
float _NoPlayerRender;
fixed4 frag (v2f i) : COLOR
{
fixed4 col = _Color;
[branch] switch(_VRChatCameraMode){
case 0: {
[branch] switch(_NoPlayerRender){
case 0: {
break;
}
default: {
col = fixed4(0.0,0.0,0.0,0.0);
break;
}
}
break;
}
default: {
break;
}
}
UNITY_APPLY_FOG(i.fogCoord, col);
UNITY_OPAQUE_ALPHA(col.a);
return col;
}
ENDCG
}
}
}