A method, apparatus, device and storage medium for rendering stereoscopic graphics

By using texture feature values ​​to find and associate stored graphic textures in 3D graphics rendering, the problem of excessively long rendering wait time is solved, achieving efficient 3D graphics rendering and optimizing user experience.

CN116778069BActive Publication Date: 2026-11-17GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210217985.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-07
Publication Date
2026-11-17
Estimated Expiration
2042-03-07

AI Technical Summary

Technical Problem

When dealing with a large number of 3D graphics, existing technologies suffer from excessively long rendering times, impacting user experience.

Method used

By determining the texture feature values ​​of each 3D graphic individually, and finding and associating stored or directly utilizing graphic textures with the same texture feature values, repeated rendering operations are reduced.

Benefits of technology

It improves the efficiency of 3D graphics rendering, reduces rendering waiting time, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116778069B_ABST
    Figure CN116778069B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and storage medium for rendering stereoscopic graphics. The technical solution provided by this application, when drawing the texture corresponding to each graphic to be drawn in a stereoscopic graphic, first determines the texture feature value of the graphic to be drawn, and then determines whether there is a graphic texture with the same texture feature value. If no graphic texture with the same texture feature value exists, the graphic to be drawn is rendered to obtain the graphic texture. The graphic texture is drawn on a two-dimensional canvas according to the position information of the graphic to be drawn, and the graphic texture is recorded according to the texture feature value. If a graphic texture with the same texture feature value exists, the graphic texture is directly drawn on the two-dimensional canvas according to the position information of the graphic to be drawn, without needing to render the graphic to be drawn. Graphics of the same shape only need to be rendered once, effectively improving the rendering efficiency of stereoscopic graphics and enhancing the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, device and storage medium for rendering stereoscopic graphics. Background Technology

[0002] With the development of image processing technology, the application of rendering and displaying three-dimensional graphics is becoming increasingly widespread. Three-dimensional graphics can be drawn onto a two-dimensional canvas through rendering. For example, in the process of teaching solid geometry, it is necessary to display a two-dimensional graphic composed of multiple three-dimensional graphics on a two-dimensional canvas. Multiple three-dimensional graphics can be combined into the required three-dimensional shape, and each three-dimensional graphic can be rendered and drawn onto the two-dimensional canvas separately.

[0003] Because rendering 3D shapes involves rendering each 3D graphic sequentially, a large number of 3D graphics can lead to excessively long rendering wait times, negatively impacting the user experience. Summary of the Invention

[0004] This application provides a method, apparatus, device, and storage medium for rendering stereoscopic graphics, in order to solve the technical problem in the related art that when the number of stereoscopic graphics is large, the rendering waiting time is easily too long, which affects the user experience, thereby improving the efficiency of stereoscopic graphics rendering and enhancing the user experience.

[0005] In a first aspect, embodiments of this application provide a method for rendering stereoscopic graphics, including:

[0006] The texture feature values ​​of the graphics to be drawn in the 3D graphic are determined one by one. Based on the texture feature values, the graphic texture with the same texture feature values ​​is searched in the set storage location. The 3D graphic includes at least two graphics to be drawn.

[0007] In response to a failed search result, a graphic texture is rendered based on the graphic to be drawn, the texture feature value and the graphic texture are associated and stored in a set storage location, and the graphic texture is drawn onto a two-dimensional canvas according to the position information of the graphic to be drawn in the three-dimensional graphic.

[0008] In response to a successful search result, the texture of the found graphic is drawn onto the two-dimensional canvas according to the position information of the graphic to be drawn.

[0009] In a second aspect, embodiments of this application provide a stereoscopic graphics rendering apparatus, including a texture lookup module, a first drawing module, and a second drawing module, wherein:

[0010] The texture lookup module is used to determine the texture feature values ​​of the graphics to be drawn in the 3D graphic one by one, and to search for graphic textures with the same texture feature values ​​in a set storage location according to the texture feature values. The 3D graphic includes at least two graphics to be drawn.

[0011] The first drawing module is used to respond to the search result of a failed search, render a graphic texture based on the graphic to be drawn, associate and store the texture feature value and the graphic texture in a set storage location, and draw the graphic texture onto a two-dimensional canvas according to the position information of the graphic to be drawn in the three-dimensional graphic.

[0012] The second drawing module is used to draw the texture of the found graphic onto the two-dimensional canvas according to the position information of the graphic to be drawn in response to a successful search result.

[0013] In a third aspect, embodiments of this application provide a stereoscopic graphics rendering device, including: a memory and one or more processors;

[0014] The memory is used to store one or more programs;

[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement the stereoscopic graphics rendering method as described in the first aspect.

[0016] In a fourth aspect, embodiments of this application provide a storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform the stereoscopic graphics rendering method as described in the first aspect.

[0017] This application embodiment, when drawing the graphic textures corresponding to each graphic to be drawn in a 3D graphic, first determines the texture feature value of the graphic to be drawn, and then determines whether there is a graphic texture with the same texture feature value. If there is no graphic texture with the same texture feature value, the graphic to be drawn is rendered to obtain the graphic texture. The graphic texture is drawn on a 2D canvas according to the position information of the graphic to be drawn, and the graphic texture is recorded according to the texture feature value. If there is a graphic texture with the same texture feature value, the graphic texture is directly drawn on the 2D canvas according to the position information of the graphic to be drawn, without rendering the graphic to be drawn. The graphic textures of different shapes of graphic to be drawn are recorded based on the texture feature value. Graphic to be drawn with the same texture feature value can be drawn directly using the previously recorded graphic texture. Graphic to be drawn with the same shape only needs to be rendered once, which effectively improves the rendering efficiency of 3D graphics and enhances the user experience. Attached Figure Description

[0018] Figure 1This is a flowchart of a stereoscopic graphics rendering method provided in an embodiment of this application;

[0019] Figure 2 This is a schematic diagram illustrating the rendering and display effect of a three-dimensional graphic on a two-dimensional canvas, provided in an embodiment of this application.

[0020] Figure 3 This is a flowchart of another stereoscopic graphics rendering method provided in the embodiments of this application;

[0021] Figure 4 This is a schematic diagram of a visible vertex determination process provided in an embodiment of this application;

[0022] Figure 5 This is a schematic diagram of the structure of a stereoscopic graphics rendering device provided in an embodiment of this application;

[0023] Figure 6 This is a schematic diagram of the structure of a stereoscopic graphics rendering device provided in an embodiment of this application. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0025] Figure 1 A flowchart of a stereoscopic graphics rendering method provided in an embodiment of this application is given. The stereoscopic graphics rendering method provided in this embodiment of the application can be executed by a stereoscopic graphics rendering device, which can be implemented by hardware and / or software and integrated into a stereoscopic graphics rendering equipment.

[0026] The following description uses a stereoscopic graphics rendering device to perform a stereoscopic graphics rendering method as an example. (Reference) Figure 1 The method for rendering 3D graphics includes:

[0027] S101: Determine the texture feature values ​​of the graphics to be drawn in the 3D graphic one by one, and search for the graphic texture with the same texture feature value in the set storage location according to the texture feature value. The 3D graphic includes at least two graphics to be drawn.

[0028] The solid figure includes at least two figures to be drawn. These figures are solid geometric shapes, and a solid figure is composed of two or more solid geometric shapes. The figures to be drawn are recorded using the graphic parameters of the solid geometric shapes (such as the coordinates of each vertex (i.e., position information), the color of each face, the fill method, the line type, etc.). They can also be recorded in the form of three-dimensional graphics. Furthermore, the figures to be drawn in the solid figure can be recorded in a designated graphic recording file (such as a teaching file used by teachers).

[0029] This embodiment displays the graphic textures rendered from the graphics to be drawn using a two-dimensional canvas. For example, a two-dimensional canvas is loaded and displayed on a page (such as a teaching page used by a teacher), and the graphic textures corresponding to each graphic to be drawn are displayed on the two-dimensional canvas. The rendering of the graphics to be drawn can occur when a new graphic is created or the corresponding graphic record file is opened, or it can occur during operations that affect the display of the graphic textures, such as rotation, filling, or adding, deleting, or modifying the graphic textures on the two-dimensional canvas or page.

[0030] In related technologies, when rendering the texture corresponding to a graphic to be drawn, each graphic is rendered and drawn independently. As the number of graphics to be drawn increases, the time consumed by each re-rendering and drawing also increases. Furthermore, because the operating environment is in a two-dimensional canvas, it cannot meet the requirements of a complete 3D graphics drawing GPU batching acceleration solution. Batch rendering and drawing of graphics to be drawn results in excessively long user wait times, noticeable page lag, and a poor user experience. For example, in teaching scenarios, 3D graphics are often presented on a courseware page (two-dimensional canvas) using two-dimensional graphics (textures). Typically, a 3D graphic is represented by a combination of multiple two-dimensional graphics (a 3D combination of multiple graphics to be drawn). Because the rendering of each graphic to be drawn is independent, each graphic needs to be rendered and drawn once, resulting in a long waiting time for the teacher to see the final 2D combination displayed. This leads to noticeable lag on the courseware page and a poor user experience. The 3D graphics rendering method provided in this solution only requires one rendering operation to obtain the graphic texture for graphics of the same shape. Subsequent graphics of the same shape can be drawn on a 2D canvas based on this graphic texture, which improves the rendering efficiency of graphics, reduces the lag of courseware page operation, and effectively optimizes the user experience.

[0031] Texture feature values ​​reflect the shape characteristics of the graphic to be drawn. Generally, graphics with the same shape have consistent shape characteristics, and their corresponding texture feature values ​​are also consistent. For example, texture feature values ​​can be calculated using the vertex coordinates (relative coordinates of vertices relative to the center of the graphic) in the graphic to be drawn. For instance, sorting the vertex coordinates of the graphic to obtain a coordinate array, stringifying the coordinate array, calculating the hash value corresponding to the stringified coordinate array, and using the hash value as the texture feature value. The vertices involved in the texture feature value calculation can be all vertices of the graphic to be drawn, or only the visible vertices (i.e., vertices that are not occluded).

[0032] For example, when drawing a graphic texture on a two-dimensional canvas, each graphic to be drawn in the three-dimensional graphic is read one by one. For each graphic to be drawn, the texture feature value of the graphic to be drawn is first determined, and then a graphic texture with the same texture feature value is searched from the storage location set for recording and storing graphic textures. Here, the graphic texture is the graphic texture obtained by rendering the graphic to be drawn in the previous process. Further, if a graphic texture with the same texture feature value is not found, the process jumps to step S102; if a graphic texture with the same texture feature value is found, the process jumps to step S103.

[0033] S102: In response to the search result of search failure, render the graphic texture based on the graphic to be drawn, associate the texture feature value and the graphic texture with the set storage location, and draw the graphic texture onto the two-dimensional canvas according to the position information of the graphic to be drawn in the three-dimensional graphic.

[0034] Understandably, if the search result is a failure, meaning that there is no graphic texture with the same texture feature value, it can be determined that the graphic to be processed with the same shape was not rendered in the previous rendering operation. The graphic to be drawn needs to be rendered, and it is impossible to use the existing graphic texture for drawing.

[0035] For example, for each graphic to be drawn, if it is determined that no graphic texture with the same texture feature value exists, the graphic to be drawn is rendered to obtain a graphic texture. Further, the texture feature value and the graphic texture are associated and stored in a designated storage location, so that the graphic texture can be retrieved later based on the texture feature value. Optionally, the associated storage of the texture feature value and the graphic texture can be done using key-value pairs, that is, using the texture feature value as the key and the associated graphic texture as the value, and storing the key-value pairs in a key-value pair list set in the storage location.

[0036] Simultaneously, after rendering the graphic texture, the texture is drawn onto a 2D canvas based on the position information of the graphic to be drawn within the 3D graphic, displaying the projection effect of the graphic onto the 2D canvas. The position information of the graphic to be drawn records its position within the 3D graphic, and the position for drawing the graphic texture onto the 2D canvas can be determined from the position information of the graphic to be drawn, based on the mapping relationship between the 2D canvas and the virtual camera.

[0037] After rendering the graphic texture onto the 2D canvas, the next graphic to be drawn is read, and the drawing method is determined based on the texture feature value of the graphic to be drawn, until all the graphics to be drawn are drawn.

[0038] The graphic texture includes line segments (connections between graphic vertices), line segment types (e.g., solid lines, dashed lines), and line segment or side color. In one possible embodiment, the line segment type can be determined based on the type of the graphic vertices at both ends or whether the graphic side it occupies is visible. That is, if both graphic vertices at both ends are visible vertices or one of the graphic side occupies is a visible side, the line segment type is solid; otherwise, the line segment type is dashed. The line segment or side color can be determined based on the line segment type, whether the graphic side is visible, and the graphic recording file, or by setting the transparency of the color of the visible graphic side to more clearly represent the invisible line segments. The line segments in the graphic texture obtained by rendering the graphic to be drawn can include a combination of solid and dashed lines (displaying a perspective effect) or only solid lines (displaying a realistic display effect).

[0039] S103: In response to a successful search result, draw the texture of the found graphic onto the two-dimensional canvas based on the position information of the graphic to be drawn.

[0040] For example, if the search result is successful, that is, when it is determined that there is a graphic texture with the same texture feature value, since the rendering process of each graphic to be drawn is independent, the graphic texture rendered by the graphic to be drawn with the same texture feature value is consistent. There is no need to render the graphic to be drawn again. The graphic texture with the same texture feature can be directly obtained, and the graphic texture can be drawn onto the two-dimensional canvas according to the position information of the graphic to be drawn, and the display effect of the graphic to be drawn projected onto the two-dimensional canvas can be displayed.

[0041] After drawing the graphic textures obtained based on the same texture features onto the 2D canvas, the next graphic to be drawn is read, and the drawing method is determined according to the texture feature values ​​of the graphic to be drawn, until all the graphics to be drawn are drawn.

[0042] In one possible embodiment, the calculation of the texture feature value of the graphic to be drawn can be based on its relative coordinates. When drawing the graphic texture onto a two-dimensional canvas, it can be positioned and drawn based on the absolute coordinates of each vertex of the graphic to be drawn or the graphic texture relative to the two-dimensional canvas. The absolute coordinates can be obtained by mapping from the position information of the graphic to be drawn according to the set mapping relationship between the two-dimensional canvas and the virtual camera.

[0043] Suppose that in the teaching page (two-dimensional canvas) used by the teacher, in the teaching of solid geometry (at this time, the solid figure is composed of multiple independent figures to be drawn), there is a teaching scenario where the two-dimensional image corresponding to the solid figure composed of multiple figures to be drawn (e.g., cubes) needs to be projected onto the teaching page. Students analyze the number of figures to be drawn (e.g., cubes) contained in the corresponding solid combination through the two-dimensional image. When the teacher adds, deletes, drags, rotates, etc. based on the solid geometry provided by the system to form a solid figure from multiple figures to be drawn, opens the teaching page for rendering the two-dimensional image of the solid figure, and modifies, drags, rotates, etc. on the teaching page, the two-dimensional image of the solid figure to be rendered and drawn is determined. At this time, each solid geometry in the solid figure is a figure to be drawn and participates in the solid figure rendering process of steps S101-S103.

[0044] by Figure 2 Taking the rendering and display effect of a 3D graphic on a 2D canvas as an example, assuming the 3D graphic is composed of 3 graphics to be drawn, including 2 cubes (graphics A and B to be drawn) and 1 triangular prism (graphic C to be drawn), if the graphics to be drawn are read in the order of A, B, and C, then when graphic A is read, after calculating the texture feature value of graphic A, if no graphic texture with the same texture feature value has been previously recorded, then graphic A is rendered to obtain the corresponding graphic texture. The graphic texture is recorded based on the texture feature value, and the graphic texture is drawn onto the 2D canvas according to the position information of graphic A. Next, graphic B is read. After calculating the texture feature value of graphic B, if a graphic texture with the same texture feature value (the graphic texture of graphic A) is found, then the texture feature value is directly obtained, and the obtained graphic texture is drawn onto the 2D canvas according to the position information of graphic B. Finally, the graphic C to be drawn is read. After calculating the texture feature value of graphic C, if no graphic texture with the same texture feature value is found, the graphic C is rendered to obtain the corresponding graphic texture. The graphic texture is drawn onto the 2D canvas according to the position information of graphic C (it is optional to record the graphic texture based on the texture feature value). The final drawing effect of multiple graphic textures displayed on the 2D canvas is as follows. Figure 2 As shown.

[0045] Understandably, as the number of combined 3D graphics increases, the time required for each 2D canvas redraw also increases. This solution records the rendered graphic texture, allowing subsequent graphics of the same shape to be drawn directly on the 2D canvas using this texture. This reduces the time-consuming rendering process for graphics of the same shape, requiring only one rendering of graphics of the same shape, thus accelerating the rendering efficiency of 3D graphics.

[0046] In one possible embodiment, the determination of whether to determine the texture by rendering or directly based on the same texture feature value is only made when the number of graphics to be drawn is large. Based on this, before determining the texture feature value of the graphics to be drawn, the method further includes: determining the number of graphics to be drawn; if the number of graphics reaches a set threshold, determining to search for a texture with the same texture feature value in a set storage location based on the texture feature value of the graphics to be drawn; if the number of graphics does not reach the set threshold, directly rendering the texture based on the graphics to be drawn, and drawing the texture onto a two-dimensional canvas based on the position information of the graphics to be drawn in the three-dimensional graphics.

[0047] For example, when drawing a graphic texture on a 2D canvas, the number of graphics to be drawn is first determined, and this number is compared with a set threshold. When the number of graphics reaches the threshold, it is determined whether a graphic texture with the same texture feature value exists based on the texture feature value of the graphics to be drawn. That is, each graphic to be drawn is traversed, and the steps corresponding to the 3D graphics rendering method in S101-S103 are executed. When the number of graphics does not reach the threshold, the graphic texture is directly rendered based on the graphics to be drawn, and the graphic texture is drawn onto the 2D canvas according to the position information of the graphics to be drawn in the 3D graphics. That is, each graphic to be drawn is traversed, and after the graphic texture is obtained by rendering the graphics to be drawn, the graphic texture is directly drawn onto the 2D canvas according to the position information of the graphics to be drawn in the 3D graphics, without calculating the texture feature value of the graphics to be drawn or recording the rendered graphic texture.

[0048] As described above, when drawing the textures of various shapes in a 3D model, the texture feature values ​​of the shapes to be drawn are first determined. Based on the texture feature values, it is determined whether there are textures with the same texture feature values. If there are no textures with the same texture feature values, the shape to be drawn is rendered to obtain the texture. The texture is drawn on a 2D canvas based on the position information of the shape to be drawn, and the texture is recorded based on the texture feature values. If there are textures with the same texture feature values, the texture is drawn directly on the 2D canvas based on the position information of the shape to be drawn, without needing to render the shape to be drawn. Based on the texture feature values, the textures of different shapes of shapes to be drawn are recorded. Shapes to be drawn with the same texture feature values ​​can be drawn directly using the previously recorded textures. Shapes to be drawn with the same shape only need to be rendered once, effectively improving the rendering efficiency of 3D graphics and enhancing the user experience.

[0049] Based on the above embodiments, Figure 3 A flowchart of another stereoscopic graphics rendering method provided in an embodiment of this application is given, which is a concretization of the above-described stereoscopic graphics rendering method. (Reference) Figure 3 The method for rendering 3D graphics includes:

[0050] S201: Determine the coordinates of each visible vertex in the three-dimensional figure to be drawn, projected onto the two-dimensional canvas.

[0051] Before rendering the graphic to be drawn, texture feature values ​​are calculated based on the vertices of the graphic. This embodiment describes the calculation of texture feature values ​​using the visible vertices of the graphic as an example. For example, each visible vertex of the graphic to be drawn is projected onto a two-dimensional canvas, and the vertex coordinates of each visible vertex projected onto the two-dimensional canvas are determined.

[0052] In this context, vertex coordinates are the relative coordinates of the visible vertices of the graphic to be drawn relative to the center of the graphic itself. It can be understood that for visible vertices at the same position in graphic elements of the same shape, although their final positions drawn on the 2D canvas may differ, their relative coordinates relative to the center of the graphic are the same. Using relative coordinates to represent vertex coordinates ensures that the vertex coordinates of visible vertices at the same position in graphic elements of the same shape are identical, and the calculated texture feature values ​​are also identical, guaranteeing the correct texture is found.

[0053] In one embodiment, before determining the coordinates of each visible vertex projected onto the 2D canvas from the 3D drawing, the visible vertices can be determined from each vertex based on the angular relationship between the face (side face) associated with each vertex (vertex) and the virtual camera used for rendering. Based on this, as... Figure 4 As shown in the schematic diagram of a visible vertex determination process, this embodiment further includes the following steps before determining the vertex coordinates of each visible vertex in the three-dimensional graphic to be drawn and projected onto the two-dimensional canvas:

[0054] S2011: Determine the side faces of the graphic associated with each vertex of the graphic to be drawn.

[0055] S2012: Determine the visible vertices from the vertices of the graphic based on the angular relationship between the side of the graphic and the virtual camera.

[0056] For example, the side faces associated with each vertex of the graphic to be drawn are determined. Taking a cube-shaped graphic as an example, each vertex is associated with three side faces. Furthermore, for each vertex, the angular relationship between its associated side faces and the virtual camera is determined, and based on the angular relationship, it is determined whether to define the vertex as a visible vertex.

[0057] In one embodiment, determining visible vertices from the vertices of a graphic based on the angular relationship between the graphic's side and the virtual camera specifically includes: determining the angle between the normal vector of the graphic's side and the direction vector of the virtual camera, and identifying graphic vertices with corresponding obtuse angles as visible vertices. The virtual camera can be an orthogonal camera, and its position (pose) is fixed.

[0058] For example, for each side face of a given vertex, the normal vector of the side face is obtained, and the angle between the normal vector and the direction vector of the virtual camera is calculated. If any of these angles is obtuse, the corresponding vertex is determined to be a visible vertex; otherwise, it is determined to be an invisible vertex. By accurately filtering the visible vertices in the graphic to be drawn through the angular relationship between the side face and the virtual camera, the calculation speed of texture feature values ​​is effectively accelerated, improving the efficiency of graphics rendering.

[0059] In one possible embodiment, the angle between the normal vector of the side of the graphic and the direction vector of the virtual camera can be calculated first, and the graphic vertices associated with the side of the graphic where the angle is obtuse can be determined as visible vertices.

[0060] S202: Sort the vertex coordinates of the graphic to be drawn according to the set sorting method to obtain the vertex coordinate array.

[0061] For example, for each graphic to be drawn, after determining the visible vertices in the graphic, the vertex coordinates of these visible vertices are obtained, and these vertex coordinates are sorted according to a set sorting method, and a vertex coordinate array is obtained based on the sorted vertex coordinates.

[0062] The sorting method for vertex coordinates can be based on the vertex coordinates themselves. In one embodiment, the sorting method provided in this embodiment can be to sort the vertex coordinates in ascending (or descending) order of horizontal axis coordinates and ascending (or descending) order of vertical axis coordinates. That is, first sort the vertex coordinates in ascending (or descending) order of horizontal axis coordinates, and then sort the vertex coordinates in ascending (or descending) order of vertical axis coordinates for vertices with the same horizontal axis coordinates.

[0063] In other embodiments, the sorting method can also be set to sort the vertex coordinates in ascending (or descending) order of the vertical axis coordinates and in ascending (or descending) order of the horizontal axis coordinates. That is, first sort the vertex coordinates in ascending (or descending) order of the vertical axis coordinates, and then sort the vertex coordinates in ascending (or descending) order of the horizontal axis coordinates among the vertices with the same vertical axis coordinates.

[0064] S203: Stringify the vertex coordinate array to obtain the vertex coordinate string, and calculate the texture feature value based on the vertex coordinate string.

[0065] For example, after sorting the vertex coordinates to obtain a vertex coordinate array, the vertex coordinate array is converted into a string, and the texture feature value corresponding to the current graphic to be drawn is further calculated based on the vertex coordinate string.

[0066] In one possible embodiment, a hash value can be used as the texture feature value. Based on this, when calculating the texture feature value from the vertex coordinate string, specifically: calculate the hash value corresponding to the vertex coordinate string and use the hash value as the texture feature value of the graphic to be drawn. After obtaining the vertex coordinate string after converting the vertex coordinate array into a string, calculate the hash value from the vertex coordinate string and use this hash value as the texture feature value of the current graphic to be drawn. The hash value can be an MD5 value, SHA1 value, SHA256 value, etc.

[0067] For example, taking a cube-shaped graphic to be drawn as an example, suppose the graphic has 7 visible vertices P0-P6, and the vertex coordinates corresponding to the visible vertices P0-P6 are [0,1], [0,2], [1,0], [2,0], [1,1], [1,2], and [2,1], respectively. After sorting these vertex coordinates according to the set sorting method of ascending horizontal axis coordinates and ascending vertical axis coordinates, the resulting vertex coordinate array is: [[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1]]. Further, after converting the vertex coordinate array into a JSON string and performing MD5 hash calculation, the texture feature value of the graphic to be drawn is obtained as: f33e68c7e151962fd114a4caf0882642.

[0068] S204: Search for a graphic texture with the same texture feature value in the set storage location based on the texture feature value.

[0069] S205: In response to the search result of search failure, render the graphic texture based on the graphic to be drawn, associate the texture feature value and the graphic texture with the set storage location, and draw the graphic texture onto the two-dimensional canvas according to the position information of the graphic to be drawn in the three-dimensional graphic.

[0070] S206: In response to a successful search result, draw the texture of the found graphic onto the two-dimensional canvas based on the position information of the graphic to be drawn.

[0071] The above method, when drawing textures for various shapes in a 3D model, first determines the texture feature value of each shape. Based on this feature value, it checks if a texture with the same feature value exists. If no texture with the same feature value exists, the shape is rendered to obtain the texture. The texture is then drawn on a 2D canvas based on the shape's position information, and the texture is recorded according to its feature value. If a texture with the same feature value exists, it is drawn directly on the 2D canvas based on the shape's position information, without needing to render the shape itself. By recording the textures of different shapes based on their feature values, shapes with the same feature value can be drawn directly using the previously recorded texture. Shapes of the same shape only need to be rendered once, effectively improving the rendering efficiency of 3D graphics and enhancing the user experience. This method also significantly improves rendering efficiency when rendering a large number of identical 3D geometric shapes on a page, reduces system response time, enhances the user's creative experience, and reduces limitations on user imagination due to system performance issues. Meanwhile, vertex coordinate data is obtained by sorting the vertex coordinates of each visible vertex of the graphic to be drawn, and the texture feature value of the stringified vertex coordinate data is calculated. The vertex coordinates are represented by relative coordinates to ensure that the vertex coordinates of visible vertices at the same position in the graphic to be drawn of the same shape are the same, and the calculated texture feature values ​​are also the same, thus ensuring that the correct graphic texture is found and the correct graphic texture is drawn on the two-dimensional canvas.

[0072] Figure 5 A schematic diagram of the structure of a stereoscopic graphics rendering device provided in an embodiment of this application is given. (Reference) Figure 5 The stereoscopic graphics rendering device includes a texture lookup module 51, a first drawing module 52, and a second drawing module 53.

[0073] The texture lookup module 51 is used to determine the texture feature values ​​of the graphics to be drawn in the 3D graphic one by one, and to search for graphic textures with the same texture feature values ​​in a set storage location based on the texture feature values. The 3D graphic includes at least two graphics to be drawn. The first drawing module 52 is used to render graphic textures based on the graphics to be drawn in response to the search failure result, associate and store the texture feature values ​​and the graphic textures in a set storage location, and draw the graphic textures onto a 2D canvas according to the position information of the graphics to be drawn in the 3D graphic. The second drawing module 53 is used to draw the found graphic textures onto a 2D canvas according to the position information of the graphics to be drawn in response to the search success result.

[0074] As described above, when drawing the textures of various shapes in a 3D model, the texture feature values ​​of the shapes to be drawn are first determined. Based on the texture feature values, it is determined whether there are textures with the same texture feature values. If there are no textures with the same texture feature values, the shape to be drawn is rendered to obtain the texture. The texture is drawn on a 2D canvas based on the position information of the shape to be drawn, and the texture is recorded based on the texture feature values. If there are textures with the same texture feature values, the texture is drawn directly on the 2D canvas based on the position information of the shape to be drawn, without needing to render the shape to be drawn. Based on the texture feature values, the textures of different shapes of shapes to be drawn are recorded. Shapes to be drawn with the same texture feature values ​​can be drawn directly using the previously recorded textures. Shapes to be drawn with the same shape only need to be rendered once, effectively improving the rendering efficiency of 3D graphics and enhancing the user experience.

[0075] This application also provides a stereo graphics rendering device, which can integrate the stereo graphics rendering apparatus provided in this application. Figure 6 This is a schematic diagram of the structure of a stereoscopic graphics rendering device provided in an embodiment of this application. (Reference) Figure 6 The stereoscopic graphics rendering device includes: an input device 63, an output device 64, a memory 62, and one or more processors 61; the memory 62 is used to store one or more programs; when one or more programs are executed by one or more processors 61, the one or more processors 61 implement the stereoscopic graphics rendering method provided in the above embodiments. The input device 63, output device 64, memory 62, and processors 61 can be connected via a bus or other means. Figure 6 Taking the example of a connection between China and Israel via a bus.

[0076] The memory 62, as a computing device readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the stereoscopic graphics rendering method in any embodiment of this application (e.g., texture lookup module 51, first drawing module 52, and second drawing module 53 in a stereoscopic graphics rendering apparatus). The memory 62 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device, etc. Furthermore, the memory 62 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 62 may further include memory remotely located relative to the processor 61, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0077] Input device 63 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 64 may include display devices such as a display screen.

[0078] The processor 61 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 62, thereby realizing the above-mentioned stereoscopic graphics rendering method.

[0079] The stereoscopic graphics rendering apparatus, device, and computer provided above can be used to execute the stereoscopic graphics rendering method provided in any of the above embodiments, and have corresponding functions and beneficial effects.

[0080] This application embodiment also provides a storage medium for storing computer-executable instructions. When executed by a computer processor, the computer-executable instructions are used to execute the stereoscopic graphics rendering method provided in the above embodiments. The stereoscopic graphics rendering method includes: determining the texture feature values ​​of the graphics to be drawn in the stereoscopic graphics one by one; searching for graphic textures with the same texture feature values ​​in a set storage location according to the texture feature values; the stereoscopic graphics include at least two graphics to be drawn; in response to a search failure result, rendering a graphic texture based on the graphics to be drawn; associating and storing the texture feature values ​​and the graphic textures in a set storage location; and drawing the graphic textures onto a two-dimensional canvas according to the position information of the graphics to be drawn in the stereoscopic graphics; in response to a search success result, drawing the found graphic textures onto the two-dimensional canvas according to the position information of the graphics to be drawn.

[0081] Storage medium – any type of memory device or storage device. The term “storage medium” is intended to include: mounting media, such as CD-ROMs, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disks or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. Furthermore, storage media may reside in a first computer system in which a program is executed, or may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term “storage medium” can include two or more storage media that may reside in different locations (e.g., in different computer systems connected via a network). Storage media may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.

[0082] Of course, the storage medium for storing computer-executable instructions provided in the embodiments of this application is not limited to the stereoscopic graphics rendering method provided above, but can also execute related operations in the stereoscopic graphics rendering method provided in any embodiment of this application.

[0083] The stereoscopic graphics rendering apparatus, device, and storage medium provided in the above embodiments can execute the stereoscopic graphics rendering method provided in any embodiment of this application. For technical details not described in detail in the above embodiments, please refer to the stereoscopic graphics rendering method provided in any embodiment of this application.

[0084] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments provided herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.

Claims

1. A method for rendering 3D graphics, characterized in that, include: Determine the vertex coordinates of each visible vertex in the three-dimensional figure to be drawn and project them onto the two-dimensional canvas; The vertex coordinates of the graphic to be drawn are sorted according to a set sorting method to obtain a vertex coordinate array; the vertex coordinate array is stringified to obtain a vertex coordinate string, and a texture feature value is calculated based on the vertex coordinate string; the texture feature value is used to find a graphic texture with the same texture feature value in a set storage location; the three-dimensional graphic includes at least two graphics to be drawn, wherein the vertex coordinates are the relative coordinates of the visible vertex with respect to the graphic to be drawn; In response to a failed search result, a graphic texture is rendered based on the graphic to be drawn, the texture feature value and the graphic texture are associated and stored in a set storage location, and the graphic texture is drawn onto a two-dimensional canvas according to the position information of the graphic to be drawn in the three-dimensional graphic. In response to a successful search result, the texture of the found graphic is drawn onto the two-dimensional canvas according to the position information of the graphic to be drawn.

2. The stereoscopic graphics rendering method according to claim 1, characterized in that, The step of calculating texture feature values ​​based on the vertex coordinate string includes: Calculate the hash value corresponding to the vertex coordinate string, and use the hash value as the texture feature value of the graphic to be drawn.

3. The stereoscopic graphics rendering method according to claim 1, characterized in that, The sorting method is to sort the vertex coordinates in ascending order of horizontal axis coordinates and then in ascending order of vertical axis coordinates.

4. The stereoscopic graphics rendering method according to claim 1, characterized in that, The vertex coordinates are the relative coordinates of the visible vertices of the graphic to be drawn with respect to the center of the graphic.

5. The stereoscopic graphics rendering method according to claim 1, characterized in that, Before determining the vertex coordinates of each visible vertex in the three-dimensional graphic to be drawn projected onto the two-dimensional canvas, the process also includes: Determine the side surface of each vertex in the graphic to be drawn; Visible vertices are determined from the vertices of the graphic based on the angular relationship between the side of the graphic and the virtual camera.

6. The stereoscopic graphics rendering method according to claim 5, characterized in that, The step of determining visible vertices from the vertices of the graphic based on the angular relationship between the side of the graphic and the virtual camera includes: Determine the angle between the normal vector of the side of the graphic and the direction vector of the virtual camera; The vertices of the graphic whose corresponding vectors have an obtuse angle are identified as visible vertices.

7. The stereoscopic graphics rendering method according to any one of claims 1-6, characterized in that, Before calculating the texture feature values, the method further includes: Determine the number of graphics to be drawn; If the number of graphics reaches a set threshold, then a graphic texture with the same texture feature value is searched for in a set storage location based on the texture feature value of the graphic to be drawn. If the number of graphics does not reach the set threshold, the graphic texture is rendered directly based on the graphic to be drawn, and the graphic texture is drawn onto the two-dimensional canvas according to the position information of the graphic to be drawn in the three-dimensional graphic.

8. A stereoscopic graphics rendering device, characterized in that, It includes a texture lookup module, a first drawing module, and a second drawing module, wherein: The texture lookup module is used to determine the vertex coordinates of each visible vertex in the graphic to be drawn in the 3D graphic projected onto the 2D canvas; sort the vertex coordinates of the graphic to be drawn according to a set sorting method to obtain a vertex coordinate array; stringify the vertex coordinate array to obtain a vertex coordinate string; calculate the texture feature value based on the vertex coordinate string; and search for graphic textures with the same texture feature value in a set storage location based on the texture feature value. The 3D graphic includes at least two graphics to be drawn, wherein the vertex coordinates are the relative coordinates of the visible vertex with respect to the graphic to be drawn. The first drawing module is used to respond to the search result of a failed search, render a graphic texture based on the graphic to be drawn, associate and store the texture feature value and the graphic texture in a set storage location, and draw the graphic texture onto a two-dimensional canvas according to the position information of the graphic to be drawn in the three-dimensional graphic. The second drawing module is used to draw the texture of the found graphic onto the two-dimensional canvas according to the position information of the graphic to be drawn in response to a successful search result.

9. A stereoscopic graphics rendering device, characterized in that, include: Memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the stereoscopic graphics rendering method as described in any one of claims 1-7.

10. A storage medium for storing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the stereoscopic graphics rendering method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method and device for rendering characters

    CN103186919A

  • Image texture processing method and device, storage medium and electronic device

    CN108230434A