A method and apparatus for controlling rendering order of a triangle mesh

By enabling visualization and interactive adjustment of the rendering order of triangle meshes through a graphical user interface, the problem of the rendering order being invisible in existing technologies is solved, improving the efficiency and flexibility of graphics debugging and rendering optimization.

CN122111267APending Publication Date: 2026-05-29BEIJING NEZHA INTERACTIVE ENTERTAINMENT TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING NEZHA INTERACTIVE ENTERTAINMENT TECHNOLOGY CO LTD
Filing Date
2026-02-11
Publication Date
2026-05-29

Smart Images

  • Figure CN122111267A_ABST
    Figure CN122111267A_ABST
Patent Text Reader

Abstract

The application discloses a method and device for controlling triangle mesh rendering order, and belongs to the technical field of computer graphics and two-dimensional skeleton skinning animation. The method comprises the following steps: loading a triangle mesh model and obtaining an initial rendering order thereof; displaying the current rendering order in a preview area of a graphical user interface in a visualized manner in real time; receiving a sequence adjustment operation generated by a user based on linear, circular or manual interactive tools through a control area; responding to the operation to calculate and update the rendering order of each triangle in real time; and outputting the updated order to drive rendering or export an index file. The device comprises model loading, preview display, interactive receiving, sequence calculation and sequence output modules. The application realizes visualized and interactive adjustment of the rendering order, has the advantages of intuitiveness, flexibility, real-time and non-intrusiveness, and significantly improves the efficiency of graphical debugging and rendering effect optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer graphics, 2D skeletal animation, and human-computer interaction. Specifically, it relates to a visual control method and apparatus for the rendering order of triangle meshes in 2D skeletal animation. Background Technology

[0002] In computer graphics, a triangular mesh is a way to represent the surface of an object. In 3D rendering, the rendering engine draws the triangles sequentially based on their depth information, i.e., their distance from the camera. However, in 2D rendering, the depth information of the triangles is lacking, so the triangles are drawn sequentially according to their arrangement in the data buffer. This order is usually predetermined by the modeling software or export tool and is opaque and invisible to the end user.

[0003] However, in many practical applications, the ability to view and control the rendering order is crucial. For example, in graphics debugging, it's necessary to isolate rendering issues in specific areas; or when achieving certain visual effects such as transparency and occlusion, precise control over the order in which triangles are drawn is required. Currently, there is a lack of tools that allow users to intuitively view and interactively adjust the rendering order in real time. Users typically need to directly edit the underlying mesh data, a cumbersome, unintuitive, and inefficient process that fails to meet the needs of dynamic and visual debugging and creation.

[0004] Therefore, there is an urgent need in this field for a technical solution that can provide a visual interface, allowing users to intuitively understand and flexibly adjust the rendering order of triangle meshes. Summary of the Invention

[0005] (a) Purpose of the invention

[0006] The present invention aims to overcome the shortcomings of the prior art and provide a method and apparatus for controlling the rendering order of triangle meshes. Its core purpose is to realize the visualization and interactive adjustment of the rendering order, thereby improving the efficiency and flexibility of graphics debugging, rendering optimization and special effects development.

[0007] (II) Technical Solution To achieve the above objectives, the present invention adopts the following technical solution: On the one hand, a method for controlling the rendering order of triangular meshes is provided, including: Load the triangular mesh model and obtain its initial rendering order; The current rendering order is displayed in real time in a visual manner in the preview area of ​​the graphical user interface; The graphical user interface control area receives sequence adjustment operations generated by the user based on at least one interactive tool. In response to the order adjustment operation, the rendering order of each triangle in the triangular mesh model is calculated and updated in real time; Output the updated rendering order.

[0008] On the other hand, a device for controlling the rendering order of triangular meshes is provided, comprising: The model loading module is used to load the triangular mesh model and obtain its initial rendering order. The preview display module is used to visually display the current rendering order in real time in the preview area of ​​the graphical user interface. An interactive receiving module is used to receive, through the control area of ​​the graphical user interface, a sequence adjustment operation generated by the user based on at least one interactive tool; A sequential calculation module is used to calculate and update the rendering order of each triangle in the triangular mesh model in real time in response to the sequential adjustment operation. The sequential output module is used to output the updated rendering order.

[0009] (III) Beneficial Effects Compared with the prior art, the present invention has the following significant advantages: Intuitive and visual: The preview area transforms abstract rendering order data into visual color gradients or numerical displays, making it easy for users to understand at a glance.

[0010] Flexible interaction: It provides a variety of intuitive interaction tools (linear, circular, manual), and users do not need to understand the underlying data format or programming. They can dynamically adjust the order through simple mouse or touch operations.

[0011] High efficiency and real-time updates: Adjustment operations and sequence updates are synchronized in real time, providing a WYSIWYG experience and greatly improving the iteration speed of debugging and optimization.

[0012] Non-intrusive: The adjustment only applies to the rendering sequence logic layer, without modifying the original mesh geometry data, making it safe and reversible. Attached Figure Description

[0013] Figure 1 A flowchart illustrating a method for controlling the rendering order of triangular meshes according to an embodiment of the present invention.

[0014] Figure 2 This is a structural block diagram of a device provided in an embodiment of the present invention.

[0015] Figure 3 The diagram illustrates a graphical user interface for applying the method of the present invention, showing a preview area and a control area containing various tools.

[0016] Figure 4 This is a diagram illustrating how to adjust the rendering order using the "Linear Operation Tool".

[0017] Figure 5 This is a diagram illustrating how to adjust the rendering order using the "circular operation tool" (from the inside out).

[0018] Figure 6 This is a diagram illustrating how to adjust the rendering order using the "circular operation tool" (from the outside in).

[0019] Figure 7 This is a diagram illustrating how to adjust the rendering order using the "manual operation tool". Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.

[0021] Example 1: As Figure 1 As shown in the figure, this embodiment provides a method for controlling the rendering order of triangular meshes. The specific steps are as follows: Step S101: Loading and Initialization. Load a triangle mesh model data from the system and read its inherent or associated initial rendering order data. If no specific order is specified, the storage order of the triangles in the model file is used as the initial order by default.

[0022] Step S102: Visualization. For example... Figure 3 As shown, a preview area is created in the graphical user interface. To visually represent the rendering order, a black, white, and gray coloring scheme is used: the rendering order is mapped to a grayscale gradient, with the darkest color (such as black) representing the first rendering and the lightest color (such as white) representing the last rendering. Each triangle is filled with the corresponding grayscale value according to its current order value. This mapping relationship can be updated in real time.

[0023] Step S103: Receive interactive operation. For example... Figure 3 As shown, the interface provides a control area containing various interactive tool buttons. Users can select: Linear operation tools ( Figure 4 ): The user clicks and drags the mouse in the preview area to draw a directional baseline arrow. The arrow direction indicates the desired rendering direction (e.g., rendering from the tail of the arrow to the head is prioritized).

[0024] Circular operation tool (inside-out mode) Figure 5 The user drags and drops a baseline circle in the preview area. The rendering proceeds in the order from the center outwards.

[0025] Circular operation tool (outside-in mode) Figure 6 The user drags and drops a baseline circle in the preview area. The rendering proceeds from the circumference towards the center.

[0026] Manual operation tools ( Figure 7 Users can directly switch to "smear" or "select" mode.

[0027] Step S104: Calculate the update order in real time. This is the core of the invention.

[0028] For linear operations (corresponding to) Figure 4 The system uses formula 1. Calculate the centroid position of each triangle.

[0029] Use formula 2 Calculate the directed projection length from the centroid position to the reference arrow. The new rendering order is sorted according to the "directed projection length from smallest to largest".

[0030] For ring operations (corresponding to) Figure 5 ): Use formula 3 The system calculates the Euclidean distance from the centroid of each triangle to the center of the reference circle. If the mode is "inside to outside", the triangles are sorted in ascending order of distance; if the mode is "outside to inside", the triangles are sorted in descending order of distance.

[0031] For manual operation (corresponding) Figure 6 The system records the coordinates (x, y) of the user's click. Calculate all triangles sequentially, and check if the currently clicked position (x, y) is inside a triangle. If it is, mark this triangle as having the smallest rendering order value (rendered first). Subsequent operations can continue to add priority triangles to the priority list, and the system assigns them priority according to the order of operation time.

[0032] Step S105: Output and Application. The updated rendering order can immediately drive the rendering engine to redraw for previewing the effect, and can also be exported as a sequence index file for use by external rendering pipelines.

[0033] Example 2 like Figure 2 As shown, this embodiment provides an apparatus 200 for implementing the above method, which can be a standalone graphics tool software or a functional module integrated into existing modeling / rendering software. The apparatus includes: Model loading module 201: Responsible for reading grid data.

[0034] Preview display module 202: Responsible for implementing shading and real-time rendering.

[0035] Interactive receiving module 203: Responsible for handling GUI events (mouse, trackball, touch, etc.).

[0036] Sequential calculation module 204: encapsulates the sorting algorithms in different modes such as linear, circular, and manual.

[0037] Sequential output module 205: Responsible for passing the results to the rendering engine or file.

[0038] The modules work together to form a complete visual adjustment system.

Claims

1. A method for controlling the rendering order of triangular meshes, characterized in that, include: Load the triangular mesh model and obtain its initial rendering order; The current rendering order is displayed in real time in a visual manner in the preview area of ​​the graphical user interface; The graphical user interface control area receives sequence adjustment operations generated by the user based on at least one interactive tool. In response to the order adjustment operation, the rendering order of each triangle in the triangular mesh model is calculated and updated in real time; Output the updated rendering order.

2. The method according to claim 1, characterized in that, The real-time visualization method is as follows: based on the rendering order, the triangles are assigned colors of different brightness or hue for display, or numbers indicating the rendering order are displayed inside the triangles.

3. The method according to claim 1 or 2, characterized in that, The at least one interactive tool includes a linear operation tool; the sequence adjustment operation includes the user drawing a baseline or vector arrow in the preview area; the real-time calculation and update includes determining the updated rendering order based on the distance and orientation relationship of each triangle to the baseline or vector arrow.

4. The method according to claim 1 or 2, characterized in that, The at least one interactive tool includes a circular operation tool; the sequence adjustment operation includes the user drawing a reference circle in the preview area; the real-time calculation and update includes: determining the update rendering order according to a preset rule from the inside out or from the outside in, based on the distance of each triangle to the center of the reference circle.

5. The method according to claim 1 or 2, characterized in that, The at least one interactive tool includes a manual operation tool; the order adjustment operation includes the user selecting or painting on a specific triangle or area in the preview area; the real-time calculation and update includes marking the rendering order of the manipulated triangle as having higher priority.

6. A device for controlling the rendering order of triangular meshes, characterized in that, include: The model loading module is used to load the triangular mesh model and obtain its initial rendering order. The preview display module is used to visually display the current rendering order in real time in the preview area of ​​the graphical user interface. An interactive receiving module is used to receive, through the control area of ​​the graphical user interface, a sequence adjustment operation generated by the user based on at least one interactive tool; A sequential calculation module is used to calculate and update the rendering order of each triangle in the triangular mesh model in real time in response to the sequential adjustment operation. The sequential output module is used to output the updated rendering order.

7. The apparatus according to claim 6, characterized in that, The preview display module is specifically used to: assign different brightness or hue colors to the triangles according to the rendering order, or display numbers indicating the rendering order inside the triangles.

8. The apparatus according to claim 6, characterized in that, The at least one interactive tool includes any one or more of linear operation tools, circular operation tools, or manual operation tools.

9. The apparatus according to claim 7, characterized in that, The at least one interactive tool includes any one or more of linear operation tools, circular operation tools, or manual operation tools.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1 to 5.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1 to 5.