Scaling shapes is inconsistent and undefined

Avatar
  • updated
  • Fixed

Currently, there is an overarching issue where many coordinates and thickness units, don't properly respond to scaling a transform.

This also has several side effects, such as pixel thinness fading can kick in way too early, because the pixel sizing detection didn't properly take scale into account, or just being inconsistent in general between say, polylines and lines

There are several routes I can go here, but after lots of thinking I think what makes most sense is to have a per-object scaling method, so, this is my proposal:

  • Coordinate Scaling
    • Thickness values are unaffected by scale (regardless of meter vs pixel vs noot units)
    • a line with a thickness of 1 and a scale of 0.5:
      • endpoint locations will scale/move as a result of scaling
      • thickness remains at 1
    • a ring with radius 1, thickness of 0.2 and scale 0.5:
      • effective radius of 0.5
      • thickness remains at 0.2
  • Uniform Scaling
    • Thickness values are affected by scale (regardless of meter vs pixel vs noot units)
    • a line with a thickness of 1 and a scale of 0.5:
      • endpoint locations will scale/move as a result of scaling
      • effective thickness scaled to 0.5
    • a ring with radius 1, thickness of 0.2 and scale 0.5:
      • effective radius of 0.5
      • effective thickness scaled to 0.1

I believe this is the best way to go. A per-property setting for this would be possible, but cause a lot of clutter in the shader code (and UI) as well as a massive amount of shader property bloat. I also considered having "world space meters" as a distinct thing from "local space meters" but, then there's no way to "scale away" pixel-sized things, which I think would be useful, without adding some weird units like local space pixels (whatever the heck that means. although, local noots sounds real cute~)

oh, and, in immediate mode, this will be a static field and not part of any of the overloads

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Fixed

well, looked into this today, and, it's implemented now!

Avatar
Freya Holmér creator
  • Planned
Avatar

I put rectangle and line in gameobject(named 'ShapeContainer') and duplicate it. When I change the scale of one 'ShapeContainer', the thickness of rectangle changed, but the one of line doesn't change.

This behavior comes from this issue?

Avatar
Freya Holmér creator

yeah, this is one of the consequences of this issue!

Avatar

I got it. Do u have an approximate plan when you'll fix this?
I'm planning to use Shapes for ui in VR/AR in the future, but not now.  

Avatar
Freya Holmér creator

it depends on priority! feel free to vote on this issue to bump it up a little :)

Avatar
Freya Holmér creator
  • Answer
  • Fixed

well, looked into this today, and, it's implemented now!