In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.
That looks like z-fighting with the depth prepass used to make the hands appear self-occluding. What kind of graphics card do you have? If we have one handy, I can try to reproduce.
I'm using a Nvidia 980. I found that if I put that shader on other meshes it has the same problem, so definitely seems like that self occluding shader is messed up somehow.
Also, I just confirmed that it doesn't happen when I load that avatars SDK into a fresh Unity project, so something in our project must be conflicting.
Is there any chance you're doing anything to adjust the resolution of the depth buffer in your render scene?
One thing you can try is biasing the depth test in the avatar surface shaders to try to cover precision issues. If you go into AvatarSurfaceShaderPBS and AvatarSurfaceShaderSelfOccluding and add a line like:
Strangely it doesn't happen in our master scene, only the example scenes, so this isn't a blocking problem for us. Will try out that fix tomorrow just to see if that's the cause.
I fixed a problem similar to that by NOT using the Single Pass Stereo (Unity 5.4) or by using the Stereo Rendering Mode: Multipass (Unity 5.5) on the Players Settings....
Its seems that the Avatar SDK shaders are not yet compatible with single pass stereo....
You can try on the editor by toogling the option when running the game on the editor.....
I am having this issue currently as well, and can confirm that multi pass stereo rendering "fixes" it.
Edit: I just tried Noughtceratops'es fix, and while offset values of -0.1, -1 didn't work (it made the materials completely invisible), values of 0.1, 1 fix the flickering issue.
I had this issue initially but it fixed itself (yay?). But I have another, probably linked issue where occlusion will randomly be enabled or disabled for the glowy hand shader. On launch I can see my fingers through my hands. If I hit 'start with controllers' and re-play the scene then the shader will be fixed (similar to how it acts in the overlay scene and Home), and if I remove the controller tickmark stuff will be ready to go. Weird.
That fixed the flickering, but now there is incorrect triangle sorting only on my right hand. Some random patches of triangles are showing through the back of the hand consistently.
I had the same weird flickering issue. Both solutions mentioned above worked for me: switching to multi-pass, or editing AvatarSurfaceShaderPBS.shader and AvatarSurfaceShaderSelfOccluding.shader and adding `Offset 1, 1` before CGPROGRAM. (My experience was similar to @jlink's: the offset values needed to be positive for this to work. I also had to change the decimal factor to a whole number: `1, 1` instead of `0.1, 1`, because I was still getting some flickering with the decimal.) Editing the shaders seems to be the best solution, performance-wise.
I was also getting occlusion issues, the same as @owenwp. Sometimes I could see my fingers through my hands, on both hands, or sometimes just on one hand. I fixed this by editing `OvrAvatarRenderComponent.cs` and changing the line: `shaderPath = selfOccluding ? "OvrAvatar/AvatarSurfaceShaderSelfOccluding" : "OvrAvatar/AvatarSurfaceShader";` to simply: `shaderPath = "OvrAvatar/AvatarSurfaceShaderSelfOccluding";`.
I hope this helps the next person! Also, I hope they fix these issues in OvrAvatar 1.11
I would also like to know how to fix this. I added that line from a few posts above and it mostly solved issues but the hands still look odd with missing parts and now the controllers are invisible...
I have the same problem with unity 5.6beta and the latest avatar SDK 1.12. i tried all of the above and it didn't work (except the OvrAvatarRenderComponent modification as i can't find a variable named shaderPath anywhere in the file) also using gtx980, latest nvidia drivers.
Hi @Yoirgl. You're right: OvrAvatarRenderComponent has completely changed in 1.12. Can you confirm your PBS and self-occluding shaders now look like this?
ZWrite On Cull Off ColorMask 0 Offset 1, 1
CGPROGRAM #pragma vertex vert
I can confirm that this fix works for me on 1.12 with 5.5.1p4, (as does switching off single-pass stereo).
Hi @Yoirgl. You're right: OvrAvatarRenderComponent has completely changed in 1.12. Can you confirm your PBS and self-occulting shaders now look like this?
ZWrite On Cull Off ColorMask 0 Offset 1, 1
CGPROGRAM #pragma vertex vert
i can confirm that this works for me on 1.12 with 5.5.1p4, (as does switching off single-pass stereo).
Hello ;-) I will check that in 8 hours after my job will let you know. However from memory i don't think it looks anywhere like this.
I noticed the texture was moving on the object between draws in the same frame. When I created a variant of the two, I could toggle the effect. I then saw a higher accuracy when using UnityObjectToClipPos (expected vs actual points) when drawing a cube.
As an added bonus, the vert shader for d3d11 uses 8 ops vs 20 ops when using mul, meaning better performance. Even better, this allows the (unnecessary in this case but enabled by default) d3d9/d3d11_9x variants to compile successfully.
For me, this works for all the exceptions listed in this thread using Avatar SDK 1.12.0 in both Unity 5.5.2p2 and Unity 5.6.0b11.
I noticed the texture was moving on the object between draws in the same frame. When I created a variant of the two, I could toggle the effect. I then saw a higher accuracy when using UnityObjectToClipPos (expected vs actual points) when drawing a cube.
As an added bonus, the vert shader for d3d11 uses 8 ops vs 20 ops when using mul, meaning better performance. Even better, this allows the (unnecessary in this case but enabled by default) d3d9/d3d11_9x variants to compile successfully.
For me, this works for all the exceptions listed in this thread using Avatar SDK 1.12.0 in both Unity 5.5.2p2 and Unity 5.6.0b11.
Thank you for this elegant and very effective solution. this fixed my problem instantly
For me, this works for all the exceptions listed in this thread using Avatar SDK 1.12.0 in both Unity 5.5.2p2 and Unity 5.6.0b11.
Edit: After posting this, I removed my Offset 1,1 from the shaders and it's working great with UnityObjectToClipPos. I need to backtrack and see what else I did.
For me, this caused some other artifacts in the Unity Game view and the flickering wasn't completely squashed. But adding Offset 1,1 gets rid of the flickering with single-pass stereo for me. Unity 5.4.4f1 with Avatar 1.12.
Getting the perf gains from switching to UnityObjectToClipPos is great, I'm just saying it didn't fix the z-fighting for me.
For me, this works for all the exceptions listed in this thread using Avatar SDK 1.12.0 in both Unity 5.5.2p2 and Unity 5.6.0b11.
Edit: After posting this, I removed my Offset 1,1 from the shaders and it's working great with UnityObjectToClipPos. I need to backtrack and see what else I did.
For me, this caused some other artifacts in the Unity Game view and the flickering wasn't completely squashed. But adding Offset 1,1 gets rid of the flickering with single-pass stereo for me. Unity 5.4.4f1 with Avatar 1.12.
Getting the perf gains from switching to UnityObjectToClipPos is great, I'm just saying it didn't fix the z-fighting for me.
I tested it on 5.4.4f1 as well and had no issues with the visual either. However, that Unity version was below min req for dependency SDKs to the Avatar SDK, causing a crash whenever I press any button on my touch controller.
As for backtracking, yay for friends like source control and text diffs. Good luck!
Comments
Nope that didn't help.
Also, I just confirmed that it doesn't happen when I load that avatars SDK into a fresh Unity project, so something in our project must be conflicting.
One thing you can try is biasing the depth test in the avatar surface shaders to try to cover precision issues. If you go into AvatarSurfaceShaderPBS and AvatarSurfaceShaderSelfOccluding and add a line like:
before CGPROGRAM, you may be able to offset any precision issues. (Full documentation on shader depth test offsets here: https://docs.unity3d.com/Manual/SL-CullAndDepth.html )
Its seems that the Avatar SDK shaders are not yet compatible with single pass stereo....
You can try on the editor by toogling the option when running the game on the editor.....
Edit: I just tried Noughtceratops'es fix, and while offset values of -0.1, -1 didn't work (it made the materials completely invisible), values of 0.1, 1 fix the flickering issue.
I've had it come up a few times and then it fixed its self, so I tended to just ignore it. But it's been doing it now for around a week.
Focus VR - https://www.focusvr.co.uk
I was also getting occlusion issues, the same as @owenwp. Sometimes I could see my fingers through my hands, on both hands, or sometimes just on one hand. I fixed this by editing `OvrAvatarRenderComponent.cs` and changing the line: `shaderPath = selfOccluding ? "OvrAvatar/AvatarSurfaceShaderSelfOccluding" : "OvrAvatar/AvatarSurfaceShader";` to simply: `shaderPath = "OvrAvatar/AvatarSurfaceShaderSelfOccluding";`.
I hope this helps the next person! Also, I hope they fix these issues in OvrAvatar 1.11
also using gtx980, latest nvidia drivers.
ZWrite On
Cull Off
ColorMask 0
Offset 1, 1
CGPROGRAM
#pragma vertex vert
I can confirm that this fix works for me on 1.12 with 5.5.1p4, (as does switching off single-pass stereo).
I will check that in 8 hours after my job
Doc Link
I noticed the texture was moving on the object between draws in the same frame. When I created a variant of the two, I could toggle the effect. I then saw a higher accuracy when using UnityObjectToClipPos (expected vs actual points) when drawing a cube.
As an added bonus, the vert shader for d3d11 uses 8 ops vs 20 ops when using mul, meaning better performance. Even better, this allows the (unnecessary in this case but enabled by default) d3d9/d3d11_9x variants to compile successfully.
For me, this works for all the exceptions listed in this thread using Avatar SDK 1.12.0 in both Unity 5.5.2p2 and Unity 5.6.0b11.
For me, this caused some other artifacts in the Unity Game view and the flickering wasn't completely squashed. But adding Offset 1,1 gets rid of the flickering with single-pass stereo for me. Unity 5.4.4f1 with Avatar 1.12.
Getting the perf gains from switching to UnityObjectToClipPos is great, I'm just saying it didn't fix the z-fighting for me.
As for backtracking, yay for friends like source control and text diffs. Good luck!