Question 3d viewport axis

how to render 3d axis in viewport coordinate?

You have to setup the viewport and then render into it. It’s effectively a mini-scene whose configuration resembles your actual scene.

Something along the lines of:

///!!! CALCULATE THE VIEWPORT LOCATION AND SIZE
Viewport vpt = new Viewport { X = GraphicsDevice.Viewport.Width - 64, Y = GraphicsDevice.Viewport.Height - 64, Height = 64, Width = 64 };
var oldViewport = GraphicsDevice.Viewport;
GraphicsDevice.Viewport = vpt;

//!!! NOTE: nothing is being cleared

//??? Do your drawing, it's like a mini-scene
Camera cm = new Camera(GraphicsDevice, 45);
cm.Position = new Vector3(0, 0, 5);
cm.LookAtPoint(Vector3.Zero);
// draw the basis vectors * the rotation of the camera's inv-view (or view depending on nomenclature used)
debugDraw.Begin(cm.ViewMatrix, cm.ProjectionMatrix);
debugDraw.DrawLine(Vector3.Zero, Vector3.Transform(Vector3.UnitX, camera_.ViewMatrix.Rotation), Color.Red);
debugDraw.DrawLine(Vector3.Zero, Vector3.Transform(Vector3.UnitZ, camera_.ViewMatrix.Rotation), Color.CornflowerBlue);
debugDraw.DrawLine(Vector3.Zero, Vector3.Transform(Vector3.UnitY, camera_.ViewMatrix.Rotation), Color.Green);
debugDraw.End();

//!!! RESET THE VIEWPORT, if needed
GraphicsDevice.Viewport = oldViewport;

Which is the code I use to draw this indicator (sans comments)

it’s worked, Thanks !!!