Polyline and Circle components are not rendering, Line components rendering with increased thickness in WebGL builds;

Avatar
  • updated
  • Unity's Fault

Although everything on my end runs correctly in the editor and other builds (tested MacOS native), WebGL builds seem to have issues with Line, Polyline, and Circle components.  For Line components, the thickness renders larger in WebGL; for Polyline and Circle components, the shapes do not render at all in WebGL.

Here is a demo of a scene with Shape components (the MacOS test build displays the scene identically):

Image 59


This is the result for the corresponding WebGL build:

Image 61


The above demo has 7 top-level GameObjects with Shapes components (from top left: Line, Polyline, Circle, Rectangle, Triangle, Quad, Polygon).  The first three components have been colored (although their issues still exist irrespective of color).

Reporting a bug? please specify Unity version:
2020.1.2f1
Reporting a bug? please specify Shapes version:
2.2.0
Reporting a bug? please specify Render Pipeline:
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Unity's Fault

this is a Unity bug, and everything should work as long as you use 2019.4.10 or later! which version did you test it on last?

Avatar
Freya Holmér creator

I feel like there has to be some sort of error coming out of this on build or on compile. Are they the same as the above or did this latest one come out clean?

Avatar
Rahil Patel

Built-in render pipeline; it doesn't work in a clean project.  Here's a new screenshot of a clean project with the Shapes demo (seems to look the same as the first screenshot I shared of the demo scene).

Avatar
Freya Holmér creator
Quote from Rahil Patel

I've tested it on 2020.2.13 and 2020.1.11 - no luck unfortunately  

what render pipeline are you using? and does it work in a clean project?

Avatar
Rahil Patel

I've tested it on 2020.2.13 and 2020.1.11 - no luck unfortunately  

Avatar
Freya Holmér creator
  • Answer
  • Unity's Fault

this is a Unity bug, and everything should work as long as you use 2019.4.10 or later! which version did you test it on last?

Avatar
Rahil Patel

Hi there, I got the chance to try out that hotfix. 

Unfortunately, I'm still having the same three issues - i.e. Lines are rendered with a much larger width, Polylines and Disc are not rendered at all.  

Avatar
Freya Holmér creator

hey! sorry for the late response, I've been trying to hunt down these compiler issues for a while now!

Can you try the hotfix outlined in this thread, and let me know if it works?

https://shapes.userecho.com/communities/1/topics/70-windows-build-error-with-webgl

Avatar
Rahil Patel

All of the projects I've tested have been using the built-in pipeline.  

Here are the runtime logs with Log Shader Compilation enabled in a Development Mode build for versions:

2020.1.3f1
2019.3.0f5


For 2020.1.3f1 (and 2020.1.2f1), there are no error logs resulting from the build (only "Build completed with a result of 'Succeeded'").

For 2019.3.0f5 with the Auto Graphics API disabled (and only WebGL 2.0 selected), there are no error logs resulting from the build.

For 2019.3.0f5 with Auto Graphics API enabled, here is the log resulting from a build:

Shader compiler: Compile Shapes/Polyline 2D Multiplicative - Pass 0, Vertex Program: Internal error communicating with the shader compiler process.  Please report a bug including this shader and the editor log.
0 Unity 0x000000010768fb49 _Z13GetStacktracei + 89
1 Unity 0x0000000109fe8cc6 _Z17DebugStringToFileRK21DebugStringToFileData + 342
2 Unity 0x0000000109fe6c95 _Z20AssertImplementationiPKciiS0_ + 117
3 Unity 0x000000010745a814 _ZL24LogShaderCompilerFailurePKcS0_S0_S0_S0_ + 100
4 Unity 0x000000010745fc3f _Z28ShaderCompilerCompileSnippetRP24ShaderCompilerConnectionRKN4core12basic_stringIcNS2_20StringStorageDefaultIcEEEES8_S8_iS8_PS7_ii21CompileSnippetOptionsR13dynamic_arrayIhLm0EER20ShaderGpuProgramType20ShaderSourceLanguage21ShaderCompilerProgramj22ShaderCompilerPlatform18ShaderRequirementsP30ShaderCompilerReflectionReportPFvPv16CgBatchErrorTypeiiPKcSP_ESM_ + 5455
5 Unity 0x0000000108c416f7 _Z20CompileShaderSnippetP6ShaderRK13ShaderSnippet10ShaderTypeRKN4core12basic_stringIcNS5_20StringStorageDefaultIcEEEE14ShaderPassTypej18ShaderRequirementsRK16ShaderKeywordSetRK12fixed_bitsetILi28EjE22ShaderCompilerPlatform + 2071
6 Unity 0x0000000108c41f78 _Z39GetSerializedSubProgramForShaderSnippetP6ShaderRK13ShaderSnippet10ShaderTypeRKN4core12basic_stringIcNS5_20StringStorageDefaultIcEEEE14ShaderPassTypejRK16ShaderKeywordSetRK12fixed_bitsetILi28EjE20BuildTargetSelection22ShaderCompilerPlatformb18ShaderRequirementsRbSN_R7Hash128b10MemLabelId + 792
7 Unity 0x00000001069fda7d _ZL17CompileSnippetJobP21SnippetCompileJobDataj + 621
8 Unity 0x00000001089b1ab0 _ZN8JobQueue4ExecEP7JobInfoxi + 240
9 Unity 0x00000001089b2395 _ZN8JobQueue11ProcessJobsEPNS_10ThreadInfoEPv + 485
10 Unity 0x00000001089b10c3 _ZN8JobQueue8WorkLoopEPv + 179
11 Unity 0x0000000108fda3ec _ZN6Thread16RunThreadWrapperEPv + 1228
12 libsystem_pthread.dylib 0x00007fff689e89b4 _pthread_start + 224
13 libsystem_pthread.dylib 0x00007fff689e44d7 thread_start + 15

Furthermore, following this build, of the shader files in Shapes/Shaders/'Generated Shaders'/Resources, the error...

Internal error communicating with the shader compiler process.  Please report a bug including this shader and the editor log.

...is shown in the Inspector for the following:

  • Cone Additive
  • Disc Multiplicative
  • Disc Transparent
  • Line 2D Opaque
  • Line 3D Multiplicative
  • Line 3D Opaque

  • Line 3D Transparent

  • Polygon Opaque

  • Polygon Transparent

  • Polyline 2D Additive
  • Polyline 2D Multiplicative
  • Polyline 2D Opaque
  • Polyline 2D Transparent
  • Quad Multiplicative
  • Quad Transparent
  • Rect Opaque
  • Rect Transparent
  • Sphere Additive
  • Sphere Multiplicative
  • Sphere Transparent
  • Torus Additive
  • Torus Transparent
  • Triangle Additive
  • Triangle Transparent

Despite receiving these errors, the build works as expected in WebGL 1.0 (OpenGLES 2.0); here is the test result for Safari (which doesn't support WebGL 2.0 without an experimental flag enabled):


It's very unusual that the shaders work for the WebGL 1.0 fallback and not for WebGL 2.0, since WebGL 1.0 is supposed to be more restrictive with shaders.  It's also unusual that the build errors only show when WebGL 1.0 is included (using Auto Graphics API), although WebGL 1.0 has no apparent issues rendering Shapes, whereas WebGL 2.0 does.

Here are my Unity 2020.1.3f1 project settings, in case it helps replicating the issue.

Avatar
Freya Holmér creator

I feel like there has to be an error or a warning somewhere in some of the logs if they simply don't render at all, either the editor log on build or at runtime. are you sure those are clean?

also is this built-in pipeline, URP or HDRP?

Avatar
Rahil Patel

I tried it out with WebGL 2.0 only (initially had the Auto Graphics API setting selected) but still ended up with the same result.  I'm not seeing any compiler errors on my end in either case. 


For my main project, I'm not using Line components, so my main concern is understanding what might be going wrong with the Polyline / Disc components.

That said, Cuboid, Sphere, and Cone are also not rendering in the WebGL builds on my end (shown in above screenshot).  I wonder if there is some shared characteristic in the shaders for Polyline, Disc, Cuboid, Sphere, and Cone.

Avatar
Freya Holmér creator

just made a build targeting WebGL 2.0 in the shapes gallery scene, and everything works fine

I did, however run into internal compiler errors, unless i went to player settings and made sure it only targeted WebGL 2.0. does that fix it on your end?

Avatar
Rahil Patel

For added context, I've only been testing with WebGL 2.0.  I'm suspecting the issue might have to do something with one of these limitations:
https://docs.unity3d.com/2020.2/Documentation/Manual/webgl-graphics.html

Avatar
Rahil Patel

Yep - the camera parameters are the same (also the display resolution is set to 2:1 in both the editor and WebGL build).

In my main project, I'm not using Line components, but it caught my attention when Polyline and Disc components weren't showing up.  There have been no compiler or runtime errors at all.

Avatar
Freya Holmér creator

that's super weird... are the camera parameters the same? like if you place a Unity cube scaled to 0.125 next to that line, does it match the line or does it stay the same across both editor and builds?

as for the disc and polyline issues - did you get any shader compiler errors on build?

Avatar
Rahil Patel

In the pictures above, everything is set to meters.

I've just tried all three (meters, pixels, and noots).  For Polyline and Disc, there is still nothing rendered for any of the thickness spaces.

Demo for Line in editor:


Demo for Line in WebGL build:

Avatar
Freya Holmér creator
  • Under Review

weird!
what thickness space are you using for the polyline, line and disc radius?
also, if you try and build the shapes gallery scene, do you get the same issue?