cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] Weird flickering with Avatars SDK mesh

hyperion337
Explorer
Just started messing with the Avatar SDK and I'm getting weird mesh flickering. Check out the gif. What am I screwing up?

rvjhuwnz12dx.gif
35 REPLIES 35

ColdSpike
Explorer


@ColdSpike, does if work if you use `Offset 1, 1` instead of `Offset 0.1, 1`?


Fixed by updating to a stable Unity release. Sorry I'm not sure what the problem was.

paw9k
Protege

cubic9com said:

I found that AvatarSurfaceShaderPBS.shader might cause this.
So I did a rough workaround.
I added following code at OvrAvatarRenderComponent.cs:75
shaderPath = "OvrAvatar/AvatarSurfaceShader";
There might be a little more better workaround...


This fixed it for me.  Switching off of Single pass to Multi pass did not fix it.  I was on 5.5.1f1

chrisnolet
Explorer
I tried that, too, but I noticed that the meshes were no longer self-occluding. (I could see my fingers through my hands.)

Yoirgl
Expert Protege
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.
http://unwise.software/

chrisnolet
Explorer
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).

Yoirgl
Expert Protege


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.
http://unwise.software/

BlastoIO
Explorer
Try changing the two occurrences of mul(UNITY_MATRIX_MVP, v.vertex) to UnityObjectToClipPos(v.vertex)

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.

Yoirgl
Expert Protege

BlastoIO said:

Try changing the two occurrences of mul(UNITY_MATRIX_MVP, v.vertex) to UnityObjectToClipPos(v.vertex)

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.


Thank you for this elegant and very effective solution. this fixed my problem instantly 🙂

http://unwise.software/

chrisnolet
Explorer
Elegant! Works for me, too 🙂 I think I like this solution the best.

Anonymous
Not applicable

BlastoIO said:

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.