Torus doesn't render at camera's position

  • updated

Test scene is just a default 3D scene with this script attached to the camera:

using UnityEngine;
using Shapes;

public class ShapesTest : ImmediateModeShapeDrawer {
    public bool AddOffset = true;
    public bool UseLocalSpace = true;
    public override void DrawShapes( Camera cam ) {
        using( Shapes.Draw.Command( cam ) ) {
            Shapes.Draw.LineGeometry = LineGeometry.Volumetric3D;
            Shapes.Draw.ThicknessSpace = ThicknessSpace.Meters;
            var r = 5f;
            var th = 0.25f;
            if( UseLocalSpace ) {
                Shapes.Draw.Matrix = transform.localToWorldMatrix;
                var position = AddOffset
                            ? Vector3.forward*0.0001f
                var color = AddOffset ? : Color.cyan;
                Shapes.Draw.Torus( position, Vector3.up, r, th, color );
            else {
                Shapes.Draw.Matrix = Matrix4x4.identity;
                var position = AddOffset
                            ? transform.position + Vector3.forward*0.0001f
                            : transform.position;
                var color = AddOffset ? : Color.magenta;
                Shapes.Draw.Torus( position, Vector3.up, r, th, color );

When "AddOffset" is true, the torus draws, the desired effect is achieved - camera is inside the torus' centre.
When "AddOffset" is false, torus is not drawn - which to me feels like a bug? I can't blame the camera's culling volume on it - the offset is way smaller than camera's default NearClipPlane of 0.3.
Changing the drawing space has no effect on the behavior.

It's not super-critical for my case, I can live with a workaround, but feels fishy, maybe worth investigating.

Shapes rock!

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline