Real-time track simplification and adaptive smooth segmentation rendering method based on Unity engine
By receiving aircraft position data in the Unity engine and performing slope filtering and curvature calculation, combined with the Bezier smoothing algorithm and object pool reuse, the performance and smoothness issues of trajectory rendering in the Unity engine are solved, achieving efficient trajectory rendering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-13
AI Technical Summary
In the Unity engine, high-frequency waypoint rendering leads to a decrease in rendering frame rate, an increase in memory pressure, frequent garbage collection, and unsmooth waylines, which cannot meet the needs of high real-time applications such as drone swarms and flight simulation.
By receiving aircraft position data points and caching them in a circular queue, slope similarity filtering is performed, curvature and Bézier control points are calculated, smooth trajectory vertices are generated, and rendering objects are reused using an object pool to achieve adaptive smooth segmented rendering.
It effectively avoids frame rate drops and stuttering, ensures the smoothness and continuity of the trajectory curve, and significantly improves the trajectory visualization effect.
Smart Images

Figure CN121661224A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Unity game engine rendering technology, and in particular to a real-time trajectory simplification and adaptive smooth segmented rendering method based on the Unity engine. Background Technology
[0002] When visualizing flight paths in the Unity engine environment, the number of track points accumulates rapidly in a short period of time as the flight platform's speed and sampling frequency increase. Because the Unity LineRenderer component experiences significant computational and memory pressure when processing large amounts of vertex data, the rendering frame rate drops noticeably as the trajectory length continues to grow. Furthermore, the number of vertices in a single mesh in Unity is limited to approximately 65535, while the number of track points in long-running tasks far exceeds this limit, making it impossible for a single object to completely render the trajectory. Simultaneously, the continuous creation and destruction of GameObjects used for drawing the trajectory generates frequent memory allocation and reclamation, triggering frequent garbage collection (GC), resulting in rendering stutters and impacting the system's real-time performance. Moreover, high-frequency point-by-point rendering of track points also leads to numerous broken lines and sharp angles in the trajectory, failing to accurately reflect the true curvature characteristics of the aircraft's trajectory. Therefore, the Unity platform lacks a trajectory rendering method that combines real-time performance, data compression, smooth curve fitting, and rendering stability, especially for high-real-time applications such as drone swarms, flight simulation, and battlefield situation control. A technical solution capable of processing large-scale trajectory data in real-time while maintaining smooth and continuous rendering is needed. Summary of the Invention
[0003] The purpose of this invention is to overcome the shortcomings of the prior art and provide a real-time trajectory simplification and adaptive smooth segmented rendering method based on the Unity engine.
[0004] The objective of this invention is achieved through the following technical solution: a real-time trajectory simplification and adaptive smooth segmented rendering method based on the Unity engine, comprising the following steps:
[0005] S1: Receive aircraft position data points And cache it in a circular queue;
[0006] S2: Perform slope similarity filtering on the received continuous track point sequence;
[0007] S3: Calculate curvature and Bézier control points based on simplified point sets;
[0008] S4: Generate smooth trajectory vertices and draw the trajectory in segments according to Unity vertex constraints;
[0009] S5: Object pool reuses rendering objects and updates rendering results in real time.
[0010] Preferably, in step S1, the trajectory data receiving module receives aircraft position data points at fixed intervals based on a Unity MonoBehaviour script. The data is cached in a circular queue, and when the cache is full, the oldest data is overwritten.
[0011] Preferably, in step S2, the adjacent slopes are set as follows:
[0012] ;
[0013] in, For the first The x-coordinate of each waypoint For the first The x-coordinate of each waypoint For the first The ordinate of each track point For the first The ordinate of each track point;
[0014] when If so, delete the intermediate point. This yields a simplified sequence of waypoints.
[0015] threshold The calculation formula is:
[0016] ;
[0017] in, This is an empirical correction factor. Resolution is measured in screen units. The average point spacing,
[0018] Add a scaling factor ,
[0019] ;
[0020] in, To adjust the index.
[0021] Preferably, in step S3, curvature is calculated based on a simplified point set.
[0022] ;
[0023] in, For point Place Approximate value of the first derivative in the direction, For point Place The approximate value of the second derivative in the direction, For point Place Approximate value of the first derivative in the direction, For point Place The approximate value of the second derivative in the direction;
[0024] The first and second derivatives are obtained using the central difference method.
[0025] ;
[0026] ;
[0027] ;
[0028] ;
[0029] in, For the first The x-coordinate of each waypoint For the first The x-coordinate of each waypoint For the first The ordinate of each track point For the first The ordinate of each track point;
[0030] Adaptive generation of Bezier control points
[0031] ;
[0032] ;
[0033] in, To adjust the parameters, These are the weighting coefficients for the previous control points. These are the weighting coefficients for the subsequent control points. It is a natural constant. For point curvature at that point For point The curvature at that point.
[0034] Preferably, in step S4, when At that time, a smooth trajectory vertex is generated using a third-order Bézier curve.
[0035] ;
[0036] ;
[0037] ;
[0038] in, For the simplified track point sequence, the first A point is used as the start or end point of the Bézier curve. These are the parameters of the Bézier curve. and These are the two control points of the third-order Bézier curve. for The last point, for The point before, for The last two points.
[0039] The present invention has the following advantages: The present invention uses a fast and simplified algorithm based on slope threshold to filter out redundant points by determining the slope similarity of continuous points, which effectively avoids frame rate drop and stuttering. At the same time, the adaptive Bezier smoothing algorithm based on curvature enables the trajectory curve to accurately fit the curvature of the actual trajectory of the aircraft, which significantly improves the trajectory visualization effect. Attached Figure Description
[0040] Figure 1 This is a schematic diagram illustrating the process of simplifying and adaptively smoothing segmented rendering of real-time flight paths based on the Unity engine. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0042] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0043] It should be noted that, unless otherwise specified, the embodiments and features described in this invention can be combined with each other.
[0044] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0045] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use, or the orientation or positional relationship commonly understood by those skilled in the art. They are only used for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention. In addition, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0046] In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0047] In this embodiment, as Figure 1 As shown, a real-time trajectory simplification and adaptive smooth segmented rendering method based on the Unity engine includes the following steps:
[0048] S1: Receive aircraft position data points And cache it in a circular queue;
[0049] S2: Perform slope similarity filtering on the received continuous track point sequence;
[0050] S3: Calculate curvature and Bézier control points based on simplified point sets;
[0051] S4: Generate smooth trajectory vertices and draw the trajectory in segments according to Unity vertex constraints;
[0052] S5: Object pool reuses rendering objects, updating rendering results in real time. A fast simplification algorithm based on slope thresholding filters out redundant points by determining the slope similarity of consecutive points, effectively avoiding frame rate drops and stuttering. Simultaneously, an adaptive Bezier smoothing algorithm based on curvature ensures the trajectory curve accurately matches the actual trajectory curvature of the aircraft, significantly improving trajectory visualization. In this embodiment, the trajectory data receiving module, based on the Unity MonoBehaviour script, receives aircraft position data points at fixed intervals; the real-time trajectory simplification module filters the received continuous trajectory point sequences by slope similarity; the adaptive Bezier smoothing module calculates local curvature and generates control points; the Unity segmented rendering module calls the LineRenderer component, and when a single segment vertex exceeds the Unity Mesh limit... The system automatically creates new rendering segment objects to achieve continuous trajectory drawing; the Unity object pool module reuses LineRenderer GameObject to avoid frequent creation and destruction; the calculation acceleration module parallelizes simplification and curve fitting calculations through the Unity Job System and Burst Compiler, with the main thread only responsible for pushing rendering data; the coordinate projection module converts latitude and longitude coordinates into Unity world coordinate system point data through Mercator or Gauss projection before rendering.
[0053] Furthermore, in step S1, the trajectory data receiving module receives aircraft position data points at fixed intervals based on the Unity MonoBehaviour script. The data is cached in a circular queue. When the cache is full, the oldest data is overwritten, thus ensuring no backlog delay.
[0054] Furthermore, in step S2, let the adjacent slopes be:
[0055] ;
[0056] in, For the first The x-coordinate of each waypoint For the first The x-coordinate of each waypoint For the first The ordinate of each track point For the first The ordinate of each track point;
[0057] when If so, delete the intermediate point. This yields a simplified sequence of waypoints.
[0058] threshold The calculation formula is:
[0059] ;
[0060] in, This is an empirical correction factor. The value is 0.8~1.2, ensuring that more points are reduced in high-density areas while maintaining accuracy in low-density areas. Resolution is measured in screen units. The average point spacing,
[0061] Add a scaling factor ,
[0062] ;
[0063] in, To adjust the index, The value is 0.2~0.4, representing the track fidelity when responding to map zooming. Specifically, let the continuous GPS track points be: When satisfied When the two line segments are in the same direction, the midpoint is considered to be... It can be deleted.
[0064] In this embodiment, in step S3, curvature is calculated based on a simplified point set.
[0065] ;
[0066] in, For point Place Approximate value of the first derivative in the direction, For point Place The approximate value of the second derivative in the direction, For point Place Approximate value of the first derivative in the direction, For point Place The approximate value of the second derivative in the direction;
[0067] The first and second derivatives are obtained using the central difference method.
[0068] ;
[0069] ;
[0070] ;
[0071] ;
[0072] in, For the first The x-coordinate of each waypoint For the first The x-coordinate of each waypoint For the first The ordinate of each track point For the first The ordinate of each track point;
[0073] Adaptive generation of Bezier control points
[0074] ;
[0075] ;
[0076] in, To adjust the parameters, These are the weighting coefficients for the previous control points. These are the weighting coefficients for the subsequent control points. It is a natural constant. For point curvature at that point For point The curvature at that point. Specifically, and All are derived from curvature adaptive calculation. is the natural constant with a value of 2.71828, used in exponential decay calculations. Used to reflect the curvature of the trajectory at a point, the control point offset rule is as follows: the greater the curvature and the sharper the shape, the closer the control point is to the origin; the smaller the curvature, the more linear the area becomes.
[0077] Furthermore, in step S4, when At that time, a smooth trajectory vertex is generated using a third-order Bézier curve.
[0078] ;
[0079] ;
[0080] ;
[0081] in, For the simplified track point sequence, the first A point is used as the start or end point of the Bézier curve. These are the parameters of the Bézier curve, and their values range from [value range missing]. It is used for interpolation to calculate the position of points on a curve. and These are the two control points of the third-order Bézier curve. for The last point, for The point before, for The last two points are used to calculate the control point offset. Otherwise, a fourth-order Bézier curve is used to generate smooth trajectory vertices. The fourth-order Bézier curve is extended in the same way, which will not be elaborated here.
[0082] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for real-time trajectory simplification and adaptive smooth segmented rendering based on the Unity engine, characterized in that: Includes the following steps: S1: Receive aircraft position data points And cache it in a circular queue; S2: Perform slope similarity filtering on the received continuous track point sequence; S3: Calculate curvature and Bézier control points based on simplified point sets; S4: Generate smooth trajectory vertices and draw the trajectory in segments according to Unity vertex constraints; S5: Object pool reuses rendering objects and updates rendering results in real time.
2. The real-time trajectory simplification and adaptive smooth segmented rendering method based on the Unity engine according to claim 1, characterized in that: In step S1, the trajectory data receiving module receives aircraft position data points at fixed intervals based on the Unity MonoBehaviour script. The data is cached in a circular queue, and when the cache is full, the oldest data is overwritten.
3. The real-time trajectory simplification and adaptive smooth segmented rendering method based on the Unity engine according to claim 2, characterized in that: In step S2, let the adjacent slopes be: ; in, For the first x-coordinates of each waypoint For the first x-coordinates of each waypoint For the first The ordinate of each waypoint For the first The ordinate of each track point; when If so, delete the intermediate point. This yields a simplified sequence of waypoints. threshold The calculation formula is: ; in, This is an empirical correction factor. Resolution is measured in screen units. The average point spacing, Add a scaling factor , ; in, To adjust the index.
4. The real-time trajectory simplification and adaptive smooth segmented rendering method based on the Unity engine according to claim 3, characterized in that: In step S3, curvature is calculated based on a simplified point set. ; in, For point Place Approximate value of the first derivative in the direction, For point Place The approximate value of the second derivative in the direction, For point Place Approximate value of the first derivative in the direction, For point Place The approximate value of the second derivative in the direction; The first and second derivatives are obtained using the central difference method. ; ; ; ; in, For the first x-coordinates of each waypoint For the first x-coordinates of each waypoint For the first The ordinate of each waypoint For the first The ordinate of each track point; Adaptive generation of Bezier control points ; ; in, To adjust the parameters, These are the weighting coefficients for the previous control points. These are the weighting coefficients for the subsequent control points. It is a natural constant. For point curvature at that point For point The curvature at that point.
5. The real-time trajectory simplification and adaptive smooth segmented rendering method based on the Unity engine according to claim 4, characterized in that: In step S4, when At that time, a smooth trajectory vertex is generated using a third-order Bézier curve. ; ; ; in, For the simplified track point sequence, the first... A point is used as the start or end point of the Bézier curve. For the parameters of the Bézier curve, and These are the two control points of the third-order Bézier curve. for The last point, for The point before, for The last two points.