Android default VFX Graph vertical lines issue

I have this weird vertical lines on my Xiaomi MI Max (Android 7.0) with default VFX Graph (which you get by simply doing "Create" -> "Visual Effects" -> "Visual Effects Graph", no modifications at all). What could be the issue? URP project, image attached. In editor everything is working fine.
Unity: 2019.3.9f1
Visual Effects Graph: 7.3.1
5774080--608686--photo_2020-04-28_02-47-25.jpg

Hello,
Indeed, this is a really annoying known issue with GLES 3.1 on Android devices, we have temporarily closed the case but we are still working on mobile & URP integration of the Visual Effect Graph.
You can also take a look at this thread.

Ah... I was just coming around to post about this too! Seems that on Oculus Quest, Output Particle Quads get stretched infinitely on the positive vertical axis.

I just submitted a bug report, but I guess this issue is more or less well known. Any chance I would have better luck trying it with 2020.1?

As far as I know, this bug hasn't been fixed in 2020.1 yet. It's an issue only on GLES 3.1, if you are using an Oculus Quest, you can potentially switch to Vulkan.

At the moment, Vulkan seems to come with its own set of problems :/. Any idea how long it may be before we see a fix for this?

We came across this problem when we tried VFX on Android.
Here is the solution we found just in case anyone else may suffer from the same thing.

We found that [OutputParticleMesh] works fine and [OutputParticleQuad] has some vertical issue on OpenGL ES 3.X.
Then we used RenderDoc and captured some frames and noticed some expressions in shader was translated into something that GLES does not support.
In files Path: ~/com.unity.visualeffectgraph/Shaders/ParticlePlanarPrimitives/PassGS.template & PassVS.template, the expression
o.VFX_VARYING_UV.y = float((id & 2) >> 1); has been translated to u_xlatu0.z = bitfieldExtract(uint(gl_VertexID), 1, 1); in GLSL, while bitfieldExtract is not supported by OpenGL ES 3.0. See links below.
__ https://discussions.unity.com/t/768007/1 __

So we simply replaced these expressions in templates and everything works fine ~~~

1 Like

[quote=“fredfu”, post:6, topic: 787976]
We came across this problem when we tried VFX on Android.
Here is the solution we found just in case anyone else may suffer from the same thing.

We found that [OutputParticleMesh] works fine and [OutputParticleQuad] has some vertical issue on OpenGL ES 3.X.
Then we used RenderDoc and captured some frames and noticed some expressions in shader was translated into something that GLES does not support.
In files Path: ~/com.unity.visualeffectgraph/Shaders/ParticlePlanarPrimitives/PassGS.template & PassVS.template, the expression
o.VFX_VARYING_UV.y = float((id & 2) >> 1); has been translated to u_xlatu0.z = bitfieldExtract(uint(gl_VertexID), 1, 1); in GLSL, while bitfieldExtract is not supported by OpenGL ES 3.0. See links below.
__ https://discussions.unity.com/t/768007/1 __

So we simply replaced these expressions in templates and everything works fine ~~~
[/quote]

Hello @fredfu ,

It’s an efficient debug, you correctly have spotted the root cause of these vertical lines.

The behavior of *bitfieldExtract *is indeed the root cause but the VisualEffect are relying on compute shader support, thus, we should already run these vertex shader using GLES 3.1. Apparently, bitfieldExtract doesn’t behave as expected on all devices. Your change will fix planar (e.g. Quad) primitive output, there are actually several places where this instruction can be used or even generated from the graph compilation.

We have temporarily closed this case to avoid anyone waiting for this specific fix but we are still working on the correct integration of mobile devices. We already have identified some unexpected driver/hardware behaviors and we are working on these issues.

For now, the package manager UI does not offer the granularity of specifying preview status per SRP for the VFX package : the VFX Graph is fully supported with HDRP-only (and HDRP supported platform) at the moment. See this thread .

Thanks for your report !

1 Like

@fredfu Not quite clear what you replaced that expression with to get around the issue. Would you mind sharing?


Hi, Barliesque
Replace these lines in the files mentioned above:
o.VFX_VARYING_UV.x = float(id & 1);
o.VFX_VARYING_UV.y = float((id & 2) >> 1);
to
o.VFX_VARYING_UV.x = float(id & 1);
o.VFX_VARYING_UV.y = float(id & 2);
o.VFX_VARYING_UV.y = o.VFX_VARYING_UV.y / 2f;

or some expression that get the second bit of value id.

But this replacements do work on Android OpenGL platform only with the simplest VFX example, just as PaulDemeulenaere said , there exists other places use this expression too. So maybe we could have some patience and confidence on Unity's VFX team, or limit graphic settings to Vulkan as we currently do.

Ahhh, I see. I'd tried replacing the shift right with a division, but that had no effect. So the trick is to break the operation into two lines to keep the compiler from detecting something it can convert to using bitfieldExtract.

And indeed, that is working. Thank you!

The project I'm working on is actually for Quest 2, so Vulkan is not an option. So, given this project would never be released publicly, and particularly since it's targeting one specific piece of hardware, I'm thinking I might be able to get away with using VFX Graph for some fancy particle effects I couldn't pull off with Shuriken. Does that sound crazy?

1 Like

Wow these few lines not only fixed my infinite stretch issue but also greatly increased the performance on the Quest 1. While previously I've had weird fps drops below 40 when looking down at the origin now it works smoothly at stable 72 fps. I really hope unity fixes this soon at least for VR devices.

Thanks for the fix @fredfu !

@PaulDemeulenaere @fredfu @Desoxi
Not sure what's happened, but the Package Manager is now aggressively overwriting my changes to those template files. Is there any way to stop that from happening? Was there a behind-the-scenes update to the Package Manager to ensure packages aren't modified?


Is your package in the Library/PackageCache folder of your project? If so, I believe you might need to move it to your Packages folder (at the same level with Assets and Library) to modify it.

@VladVNeykov
Ah ha! Yes, that solved it. I hadn't realized you could move packages from the cache into that folder. Strange I was able to get away with changes to the cache version for so long!

Thanks for the fix Vlad!

1 Like

Tried the @fredfu solution, didn't work for me, in the player settings we set to Vulkan first and second to OpenGLES3
My Android (Oneplus7Pro) works fine
My Partner old Android LG-V20 has lines
SAMSUNG A71 works fine
Tried to replace the order when OpenGL is first and Vulkan is second, it made it appear on my android as well.
Using Unity 2019.3.14f URP
We saw that Google is supporting Android API 27 which is higher then the old versions that not support the Vulkan, so we in the clear, but still wanted to make sure if we are going to encounter problems from clients.

Since Vulkan support isn't ready for Quest I've removed it from the list entirely; I'm using minimum Android API level 24. I had success applying fredfu's solution to Visual Effect Graph v.8.2.0
Given you're having mixed results on different Android devices, my guess would be removing Vulkan might work for you.

I can't find the discussion where this was brought up, but the fix is to use a Mesh emitter, instead of Quads, or in my case a Cube emmitter. The thread seemed to say nothing works except for a Mesh emitter right now. I just selected a Cube in the Mesh emitter and this went away.

1 Like

This same issue happened with me also, then I tried all the solutions mentioned in this post to fix Vertical Lines. It really worked for me. Thanks a lot!


Thanks
how did you do it

环境:安卓 +URP+ VFX
我遇到了相同的问题,有绿线。。。