Inconsistent dash sizes on Quest device

Avatar
  • updated
  • Under Review

I'm seeing a bit of strange different behavior between the Unity Editor and the Quest 1 device with dashed Discs in 3D space. Wondering if it's a bug, or if I've missed some important setting?


Pic of the expected behavior (in-editor):

Image 376

Pic of what happens on device. I spent a while tweaking things to minimise the effect, but this is the best I came up with:

Image 377

Snap of the component from the editor:

Image 375

Thanks for an excellent plugin, by the way. Should be a part of Unity in my opinion! This game literally would not be possible without it.

Reporting a bug? please specify Unity version:
2020.2.1f1
Reporting a bug? please specify Shapes version:
Shapes 3.2.3
Reporting a bug? please specify Render Pipeline:
URP
Avatar
Freya Holmér creator
  • Under Review

this is very likely due to half vs float precision issues that I can't see when developing on PC

I can look into it! if you want to experiment on your own and you know a thing or two about shaders, then changing some of the variables relating to dash coordinates in disc core.cginc from half precision to float precision should fix this.

does it happen to other dashed shapes as well? (lines, arcs)

Avatar
Chris Underwood

Thanks for the ultra-prompt reply! Amazing customer service.


I'm no shader genius, but I dabble a bit. I'm comfy with code in general, so I'll have a play and see if I can get some clues. If I make a total mess, there's always git revert!

I haven't seen it happen on other shapes, but not many of the other shapes in the project are as big or as dashed. I'll do some experiments and report back...

Avatar
Freya Holmér creator
Quote from Chris Underwood

Thanks for the ultra-prompt reply! Amazing customer service.


I'm no shader genius, but I dabble a bit. I'm comfy with code in general, so I'll have a play and see if I can get some clues. If I make a total mess, there's always git revert!

I haven't seen it happen on other shapes, but not many of the other shapes in the project are as big or as dashed. I'll do some experiments and report back...

I *really* wish I could debug this on PC, but all low precision floats are silently converted to high precision float, so it's easy to miss these unfortunately :c

Avatar
Chris Underwood

Working with mobile devices is always tricky. Even the round-trip build/deploy/load/test delays work against you. I've been experimenting for a few hours now, here's what I've learnt.


I made some half-to-float changes in the code to everything I thought could affect it. Broke it all! Reverted changes until it went from broken magenta back to working orange. Didn't help at all on the device though.

Experimented with other shapes. Lines seem to work fine with the same type of dashes. Arcs do as well, until they get large. 90deg works fine (which is a valid workaround for this project), but as you increase it to larger angles it seems to get more corrupted towards the end:

Here's a close-up 1:1 image of the pattern near the end of a 270deg arc. I was knelt down with my head close to the floor to capture this shot. I can literally say this project has reduced me to my knees!

Given what you said, I think you're right about it being a precision thing. Something where the error accumulates over a long run, and aliases against the dash size/amount. It does also suggest really long lines with hundreds of dashes might be affected too. I can run a test tomorrow if you want.

Anyway, my problem is fixed by a simple design rethink, so don't stress about fixing it for my sake.


By the way, do you have a preferred way to be mentioned in the credits?

Avatar
Freya Holmér creator

try going to DiscCore.cginc line 270, and change tAngularFull and ang to float instead of half. edit: also tAngular

as for crediting, thanks for doing that! Freya "Acegikmo" Holmér would work fine if you use nicks! otherwise just Freya Holmér :)

Avatar
Chris Underwood

It all went pink again (those are the same errors I had before when I tried)...

Avatar
Freya Holmér creator

also change this 

Avatar
Chris Underwood

Done, but still the same errors:

Avatar
Freya Holmér creator

ah yep I hate C syntax. also Unity wasn't showing me these errors for some reason. anyway uh more things to try, note filename at the top:


Avatar
Chris Underwood

Sorry Freya, I did all the requested changes but it still has errors. I couldn't see Core.cginc (note: not Disc Core.cginc) anywhere in my project files. I'm guessing that's something Unity just has and provides kinda invisibly?

Avatar
Chris Underwood

I was thinking about why the errors weren't showing up for you this morning, when it struck me: Perhaps you're building for PC standalone. The Quest is basically an Android device underneath. Did a quick test on my Pixel XL phone and it exhibits the same behavior. Lines are affected too, but a little differently:


Very simple project available here:

https://www.dropbox.com/s/m474qyi58reauw3/ShapesTest.zip?dl=1

This is with the unmodified version of Shapes. Might be a way you can debug it for yourself though. I'm guessing you have many typical Android devices for testing etc.