Discussed in #17
Originally posted by @brenocq on December 20, 2024
PR opened by @haiha95 on October 16, 2025
Feature description
This feature introduces a "World Mode" as an alternative to the current "Box Mode." While the default box-shaped space is excellent for standard data visualization, a more open and exploratory environment is needed for applications involving large or unbounded datasets, such as GIS data or spatial simulations.
World Mode removes the bounding box in favor of a ground plane and introduces free-camera navigation, similar to 3D modeling software. This mode includes support for both orthographic and perspective projections and ensures the camera remains upright during navigation.
This is implemented through a set of new plot flags:
ImPlot3DFlags_GroundOnly: Hides the side and top/bottom planes of the plot box, leaving only the XY "ground" plane visible.
ImPlot3DFlags_LockGround: Clamps the camera's elevation to prevent it from flipping upside down, keeping the ground plane always below the horizon.
ImPlot3DFlags_Perspective: Switches the rendering from an orthographic projection to a perspective projection.
ImPlot3DFlags_WorldMode: A convenience flag that enables all three flags above for the complete world mode experience.
Current Implementation Status
The foundational elements for World Mode have been implemented. The plot box can be collapsed to a ground plane, perspective projection is functional, and camera controls now manipulate an NDCOffset and NDCScale for free-form panning and zooming. However, there are known issues and areas for improvement.
Known Issues & Next Steps
- Camera Movement: The current free-camera panning and zooming behavior can feel unintuitive or buggy at times and needs refinement.
- "Infinite" Ground Plane: The
GroundOnly flag currently flattens the existing plot box into a finite plane. A truly infinite grid that extends to the viewport edges regardless of zoom or pan is still needed. This might require a new, separate flag or a modification to the existing grid rendering logic.
Tasks
Credit for the initial implementation of these tasks goes to @haiha95.
Discussed in #17
PR opened by @haiha95 on October 16, 2025
Feature description
This feature introduces a "World Mode" as an alternative to the current "Box Mode." While the default box-shaped space is excellent for standard data visualization, a more open and exploratory environment is needed for applications involving large or unbounded datasets, such as GIS data or spatial simulations.
World Mode removes the bounding box in favor of a ground plane and introduces free-camera navigation, similar to 3D modeling software. This mode includes support for both orthographic and perspective projections and ensures the camera remains upright during navigation.
This is implemented through a set of new plot flags:
ImPlot3DFlags_GroundOnly: Hides the side and top/bottom planes of the plot box, leaving only the XY "ground" plane visible.ImPlot3DFlags_LockGround: Clamps the camera's elevation to prevent it from flipping upside down, keeping the ground plane always below the horizon.ImPlot3DFlags_Perspective: Switches the rendering from an orthographic projection to a perspective projection.ImPlot3DFlags_WorldMode: A convenience flag that enables all three flags above for the complete world mode experience.Current Implementation Status
The foundational elements for World Mode have been implemented. The plot box can be collapsed to a ground plane, perspective projection is functional, and camera controls now manipulate an
NDCOffsetandNDCScalefor free-form panning and zooming. However, there are known issues and areas for improvement.Known Issues & Next Steps
GroundOnlyflag currently flattens the existing plot box into a finite plane. A truly infinite grid that extends to the viewport edges regardless of zoom or pan is still needed. This might require a new, separate flag or a modification to the existing grid rendering logic.Tasks
Credit for the initial implementation of these tasks goes to @haiha95.
Public API (
implot3d.h)ImPlot3DFlags_enum:ImPlot3DFlags_GroundOnly,ImPlot3DFlags_LockGround, andImPlot3DFlags_Perspective.ImPlot3DFlags_WorldModeas a combination of the three new flags.ToElAzmethod to theImPlot3DQuatstruct to convert a quaternion back to elevation and azimuth angles.GetPlotScaleandGetBoxRotation.Internal State (
implot3d_internal.h)NDCOffsetmember to theImPlot3DPlotstruct to manage camera panning.ClampGroundRotationmethod to theImPlot3DPlotstruct.Core Logic (
implot3d.cpp)ComputeActiveFaces, handle theground_onlycase to forceplane_2dtoImPlane3D_XY.RenderPlotBoxandComputeBoxCornersto only render the XY plane whenGroundOnlyis active.HandleInput):NDCOffsetinstead of axis ranges.NDCScaleandNDCOffsetfor free-camera zooming.ClampGroundRotationwhenImPlot3DFlags_LockGroundis enabled.NDCOffsetintoPlotToNDCandNDCToPlottransformations.NDCToPixels.Demonstration (
implot3d_demo.cpp)TODO