Rendering method, system and equipment and storage medium

By performing mathematical operations on the model matrix and view matrix, inputting the graphics card when the vertex coordinate range is appropriate, or splitting the vertex coordinates into small vertex coordinates, the problem of low rendering accuracy caused by the graphics card accuracy limitation is solved, and high-precision image rendering effect is achieved.

CN120388116APending Publication Date: 2025-07-29GLODON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410123635.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-29
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

When rendering three-dimensional models in the prior art, the accuracy range limitation of the graphics card leads to problems such as image distortion, rotation display jitter flicker, and inaccurate pickup, especially in the infrastructure field where the vertex coordinate span is large.

Method used

By performing mathematical operations on the model matrix and view matrix, and when the numerical range of vertex coordinates does not exceed the accuracy range of graphics card, input the calculation results and vertex coordinates into the rendering model of the graphics card, or split the vertex coordinates into a combination of small vertex coordinates and split matrix, ensure that the data entered into the graphics card is within the accuracy range.

Benefits of technology

Improve rendering accuracy, avoid the problem of rendering accuracy degradation due to data exceeding the graphics card accuracy range, and ensure the sharpness and accuracy of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120388116A_ABST
    Figure CN120388116A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image rendering, and discloses a rendering method, system and device and a storage medium, the method comprises the following steps: obtaining a transformation matrix between a vertex coordinate of a to-be-rendered model under a modeling coordinate system and a coordinate system, the transformation matrix comprising a model matrix for transforming from the modeling coordinate system to a world coordinate system, and converting a view matrix from a world coordinate system to a camera coordinate system; executing first arithmetical operation in the rendering process on the model matrix and the view matrix, and obtaining an operation result of the first arithmetical operation; and when the numerical range of the vertex coordinates does not exceed the precision range supported by the display card, inputting an operation result of the first mathematical operation and the vertex coordinates into the display card, so that the display card renders the to-be-rendered model in the display screen based on the acquired data. The rendering precision can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of image rendering, and particularly to a rendering method, system, device, and storage medium. Background Art

[0002] Currently, when performing a rendering operation on a three-dimensional model, the coordinates of the three-dimensional model and the transformation matrix between coordinate systems are usually directly input into the graphics card, and the graphics card renders the three-dimensional model onto the display screen. However, in some scenarios, the accuracy of this rendering method is relatively low. For example, in the infrastructure field, the vertex coordinates of some tunnel models are real geographical coordinates, and the span of the vertex coordinates is relatively large. When the vertex coordinates exceed the number of digits supported by the graphics card (i.e., the graphics card accuracy), problems such as distortion, rotation, display jitter and flicker, and inaccurate picking may occur in the rendered image, and the rendering accuracy is low.

[0003] Therefore, there is an urgent need for a rendering method that can improve the rendering accuracy. Summary of the Invention

[0004] In view of this, embodiments of the present disclosure provide a rendering method, a rendering system, an electronic device, and a computer-readable storage medium, which can improve the rendering accuracy.

[0005] On the one hand, the present disclosure provides a rendering method, which includes:

[0006] Obtain the vertex coordinates of the model to be rendered in the modeling coordinate system and the transformation matrix between coordinate systems, where the transformation matrix includes a model matrix for converting from the modeling coordinate system to the world coordinate system and a view matrix for converting from the world coordinate system to the camera coordinate system;

[0007] Perform a first mathematical operation during the rendering process on the model matrix and the view matrix, and obtain the operation result of the first mathematical operation;

[0008] When the numerical range of the vertex coordinates does not exceed the accuracy range supported by the graphics card, input the operation result of the first mathematical operation and the vertex coordinates into the graphics card, so that the graphics card renders the model to be rendered on the display screen based on the obtained data.

[0009] In the technical solutions of some embodiments of the present application, during the rendering operation, after performing a first mathematical operation on the model matrix and the view matrix, when the numerical range of the vertex coordinates does not exceed the accuracy range supported by the graphics card, input the vertex coordinates and the operation result of the first mathematical operation into the graphics card. Through the first mathematical operation, it is possible to avoid the data with a numerical range exceeding the graphics card accuracy range in the model matrix and the view matrix from being input into the graphics card, solve the influence of these data on the rendering accuracy, and thus improve the rendering accuracy.

[0010] In some embodiments, when the numerical range of the vertex coordinates exceeds the precision range supported by the graphics card, the method further includes:

[0011] splitting the vertex coordinates into a combination of small vertex coordinates and a splitting matrix, where the absolute value of the small vertex coordinates is less than the absolute value of the vertex coordinates, and the splitting matrix represents the conversion relationship between the small vertex coordinates and the vertex coordinates;

[0012] inputting the small vertex coordinates obtained by splitting from the vertex coordinates into the graphics card.

[0013] Through vertex splitting, it can be ensured that the small vertex coordinates input into the graphics card are within the precision range of the graphics card, avoiding the problem of reduced rendering precision caused by the numerical range of the vertex coordinates exceeding the precision range supported by the graphics card after directly inputting the vertex coordinates into the graphics card.

[0014] In some embodiments, the splitting of the vertex coordinates into a combination of small vertex coordinates and a splitting matrix includes:

[0015] creating a splitting coordinate system with one of the vertex coordinates of the model to be rendered as the origin;

[0016] taking the coordinates of each vertex of the model to be rendered in the splitting coordinate system as the small vertex coordinates, and taking the transformation matrix between the modeling coordinate system and the splitting coordinate system as the splitting matrix.

[0017] In this way, when it is necessary to render the model to be rendered with high precision, it can be ensured that the small vertex coordinates input into the graphics card do not exceed the precision range of the graphics card, thereby ensuring the rendering precision.

[0018] In some embodiments, the vertex coordinates of each vertex of the model to be rendered are stored in a one-dimensional array;

[0019] The creating of a splitting coordinate system with one of the vertex coordinates of the model to be rendered as the origin includes:

[0020] taking the first vertex coordinate in the one-dimensional array as the origin to create the splitting coordinate system.

[0021] In this way, when looking for the vertex coordinate of the model to be rendered as the origin, the search process can be simplified and the search efficiency is high.

[0022] In some embodiments, the creating of a splitting coordinate system with one of the vertex coordinates of the model to be rendered as the origin includes:

[0023] Create the split coordinate system with one of the vertex coordinates of the model to be rendered as the origin and the axis directions of the modeling coordinate system as the axis directions of the split coordinate system.

[0024] In this way, the transformation matrix between the modeling coordinate system and the split coordinate system can be simplified, that is, the split matrix can be simplified.

[0025] In some embodiments, performing a first mathematical operation on the model matrix and the view matrix during the rendering process and obtaining the operation result of the first mathematical operation includes:

[0026] Performing a second mathematical operation on the model matrix and the split matrix to obtain the operation result of the second mathematical operation;

[0027] Performing a third mathematical operation on the operation result of the second mathematical operation and the view matrix, and using the operation result of the third mathematical operation as the operation result of the first mathematical operation.

[0028] In this way, it is not necessary to directly input the split matrix into the graphics card, preventing the problem of reduced rendering accuracy caused when the data in the split matrix exceeds the accuracy range of the graphics card.

[0029] In some embodiments, when inputting the operation result of the first mathematical operation and the vertex coordinates into the graphics card, the method further includes:

[0030] Inputting the projection matrix into the graphics card, where the projection matrix represents the transformation matrix between the camera coordinate system and the perspective coordinate system.

[0031] When multiplying the operation result of the first mathematical operation and the projection matrix, the result may exceed the accuracy range of the graphics card. Inputting the operation result of the first mathematical operation and the projection matrix into the graphics card separately can at least ensure that the operation result of the first mathematical operation does not exceed the accuracy range of the graphics card, achieving the purpose of improving the rendering accuracy.

[0032] On the other hand, the present disclosure also provides a rendering system, which includes:

[0033] A data acquisition module for acquiring the vertex coordinates of the model to be rendered in the modeling coordinate system and the transformation matrix between the coordinate systems, where the transformation matrix includes a model matrix for transforming from the modeling coordinate system to the world coordinate system and a view matrix for transforming from the world coordinate system to the camera coordinate system;

[0034] An operation module for performing a first mathematical operation on the model matrix and the view matrix during the rendering process and obtaining the operation result of the first mathematical operation;

[0035] A rendering module, configured to input the operation result of the first mathematical operation and the vertex coordinates into a graphics card when the numerical range of the vertex coordinates does not exceed the precision range supported by the graphics card, so that the graphics card renders the model to be rendered on the display screen based on the acquired data.

[0036] On the other hand, the present disclosure also provides a computer-readable storage medium for storing a computer program, which when executed by a processor, implements the method described above.

[0037] On the other hand, the present disclosure also provides an electronic device, which includes a processor and a memory. The memory is used to store a computer program, which when executed by the processor, implements the method described above. Description of the Drawings

[0038] The features and advantages of the present disclosure will be more clearly understood by referring to the accompanying drawings. The drawings are schematic and should not be construed as imposing any limitation on the present disclosure. In the drawings:

[0039] Figure 1 Shows an image obtained with a relatively low rendering precision;

[0040] Figure 2 Shows an image obtained with a relatively high rendering precision;

[0041] Figure 3 Shows a schematic flowchart of a rendering method provided by an embodiment of the present application;

[0042] Figure 4 Shows a schematic diagram of the relationship between a modeling coordinate system and a splitting coordinate system provided by an embodiment of the present application;

[0043] Figure 5 Shows a schematic diagram of a rendering device provided by an embodiment of the present application;

[0044] Figure 6 Shows a schematic diagram of modules of a rendering system provided by an embodiment of the present application;

[0045] Figure 7 Shows a schematic diagram of an electronic device provided by an embodiment of the present application. Detailed Embodiments

[0046] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the scope of protection of the present disclosure.

[0047] Before elaborating on the solutions of this application, the relevant concepts and principles in the field of rendering technology will be explained first.

[0048] In the field of rendering technology, coordinate system transformations between a modeling coordinate system, a world coordinate system, a camera coordinate system, a perspective coordinate system, and a screen coordinate system are usually involved. Among them, the modeling coordinate system refers to the coordinate system used to determine the coordinates of the model to be rendered. The model to be rendered refers to the three-dimensional model of the target object to be rendered. The target object can be a section of road, a building, a community, a room, etc. The coordinates of the model to be rendered include, but are not limited to, the vertex coordinates of each vertex of the model to be rendered. Usually, the origin, the X-axis direction, the Y-axis direction, and the Z-axis direction of the modeling coordinate system can be defined according to actual needs. For example, the world origin (i.e., the intersection of the prime meridian and the equator) can be used as the origin of the modeling coordinate system, or a certain position point near the target object can be used as the origin of the modeling coordinate system. Different definitions of the modeling coordinate system result in different vertex coordinates of the model to be rendered. For example, when the world origin is used as the origin of the modeling coordinate system, if the target object is far from the coordinate system origin, the vertex coordinates of the created model to be rendered will be larger. However, when a certain position point near the target object is used as the origin of the modeling coordinate system, since the target object is close to the coordinate system origin, the vertex coordinates of the created model to be rendered are correspondingly smaller.

[0049] The modeling coordinate system, the world coordinate system, the camera coordinate system, the perspective coordinate system, and the screen coordinate system can be different coordinate systems. Among them, the differences between the coordinate systems are mainly reflected in that the origin positions, the X-axis orientations, the Y-axis orientations, and the Z-axis orientations between the coordinate systems can be not completely the same. For example, the modeling coordinate system can be a coordinate system established with a certain position point near the target object as the origin, the world coordinate system can be a coordinate system established with the world origin as the origin, and the camera coordinate system can be a coordinate system established with the camera optical center as the origin.

[0050] There can be a transformation matrix between different coordinate systems. Among them, the transformation matrix is used to describe the translation operation and rotation operation that need to be performed on coordinate system A when transforming it to a position that coincides with another coordinate system B. For example, assuming that the origin of the modeling coordinate system is at a certain position near the target object, when transforming the modeling coordinate system to a position that coincides with the world coordinate system, first, the origin of the modeling coordinate system needs to be moved to the world origin through a translation operation, and then through a rotation operation, the axes of the modeling coordinate system are made to have the same orientation as the axes of the world coordinate system. In this way, the modeling coordinate system is transformed to a position that coincides with the world coordinate system.

[0051] Rendering the model to be rendered on the display screen is mainly based on the vertex coordinates of the model to be rendered and the transformation matrix between coordinate systems, and transforming the model to be rendered into a two-dimensional image displayed on the display screen. Among them, the two-dimensional image displayed on the display screen is the state of the target object observed from the perspective of the observer. Specifically, in the field of rendering technology, the origin of the camera coordinate system can be equivalent to the observer's position. The state of the model to be rendered in the camera coordinate system is the state of the target object observed from the perspective of the observer. Simply put, if the model to be rendered is closer to the origin of the camera coordinate system, it means that the observer is observing the target object at a position closer to the target object. In this case, the target object observed by the observer should be relatively clear, and the rendering accuracy of the model to be rendered should also be relatively high accordingly, so as to prevent problems such as distortion in the two-dimensional image displayed on the display screen. On the contrary, if the model to be rendered is farther from the origin of the camera coordinate system, it means that the observer is observing the target object at a position farther from the target object. In this case, the target object observed by the observer may be relatively blurred, and even if there are problems such as distortion in the two-dimensional image displayed on the display screen, it is not easy to identify (that is, the image difference caused by accuracy loss can no longer be distinguished), so the rendering accuracy requirement for the model to be rendered can be reduced accordingly.

[0052] Normally, when rendering the model to be rendered on the display screen, the following several stages mainly need to be experienced:

[0053] 1) Obtain the vertex coordinates of the model to be rendered in the modeling coordinate system and the transformation matrix between coordinate systems;

[0054] 2) Based on the model matrix between the modeling coordinate system and the world coordinate system, transform the vertex coordinates of the model to be rendered from the modeling coordinate system to the world coordinate system;

[0055] 3) Based on the view matrix between the world coordinate system and the camera coordinate system, transform the vertex coordinates of the three-dimensional model from the world coordinate system to the camera coordinate system;

[0056] 4) Based on the projection matrix between the camera coordinate system and the perspective coordinate system, convert the vertex coordinates in the camera coordinate system to the perspective coordinate system;

[0057] 5) Project the vertex coordinates of the perspective coordinate system onto the display screen for display (i.e., rendering).

[0058] Currently, in some technologies, usually the vertex coordinates of the model to be rendered and the transformation matrix between coordinate systems are directly input into the graphics card, so that the graphics card, based on the received data, completes the transformation operation of the vertex coordinates between each coordinate system and then renders the model to be rendered on the display screen. The problem with this technology is that the graphics card has a precision range. The so-called precision range means that, on the premise of ensuring the rendering precision, the number of digits of data supported by the graphics card (such as 7-bit single-precision floating-point numbers). In the vertex coordinates and transformation matrix input into the graphics card, if there are data with a numerical range exceeding the precision range of the graphics card, problems such as distortion, rotation, display jitter and flicker, and inaccurate picking will occur in the rendered two-dimensional image, and the rendering precision is relatively low. For example Figure 1 the road centerlines and grids in Figure 2 have all shown distortion problems. The two-dimensional image in

[0059] does not produce distortion. In summary, when there are data in the vertex coordinates and transformation matrix of the model to be rendered with a numerical range exceeding the precision range of the graphics card, the model to be rendered cannot be rendered with a high rendering precision.

[0059] To solve the above problems, the present application provides a rendering method that can improve the rendering precision. The rendering method can be applied to an electronic device. The electronic device includes but is not limited to a desktop computer, a laptop computer, a notebook computer, a server, etc. Referring to Figure 3 for a schematic flowchart of the rendering method provided by an embodiment of the present application. Figure 3 In

[0060] Step S31, obtain the vertex coordinates of the model to be rendered in the modeling coordinate system and the transformation matrix between coordinate systems, where the transformation matrix includes a model matrix for converting from the modeling coordinate system to the world coordinate system and a view matrix for converting from the world coordinate system to the camera coordinate system.

[0061] Specifically, the model to be rendered may have model attribute information, and the vertex coordinates of the model to be selected for rendering can be obtained from the model attribute information.

[0062] In addition, it can be understood that after the origin, axis orientation, etc. of each coordinate system are determined, the transformation matrix between coordinate systems is usually fixed and unchanged. Therefore, the transformation matrix between coordinate systems can be stored in a specified storage location. In this way, it is convenient to obtain the transformation matrix between coordinate systems from this specified storage location during the rendering process.

[0063] Step S32: Perform the first mathematical operation during the rendering process on the model matrix and the view matrix, and obtain the operation result of the first mathematical operation.

[0064] Specifically, in this application, C is used to represent the vertex coordinates of the model to be rendered, M is used to represent the model matrix, V is used to represent the view matrix, P is used to represent the projection matrix between the camera coordinate system and the perspective coordinate system, and S is used to represent the perspective matrix between the perspective coordinate system and the screen coordinate system. Then the entire rendering process can be shown as in Expression (1):

[0065] C * M * V * P * S (1)

[0066] Expression (1) means that after converting the vertex coordinates C from the model coordinate system to the world coordinate system based on the model matrix M, then converting the vertex coordinates C from the world coordinate system to the camera coordinate system based on the view matrix V, then converting the vertex coordinates C from the camera coordinate system to the perspective coordinate system based on the projection matrix P, and finally converting the vertex coordinates C from the perspective coordinate system to the screen coordinate system based on the perspective matrix S. In this way, the rendering of the model to be rendered is completed.

[0067] From the above description, it can be seen that during the rendering process, the first mathematical operation performed on the model matrix M and the view matrix V is to multiply the model matrix M and the view matrix V. Those skilled in the art can understand that when the observer is relatively close to the target object, the result obtained after M * V is usually small, and its numerical range can be within the precision range of the graphics card. On the contrary, when the observer is relatively far from the target object, the result obtained after M * V is usually large, and its numerical range may exceed the precision range of the graphics card.

[0068] Step S33: When the numerical range of the vertex coordinates C does not exceed the precision range supported by the graphics card, input the operation result of the first mathematical operation and the vertex coordinates C into the graphics card, so that the graphics card renders the model to be rendered on the display screen based on the obtained data.

[0069] Based on the above relevant description of the rendering principle, generally, only when the observer is relatively close to the target object, it is necessary to render the 3D model with high precision. Further based on the relevant description of step S32, when the observer is relatively close to the target object, the result obtained after M*V can be within the precision range of the graphics card. Therefore, when the observer is relatively close to the target object, and when the numerical range of the vertex coordinate C does not exceed the precision range supported by the graphics card, after inputting the vertex coordinate C and the operation result of the first mathematical operation into the graphics card, the data input into the graphics card does not have data whose numerical range exceeds the precision range of the graphics card. In this way, the rendering precision can be guaranteed. Compared with some technologies, in some technologies, the model matrix M and the view matrix V are separately input into the graphics card. Since there may be data in the model matrix M and the view matrix V whose numerical range exceeds the precision range of the graphics card, in these technologies, when it is necessary to render the 3D model with high precision, the precision of the actually rendered image is relatively low. However, in this application, after multiplying the model matrix M and the view matrix V, the product result is input into the graphics card. In this way, the problems in some technologies can be effectively avoided, and the purpose of improving the rendering precision is achieved.

[0070] Furthermore, based on the relevant description of step S32, when the observer is relatively far from the target object, the result obtained after M*V may exceed the precision range of the graphics card. However, based on the above relevant description of the rendering principle, when the observer is relatively far from the target object, the rendering precision can be correspondingly reduced. In view of this, when the observer is relatively far from the target object, although the result obtained after M*V exceeds the precision range of the graphics card, its impact on the rendering precision can be ignored.

[0071] In summary, in the technical solutions of some embodiments of this application, during the rendering operation, after performing the first mathematical operation on the model matrix and the view matrix, when the numerical range of the vertex coordinate C does not exceed the precision range supported by the graphics card, the vertex coordinate C and the operation result of the first mathematical operation are input into the graphics card. Through the first mathematical operation, it is possible to avoid data in the model matrix and the view matrix whose numerical range exceeds the precision range of the graphics card from being input into the graphics card, solve the impact of these data on the rendering precision, and thus improve the rendering precision.

[0072] The following further describes the solution of this application.

[0073] In some embodiments, when the numerical range of the vertex coordinate C exceeds the precision range supported by the graphics card, the vertex coordinate C can be split into a combination of small vertex coordinates and a split matrix, where the absolute value of the small vertex coordinates is less than the absolute value of the vertex coordinate C, and the split matrix represents the conversion relationship between the small vertex coordinates and the vertex coordinate C.

[0074] Specifically, the vertex coordinates C can be split according to the splitting limit conditions. The splitting limit conditions are: the split small vertex coordinates O are within the precision range of the graphics card.

[0075] After ensuring that the small vertex coordinates O are within the precision range of the graphics card, the splitting matrix can be determined. Specifically, in this application, F is used to represent the splitting matrix, and O is used to represent the small vertex coordinates. The splitting matrix F can represent the distances that need to be translated in the x, y, and z axis directions of the modeling coordinate system when moving the small vertex coordinates O to the position where the vertex coordinates C are located. According to the definition of the splitting matrix F, the splitting matrix can be expressed by expression (2).

[0076]

[0077] Among them, x offset represents the distance that needs to be moved in the x-axis direction of the modeling coordinate system when moving the small vertex coordinates C to the position where the vertex coordinates CC are located;

[0078] y offset represents the distance that needs to be moved in the y-axis direction of the modeling coordinate system when moving the small vertex coordinates O to the position where the vertex coordinates C are located;

[0079] z offset represents the distance that needs to be moved in the z-axis direction of the modeling coordinate system when moving the small vertex coordinates O to the position where the vertex coordinates C are located.

[0080] Based on the above description, assuming that (x0, y0, z0, 1) is used to represent the small vertex coordinates O, and (x, y, z, 1) is used to represent the vertex coordinates C, then the relationship between the vertex coordinates C, the small vertex coordinates O, and the splitting matrix F can be shown as in expression (3):

[0081]

[0082] Furthermore, assuming that the model matrix M is as shown in expression (4):

[0083]

[0084] Then:

[0085] (x, y, z, 1) * M = x * a 00 + y * a 10 + z * a 20 + a 30

[0086] (x0, y0, z0, 1) * M * F = (x + x offset ) * a 00 +(y + y offset ) * a 10 +(z + zoffset )*a 20 +a 30

[0087] Combining with expression (3), it can be known that (x, y, z, 1)*M = (x0, y0, z0, 1)*M*F, that is, C*M = O*M*F. Then expression (1) can be further expressed as expression (5):

[0088] O*M*F*V*P*S(5)

[0089] In summary, the small vertex coordinates O split from the vertex coordinates C can be input into the graphics card, and then the rendering operation of the model to be rendered can be completed based on expression (5). Through vertex splitting, it can be ensured that the small vertex coordinates O input into the graphics card are within the precision range of the graphics card, avoiding the problem of reduced rendering precision caused by the numerical range of the vertex coordinates C exceeding the precision range supported by the graphics card when directly inputting the vertex coordinates C into the graphics card.

[0090] Combining with reference to expression (5), in the vertex splitting scenario, performing the first mathematical operation during the rendering process on the model matrix M and the view matrix V, and obtaining the operation result of the first mathematical operation, may include:

[0091] Performing a second mathematical operation on the model matrix M and the splitting matrix F to obtain the operation result of the second mathematical operation;

[0092] Performing a third mathematical operation on the operation result of the second mathematical operation and the view matrix V, and using the operation result of the third mathematical operation as the operation result of the first mathematical operation.

[0093] In this way, it is possible to avoid directly inputting the splitting matrix F into the graphics card, preventing the problem of reduced rendering precision caused when the data in the splitting matrix F exceeds the precision range of the graphics card.

[0094] In some embodiments, the above splitting of the vertex coordinates into a combination of small vertex coordinates and the splitting matrix F may include:

[0095] Taking one of the vertex coordinates of the model to be rendered as the origin to create a splitting coordinate system;

[0096] Taking the coordinates of each vertex of the model to be rendered in the splitting coordinate system as the small vertex coordinates, and taking the transformation matrix between the modeling coordinate system and the splitting coordinate system as the splitting matrix F.

[0097] For ease of understanding, in combination with reference to Figure 4 , a schematic diagram of the relationship between the modeling coordinate system and the splitting coordinate system provided by an embodiment of the present application is shown. Figure 4In this case, a cube is used to represent the model to be rendered, and a coordinate system XYZ is used to represent the modeling coordinate system. The model to be rendered is located in the modeling coordinate system. Assuming that the vertex coordinate T of the model to be rendered is used as the origin, a split coordinate system X1Y1Z1 can be constructed. The coordinates of each vertex of the model to be rendered in the split coordinate system X1Y1Z1 can be used as the small vertex coordinates obtained by splitting.

[0098] It can be understood that after constructing the split coordinate system with one of the vertex coordinates of the model to be rendered as the origin, the coordinates of each vertex of the model to be rendered in the split coordinate system will not exceed the model size of the model to be rendered at most. Among them:

[0099] When the model size is large (that is, when the model size exceeds the precision range of the graphics card), the observer is usually at a relatively far position to observe the target object. From the above related descriptions, it can be seen that in this case, even if the numerical range of the small vertex coordinates exceeds the precision range of the graphics card, the problem of reduced rendering precision caused by it can be ignored.

[0100] When the model size is small (that is, when the model size does not exceed the precision range of the graphics card), the observer is usually at a relatively close position to observe the target object. In this case, it is necessary to render the model to be rendered with a higher precision. Also, since the small vertex coordinates obtained by splitting in this case will not exceed the model size at most, there will be no problem of reduced rendering precision caused by the numerical range of the small vertex coordinates exceeding the precision range of the graphics card.

[0101] Furthermore, it can be understood that in the transformation matrix (i.e., the split matrix F) between the modeling coordinate system and the split coordinate system, there may be data with a numerical range exceeding the precision range of the graphics card. However, based on the above-mentioned second mathematical operation performed on the model matrix M and the split matrix F, this problem can be eliminated.

[0102] In summary, create a split coordinate system with one of the vertex coordinates of the model to be rendered as the origin, and determine the small vertex coordinates and the split matrix F of the model to be rendered based on the split coordinate system. In this way, when it is necessary to render the model to be rendered with a higher precision, it can be ensured that the small vertex coordinates input to the graphics card will not exceed the precision range of the graphics card, thereby ensuring the rendering precision.

[0103] Furthermore, in some embodiments, the vertex coordinates of the model to be rendered are stored in a one-dimensional array. For example, assuming that the model to be rendered has 4 vertex coordinates T1, T2, T3, and T4. Then, the vertex coordinates of the model to be rendered can be expressed as {T1, T2, T3, T4}. Using one of the vertex coordinates of the model to be rendered as the origin to create a split coordinate system can include:

[0104] Using the first vertex coordinate in the one-dimensional array as the origin to create a split coordinate system.

[0105] In this way, when looking for the vertex coordinates of the model to be rendered as the origin, the search process can be simplified and the search efficiency is high.

[0106] Further, in some embodiments, creating a split coordinate system with one of the vertex coordinates of the model to be rendered as the origin may include:

[0107] Using one of the vertex coordinates of the model to be rendered as the origin and taking the axis directions of the modeling coordinate system as the axis directions of the split coordinate system to create the split coordinate system.

[0108] It can be understood that when the orientations of all axes between the modeling coordinate system and the split coordinate system are the same, when converting from the modeling coordinate system to the split coordinate system, only a translation operation needs to be performed and no rotation operation is required. In this way, the transformation matrix between the modeling coordinate system and the split coordinate system can be simplified, that is, the split matrix can be simplified.

[0109] Further, in some embodiments, when inputting the operation result of the first mathematical operation and the vertex coordinates into the graphics card, the rendering method of the present application further includes:

[0110] Inputting the projection matrix into the graphics card, where the projection matrix P represents the transformation matrix between the camera coordinate system and the perspective coordinate system.

[0111] Combined with expression (1), through the above related descriptions, it can be known that when it is necessary to render the model to be rendered with relatively high rendering precision, the result after M*V can be within the precision range of the graphics card. If the result after M*V is multiplied by the projection matrix P again, the obtained result may exceed the precision range of the graphics card. Therefore, the result after M*V and the projection matrix P can be separately input into the graphics card. In this way, at least it can be ensured that the result after M*V does not exceed the precision range of the graphics card, achieving the purpose of improving the rendering precision.

[0112] Refer to Figure 5 for a schematic diagram of the rendering device provided by an embodiment of the present application. Figure 5 In, the rendering device includes an application layer, a data service layer, a computing layer, and a physical layer. Among them, the application layer includes a model loading module and a camera module. The physical layer includes a graphics card.

[0113] The model loading module is used to load the model to be rendered, obtain the vertex coordinates and the initial model matrix of the model to be rendered, and write the obtained vertex coordinates and the initial model matrix into the data service layer. Here, the initial model matrix mainly refers to the model matrix. The camera module is used to provide a view matrix and a projection matrix for the computing layer.

[0114] The computing layer mainly performs the following operations:

[0115] 1) Based on the vertex coordinates of the data service layer, complete the splitting of the vertex coordinates to obtain small vertex coordinates and a splitting matrix;

[0116] 2) Based on the obtained splitting matrix, the model matrix in the data service layer, and the view matrix provided by the camera module, calculate the model view matrix;

[0117] 3) Input the small vertex coordinates, the model view matrix, and the projection matrix into the graphics card.

[0118] The graphics card renders the 3D model based on the acquired data.

[0119] Thus, the entire description of the rendering method is completed.

[0120] Corresponding to the rendering method, the present application also provides a rendering system. Please refer to Figure 6 , which is a schematic diagram of the modules of the rendering system provided by an embodiment of the present application. Figure 6 In

[0121] a data acquisition module, configured to acquire the vertex coordinates of the model to be rendered in the modeling coordinate system and the transformation matrix between coordinate systems, where the transformation matrix includes a model matrix for transforming from the modeling coordinate system to the world coordinate system and a view matrix for transforming from the world coordinate system to the camera coordinate system;

[0122] an operation module, configured to perform a first mathematical operation in the rendering process on the model matrix and the view matrix and obtain the operation result of the first mathematical operation;

[0123] a rendering module, configured to input the operation result of the first mathematical operation and the vertex coordinates into the graphics card when the numerical range of the vertex coordinates does not exceed the precision range supported by the graphics card, so that the graphics card renders the model to be rendered on the display screen based on the acquired data.

[0124] Please refer to Figure 7 , which is a schematic diagram of an electronic device provided by an embodiment of the present application. The electronic device includes a processor and a memory, and the memory is used to store a computer program, and when the computer program is executed by the processor, the above method is implemented.

[0125] Among them, the processor may be a Central Processing Unit (CPU). The processor may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., or a combination of the above types of chips.

[0126] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the method in the embodiments of the present invention. By running the non-transitory software programs, instructions, and modules stored in the memory, the processor executes various functional applications and data processing of the processor, that is, implements the method in the above method embodiments.

[0127] The memory may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created by the processor, etc. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely set relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0128] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program, and when the computer program is executed by a processor, the above method is implemented.

[0129] Although the embodiments of the present disclosure are described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations fall within the scope defined by the appended claims.

Claims

1. A rendering method, characterized in that: The method comprises: Obtaining a transformation matrix between vertex coordinates of a model to be rendered in a modeling coordinate system and a coordinate system, wherein the transformation matrix includes a model matrix for transforming from the modeling coordinate system to a world coordinate system and a view matrix for transforming from the world coordinate system to a camera coordinate system; Performing a first mathematical operation in a rendering process on the model matrix and the view matrix, and obtaining a result of the first mathematical operation; When the numerical range of the vertex coordinates does not exceed the precision range supported by the graphics card, the result of the first mathematical operation and the vertex coordinates are input into the graphics card, so that the graphics card renders the model to be rendered on the display screen based on the acquired data.

2. The method according to claim 1, characterized in that, When the numerical range of the vertex coordinates exceeds the precision range supported by the graphics card, the method further includes: Splitting the vertex coordinates into a combination of small vertex coordinates and a splitting matrix, wherein the absolute value of the small vertex coordinates is smaller than the absolute value of the vertex coordinates, and the splitting matrix represents a conversion relationship between the small vertex coordinates and the vertex coordinates; The small vertex coordinates obtained by splitting the vertex coordinates are input into the graphics card.

3. The method according to claim 2, wherein The step of splitting the vertex coordinates into a combination of small vertex coordinates and a splitting matrix includes: Creating a split coordinate system with the coordinates of one of the vertices of the model to be rendered as the origin; The coordinates of each vertex of the model to be rendered in the split coordinate system are used as the small vertex coordinates, and the conversion matrix between the modeling coordinate system and the split coordinate system is used as the split matrix.

4. The method according to claim 3, wherein The coordinates of each vertex of the model to be rendered are stored in a one-dimensional array; The step of creating a split coordinate system using one vertex coordinate of the model to be rendered as an origin includes: The split coordinate system is created by taking the first vertex coordinate in the one-dimensional array as the origin.

5. The method according to claim 3, characterized in that, The step of creating a split coordinate system using one vertex coordinate of the model to be rendered as an origin includes: The split coordinate system is created by taking the coordinates of one of the vertices of the model to be rendered as the origin and taking the coordinate axis direction of the modeling coordinate system as the coordinate axis direction of the split coordinate system.

6. The method according to any one of claims 2 to 5, characterized in that: The performing a first mathematical operation on the model matrix and the view matrix during the rendering process and obtaining a result of the first mathematical operation includes: performing a second mathematical operation on the model matrix and the split matrix to obtain a result of the second mathematical operation; A third mathematical operation is performed on the operation result of the second mathematical operation and the view matrix, and the operation result of the third mathematical operation is used as the operation result of the first mathematical operation.

7. The method according to claim 1, wherein In the case where the operation result of the first mathematical operation and the vertex coordinates are input into the graphics card, the method further includes: A projection matrix is input into the graphics card, wherein the projection matrix represents a transformation matrix between the camera coordinate system and the perspective coordinate system.

8. A rendering system, characterized in that, The system comprises: A data acquisition module, configured to acquire a transformation matrix between vertex coordinates of a model to be rendered in a modeling coordinate system and a coordinate system, wherein the transformation matrix includes a model matrix for transforming from the modeling coordinate system to a world coordinate system and a view matrix for transforming from the world coordinate system to a camera coordinate system; an operation module, configured to perform a first mathematical operation in a rendering process on the model matrix and the view matrix, and obtain an operation result of the first mathematical operation; A rendering module is used to input the result of the first mathematical operation and the vertex coordinates into the graphics card when the numerical range of the vertex coordinates does not exceed the precision range supported by the graphics card, so that the graphics card renders the model to be rendered on the display screen based on the acquired data.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that, The electronic device includes a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.