

Unityで開発を行っております。  
LineRendererのような処理で円柱を並べて3D放物線を描画しております。

[code]

    [SerializeField] Vector3[] _positions;
    [SerializeField] int _sides = 3;
    [SerializeField] float _radius = 2;
    
    private void GenerateMesh()
    {
        if (_mesh == null || _positions == null || _positions.Length <= 1)
        {
            _mesh = new Mesh();
            return;
        }
    
        var verticesLength = _sides*_positions.Length;
        if (_vertices == null || _vertices.Length != verticesLength)
        {
            _vertices = new Vector3[verticesLength];
    
            var indices = GenerateIndices();
            var uvs = GenerateUVs();
    
            if (verticesLength > _mesh.vertexCount)
            {
                _mesh.vertices = _vertices;
                _mesh.triangles = indices;
                _mesh.uv = uvs;
            }
            else
            {
                _mesh.triangles = indices;
                _mesh.vertices = _vertices;
                _mesh.uv = uvs;
            }
        }
    
        var currentVertIndex = 0;
    
        for (int i = 0; i < _positions.Length; i++)
        {
            var circle = CalculateCircle(i);
            foreach (var vertex in circle)
            {
                _vertices[currentVertIndex++] = vertex;
            }
        }
    
        _mesh.vertices = _vertices;
        _mesh.RecalculateNormals();
        _mesh.RecalculateBounds();
    
        _meshFilter.mesh = _mesh;
    }
    
    private Vector2[] GenerateUVs()
    {
        var uvs = new Vector2[_positions.Length*_sides];
    
        for (int segment = 0; segment < _positions.Length; segment++)
        {
            for (int side = 0; side < _sides; side++)
            {
                var vertIndex = (segment * _sides + side);
                var u = side/(_sides-1f);
                var v = segment/(_positions.Length-1f);
    
                uvs[vertIndex] = new Vector2(u, v);
            }
        }
    
        return uvs;
    }
    
    private int[] GenerateIndices()
    {
        // Two triangles and 3 vertices
        var indices = new int[_positions.Length*_sides*2*3];
    
        var currentIndicesIndex = 0;
        for (int segment = 1; segment < _positions.Length; segment++)
        {
            for (int side = 0; side < _sides; side++)
            {
                var vertIndex = (segment*_sides + side);
                var prevVertIndex = vertIndex - _sides;
    
                // Triangle one
                indices[currentIndicesIndex++] = prevVertIndex;
                indices[currentIndicesIndex++] = (side == _sides - 1) ? (vertIndex - (_sides - 1)) : (vertIndex + 1);
                indices[currentIndicesIndex++] = vertIndex;
                
    
                // Triangle two
                indices[currentIndicesIndex++] = (side == _sides - 1) ? (prevVertIndex - (_sides - 1)) : (prevVertIndex + 1);
                indices[currentIndicesIndex++] = (side == _sides - 1) ? (vertIndex - (_sides - 1)) : (vertIndex + 1);
                indices[currentIndicesIndex++] = prevVertIndex;
            }
        }
    
        return indices;
    }
    
    private Vector3[] CalculateCircle(int index)
    {
        var dirCount = 0;
        var forward = Vector3.zero;
    
        // If not first index
        if (index > 0)
        {
            forward += (_positions[index] - _positions[index - 1]).normalized;
            dirCount++;
        }
    
        // If not last index
        if (index < _positions.Length-1)
        {
            forward += (_positions[index + 1] - _positions[index]).normalized;
            dirCount++;
        }
    
        // Forward is the average of the connecting edges directions
        forward = (forward/dirCount).normalized;
        var side = Vector3.Cross(forward, forward+new Vector3(.123564f, .34675f, .756892f)).normalized;
        var up = Vector3.Cross(forward, side).normalized;
    
        var circle = new Vector3[_sides];
        var angle = 0f;
        var angleStep = (2*Mathf.PI)/_sides;
    
        var t = index / (_positions.Length-1f);
        var radius = _radius;
    
        for (int i = 0; i < _sides; i++)
        {
            var x = Mathf.Cos(angle);
            var y = Mathf.Sin(angle);
    
            circle[i] = _positions[index] + side*x* radius + up*y* radius;
    
            angle += angleStep;
        }
    
        return circle;
    }
    
[/code]

しかし、表示を行うとジャギーが大変ひどく滑らかに表示されません。  
「PostProcessLayer」の設定を行っているのですが、解決できておりません。

こちら、3D放物線を滑らかに表示するにはどのようにしたらよろしいかご存じでしょうか。

よろしくお願い致します。

[![画像の説明をここに入力](https://i.stack.imgur.com/1u7Rc.png)](https://i.stack.imgur.com/1u7Rc.png)

[![画像の説明をここに入力](https://i.stack.imgur.com/7U4rc.png)](https://i.stack.imgur.com/7U4rc.png)


CC BY-SA 4.0
2020-10-30T02:10:24.260
71607
2020-10-30T06:59:18.993
29606
question
unity3d
滑らかな3D放物線を描画したい


警告の通り、Quality設定されていないためMSAAが機能していないようです。

試していませんが、以下のような設定が必要なようです。([参考](https://light11.hatenadiary.com/entry/2018/08/29/225319))

  * Edit > Project Settings > Quality > Anti Aliasing でサンプリングポイントの数を選ぶ
  * Camera > Allow MSAA をチェック


CC BY-SA 4.0
2020-10-30T06:59:18.993
71613
2020-10-30T06:59:18.993
14817
71607
answer