Discs in 3D Perspective - The thickness of a disc (in pixels) is not consistent when that discs orientation is not directly parallel to the camera's orientation

Avatar
  • updated
  • Answered
Preface

The following issue falls somewhere between a feature request and a question - my apologies in advance for any misclassification of this topic. In addition, I was not able to find any other topics that fit my issue / use case.

The Issue

The closer a disc's normal is to being perpendicular to the camera's normal, the less 'accurate' the disc's thickness becomes. Conversely, when in billboard mode or when the normals of the disc and camera are closer to being parallel the disc's change in thickness due to camera perspective is not visible. This issue occurs regardless of thickness mode (meters, pixels, noots) and scale mode (uniform, coordinate).  Please see the image below for a visual of the issue:

Visual of five discs with different orientations and radiiNote: All five discs have the same settings with the exception of the radius and rotation properties. One of the rings is at a billboard orientation but is drawn with Flat 2D geometry to show the difference of the thickness of each disc.

The discs in the image use the Disc component and have the following properties:

  • Type: Ring/Annulus
  • Scale Mode: Uniform
  • Geometry: Flat 2D
  • Thickness: 2 pixels
  • Radius: The value is different for each disc, but all radii use the meters unit

Given how the disc is implemented (as a quad according to the documentation) the issue I have described is much more of a limitation of the implementation as opposed to a bug. At the core of the issue is, of course, a misunderstanding on my part: I used the disc component for something it was not built for and assumed that the underlying component logic & shader magic would solve my problem.

The Use Case

For this project I want to draw simplistic orbitals of various entities orbiting the Earth. Ideally an orbital would be a ring whose thickness would be determined in pixels - invariant to the perspective of the camera. In addition, this project requires a consistent appearance of these orbitals as the camera moves - the camera will be close to the surface of the Earth (zoomed in on an entity) at times as well as *much* farther away from the Earth to show all of the orbitals. 

The Question

What approach would be recommended to get around this limitation?


I have considered mimicking the spline approach mentioned here, however, there would need to be a significant investment of time and resources to insure that interpolation would work at all of the various 'zoom levels' that my use case requires.

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

The disc is fundamentally a flat object yeah!

if you want a line drawn in the shape of a circle, I recommend using a closed billboarded polyline with pixel based thickness and simple joins! That way it should behave the way you expect it to

Avatar
Freya Holmér creator
  • Answer
  • Answered

The disc is fundamentally a flat object yeah!

if you want a line drawn in the shape of a circle, I recommend using a closed billboarded polyline with pixel based thickness and simple joins! That way it should behave the way you expect it to