Skip to content

Triangle Sorting Issue with Large Values #50

@HeresJ0nny

Description

@HeresJ0nny

Hello,

I noticed an issue with ImPlot3D when rendering 3D plots that involve large values. The problem seems to arise from floating-point precision errors during the triangle sorting process relative to the camera position. As a result, the plot is not rendered correctly.

If I manually normalize the Z-values before passing them to ImPlot3D::PlotScatter , the rendering works as expected, and the triangles are sorted correctly. However, without this normalization step, the visualization is inaccurate.

I have attached two images to illustrate the issue:

triangle_sorting-non-normalized
Without normalization: The plot is rendered incorrectly due to sorting errors.

triangle_sorting-normalized
With normalization: The plot is rendered as expected.

I would suggest implementing an internal normalization step for values within ImPlot3D before performing the triangle sorting calculations. This would ensure that the rendering is accurate and consistent, regardless of the scale or range of the input values. By handling the normalization internally, users would not need to preprocess their data, and the library would become more robust to variations in input data.

Kind regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions