Search Issue Tracker
Won't Fix
Votes
0
Found in
2021.3.17f1
2022.2.4f1
2023.1.0b1
Issue ID
UUM-25699
Regression
No
[Quest 2] Surface shader and multi-view sampling custom textures broken in Quest 2
Steps to reproduce:
1. Open the attached user's project "LiquidProQuestVR_Builtin.zip"
2. Open the scene "LiquidVolumePro/Demos/Beer" and build on a Quest 2 with Multi-View enabled in OculusXR settings
3. Observe the GameObject not being rendered
Expected results: Surface shader and multi-view sampling custom textures render in Quest 2
Actual results: Surface shader and multi-view sampling custom textures do not render in Quest 2
Reproducible on: 2021.3.16f1, 2022.2.4f1, 2023.1.0b1
Could not test on 2020.3.44f1 due to project errors when downgrading
Reproducible on these devices:
VLNQA00415 - Oculus Quest 2 (Quest 2), CPU: Snapdragon XR2, GPU: Adreno 650, OS: 10
Notes:
-Issue reproduces with Vulkan and OpenGLES 3
-Issue does not reproduce with MultiPass
-Issue reproduces with OpenXR and OculusXR
-According to the user, the allegedly broken code is in:
C#: LiquidVolume.cs, look for ##region Backbuffer
This code setups a command buffer bound to the camera to capture the depth of the geometry in a render texture.
Shader: LVLiquidPassBase.cginc, look for "// sampling depth from the texture".
This code samples the depth value from the _VLBackBufferTexture (the render texture).
For some reason, either capturing the depth in the command buffer or sampling it from this surface shader is not working with multi-view (VR macros are correctly placed).
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "WebGL Publish" detects WebGL module and allows building when it is installed without restarting the project
- Editor is non-responsive and flickers when multiple Water System instances are enabled
- Texture2D.PackTextures causes mips 7-9 to turn pink when packed textures are of ASTC 4x4 compression
- "OnApplicationQuit" is called when "Application.wantsToQuit" returns false
- Console search fails to find log messages when log messages contain <B></B> tags
Resolution Note:
Looking at the shader and it has macros missing.
struct Input {
float3 realPos;
float4 vertex;
#if LIQUID_VOLUME_DEPTH_AWARE || LIQUID_VOLUME_DEPTH_AWARE_PASS || LIQUID_VOLUME_IRREGULAR
float4 screenPos;
#endif
float3 camPos;
};
This is missing
UNITY_VERTEX_OUTPUT_STEREO
in the struct.
Now the vertex shader looks like this:
void vert(inout appdata_base v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input,o);
o.vertex = v.vertex;
o.vertex.w = dot(o.vertex.xz, _Turbulence.zw) + _TurbulenceSpeed;
o.vertex.xz *= 0.1.xx * _Turbulence.xx; // extracted from frag
o.vertex.xz += _Time.xx;
v.vertex.xyz *= _FlaskThickness;
o.realPos = mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1.0)).xyz;
#if LIQUID_VOLUME_IGNORE_GRAVITY
o.realPos = mul((float3x3)_Rot, o.realPos - _Center) + _Center;
o.camPos = mul((float3x3)_Rot, _WorldSpaceCameraPos - _Center) + _Center;
#else
o.camPos = _WorldSpaceCameraPos;
#endif
}
UNITY_INITIALIZE_OUTPUT will just initialize the variable type. It is missing
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO
Now in the surface shader it's missing this line:
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
This is what I noticed quickly looking over this shader. I just followed this doc:
https://docs.unity3d.com/2023.1/Documentation/Manual/SinglePassInstancing.html
Looking at other code the buffers need to be be arrays and then all the SPI macros need to be in the shaders to interact with the arrays.