RegularPolygon shader appears to be broken

  • updated
  • Fixed

Hi Freya! I imported the latest Shapes package into a clean 2020.1.5f1 project on OSX and the regular polygon objects appear to have broken shaders. I tried switching between Metal and OpenGL to see if that was the issue, but there was no change. 

Reporting a bug? please specify Unity version:
2020.1.5f1
Reporting a bug? please specify Shapes version:
2.3.0
Pinned replies
Freya Holmér
  • Answer
  • Fixed

I think I might have tracked down the issue with the regular polygon specifically now. it looks like it had too many interpolators, and after my optimization pass yesterday it seems to compile just fine with fewer interpolators now that I tried it on my mac

however - there are still other compilation issues that haunt all the shaders, especially on mac, that seem to throw errors and yet work? or, sometimes the shader compiler gets stuck and stops working entirely

I'm marking this as fixed, because the regular polygons themselves seem to work, but yeah, the other issues may still be happening, but there are other threads open for those issues, and I'm still looking into those

Freya Holmér
  • Under Review

it looks like there's an unknown compiler crash issue on metal (and I guess OpenGL too). I've been trying to track down the cause of this all day with no success I'm afraid :(
I've sent a bug report to Unity, hopefully they can help out with this

Duck Hee

I have same problem.

macOS Catalina

Unity 2019.4.2.f1

Shapes 2.3.0

Freya Holmér

I think I might have a lead on why this is happening. Shapes has special passes to make scene view selection work, and it looks like these are somehow interfering with the shader compiler process

so here's a workaround, that disables the scene view picking passes (so, doing this will make selection really annoying), but I believe this will make it compile

go to ShaderBuilder.cs
at line 70 and 71, you should see:

AppendPass( ShaderPassType.Picking, rp );
AppendPass( ShaderPassType.Selection, rp );
  1. remove or comment out those lines
  2. recompile scripts
  3. go to Shapes -> Advanced -> Regenerate Shaders & Materials
  4. go to Assets -> Reimport All

let me know if that makes it work again!

again - selection will be broken if you do this, but I'm currently talking to Unity to see if we can come up with a proper way to solve this!

Script Mage

I was just about to report a similar problem but for WebGL, I can make a separate post for it if you would prefer that, but I suspect it is the same problem.

Regular polygons turn into pink squares in the release build. It does work as fine in the editor.

I did try the fix of deleting the AppendPass (Picking and Selection) and rebuilding, regenerating and re-importing. It did not seem to fix the problem in my case.

The console in the build reported these errors:

Unity version: 2020.1.4f1 (using URP)

Shapes version: 2.3.0

Duck Hee

Hi. Freya,

I have executed step 4 you mentioned, but the problem is still not solved.

But in my case, there was no error.

Thanks for your attention.

macOS Catalina

Unity 2019.4.2.f1 (built-in RP)

Shapes 2.3.0

Freya Holmér
Quote from Duck Hee

Hi. Freya,

I have executed step 4 you mentioned, but the problem is still not solved.

But in my case, there was no error.

Thanks for your attention.

macOS Catalina

Unity 2019.4.2.f1 (built-in RP)

Shapes 2.3.0

did you do the other steps too or just step 4?

Duck Hee
Quote from Freya Holmér

did you do the other steps too or just step 4?

Oh. Sorry.  

I did all steps. Modify src, compile, regenerate and re-import.

Freya Holmér
Quote from Duck Hee

Oh. Sorry.  

I did all steps. Modify src, compile, regenerate and re-import.

hm, okay, thanks! looks like this might be unrelated to the android/ios/webgl shader issues then, I'll keep looking into it, sorry the hassle :c

Freya Holmér
  • Answer
  • Fixed

I think I might have tracked down the issue with the regular polygon specifically now. it looks like it had too many interpolators, and after my optimization pass yesterday it seems to compile just fine with fewer interpolators now that I tried it on my mac

however - there are still other compilation issues that haunt all the shaders, especially on mac, that seem to throw errors and yet work? or, sometimes the shader compiler gets stuck and stops working entirely

I'm marking this as fixed, because the regular polygons themselves seem to work, but yeah, the other issues may still be happening, but there are other threads open for those issues, and I'm still looking into those

Duck Hee

This issue does not occur with version 2.3.1

Thank you. Freya.

Freya Holmér
Quote from Duck Hee

This issue does not occur with version 2.3.1

Thank you. Freya.

I'm glad it worked out!

Script Mage

I just wanna add that, as suspected, it now also works in the WebGL build that I mentioned earlier.

Great work as always!