3D model cutting method, rendering method, cloud server, client and medium
By performing 3D model clipping calculations on a cloud server and sending the results to the client's GPU for rendering, the problem of high GPU computing power consumption is solved, improving rendering efficiency and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WELLINK TECH CO LTD
- Filing Date
- 2022-11-17
- Publication Date
- 2026-06-23
AI Technical Summary
In existing technologies, GPUs consume a significant amount of computing power during the primitive clipping process of 3D models, which affects rendering efficiency and user experience.
The model clipping data is obtained from the cloud server and clipping calculations are performed. After the clipping calculation results are generated, they are sent to the client's GPU for model rendering, reducing the computational burden on the GPU.
It reduces GPU computing power consumption and improves model rendering efficiency and user experience.
Smart Images

Figure CN115713536B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image rendering, and in particular to 3D model cutting methods, rendering methods, cloud servers, clients and media. Background Technology
[0002] After a 3D model is created, it needs to be transformed into an image and displayed on the screen. This process, known as image rendering, involves projecting the 3D model onto a 2D digital image.
[0003] When rendering images, GPUs typically go through stages such as geometric transformation, primitive assembly, primitive clipping, viewport coordinate transformation, and rasterization. During primitive clipping, the GPU removes unnecessary parts of the 3D model. Then, it performs viewport coordinate transformation and rasterization on the clipped 3D model. This allows the clipped portions of the 3D model to be removed during the viewport coordinate transformation and rasterization stages, thus improving rendering efficiency.
[0004] However, primitive clipping algorithms are complex and consume a lot of GPU computing power. Summary of the Invention
[0005] To reduce GPU computing power consumption, this application provides a 3D model cutting method, rendering method, cloud server, client, and medium.
[0006] Firstly, this application provides a 3D model cutting method, which adopts the following technical solution:
[0007] A 3D model cutting method, executed by a cloud server, the method comprising:
[0008] Obtain the model clipping data corresponding to the target model. The model clipping data includes: clipping range and vertex data. The vertex data is the vertex data corresponding to each vertex contained in the target model.
[0009] Based on the model pruning data corresponding to the target model, a pruning calculation is performed on the target model to obtain a pruning calculation result. The pruning calculation result is used to characterize the model information in the target model that is within the pruning range.
[0010] The clipping calculation results are sent to the client so that the client can render the model using the GPU.
[0011] By adopting the above technical solution, the cloud server performs pruning calculations on the target model based on the model pruning data corresponding to the target model, sends the pruning calculation results to the client, and then the client renders the model using the GPU. That is, in this embodiment, the cloud server performs pruning calculations on the target model, and the GPU does not need to perform pruning calculations. The GPU only needs to render the model based on the pruning calculation results, thereby reducing the GPU's computing power consumption.
[0012] In one possible implementation, the step of performing a pruning calculation on the target model based on the model pruning data corresponding to the target model to obtain the pruning calculation result includes any one of the following:
[0013] Based on the clipping range and the vertex data, calculate the data of each visible vertex. Each visible vertex is a vertex contained in the clipped model. The clipped model is the model within the clipping range of the target model.
[0014] Based on the clipping range and the vertex data, calculate the data of each visible vertex, and clip the target model based on the data of each visible vertex to obtain the clipped model.
[0015] By adopting the above technical solution, on the one hand, the pruning calculation result is the data of each visible vertex, that is, the cloud server can calculate the data of each vertex contained in the pruned model without the need for GPU calculation, thereby reducing the GPU's computing power consumption; on the other hand, the pruning calculation result can be the pruned model, that is, in addition to calculating the data of each vertex contained in the pruned model, the cloud server can also perform pruning operations on the target model based on the calculated vertex data. In other words, neither the calculation of each vertex data nor the pruning operation on the target model requires GPU execution, thereby further reducing the GPU's computing power consumption.
[0016] In another possible implementation, calculating the visual vertex data based on the clipping range and the individual vertex data includes:
[0017] Based on the clipping range, vertex data to be processed and vertex data to be retained are determined from each vertex data. The vertex data to be processed are vertex data located outside the clipping range, and the vertex data to be retained are vertex data located within the clipping range.
[0018] From the vertex data, determine the associated vertex data corresponding to the vertex data to be processed, and the associated vertex data and the vertex data to be processed can form a preset triangle;
[0019] Based on the vertex data to be processed and the corresponding associated vertex data, new vertex data is determined. The new vertex is the intersection point between the preset triangle and each boundary, and does not belong to any of the vertices. The boundary is the face that makes up the clipping range.
[0020] The newly added vertex data and the retained vertex data are determined as the respective visible vertex data.
[0021] By adopting the above technical solution, when the cloud server calculates the visible vertex data, it determines the associated vertex data corresponding to each vertex data to be processed based on the vertex data to be processed outside the clipping range. Then, it determines the new vertex data based on each vertex data to be processed and the corresponding associated vertex data. The remaining vertex data within the clipping range and the new vertex data corresponding to the intersection of the preset triangle and the boundary of the clipping range are used as the visible vertex data. That is, the cloud server can calculate the visible vertex data according to the above method, while the client GPU needs to calculate to obtain the visible vertex data. This reduces the processing process of the client GPU to clip vertex data, which helps to reduce the computing power consumption of the GPU.
[0022] In another possible implementation, based on the clipping range and any vertex data, the visible vertex data corresponding to any vertex data is calculated, including:
[0023] Based on the clipping range, it is determined whether any vertex data belongs to the vertex data to be processed or the vertex data to be retained;
[0024] If it belongs to the vertex data to be processed, then determine the associated vertex data corresponding to any vertex data from the vertex data;
[0025] Based on any vertex data and its corresponding associated vertex data, determine whether there is any newly added vertex data;
[0026] If it exists, the newly added vertex data will be identified as visible vertex data;
[0027] If a vertex belongs to the retained vertex data, then any vertex data is determined as the visible vertex data.
[0028] By adopting the above technical solution, when the cloud server calculates the visible vertex data, it can traverse each vertex data to determine the visible vertex data corresponding to each vertex data. Specifically, when determining the visible vertex data corresponding to any vertex data, if the vertex data is within the clipping range, the visible vertex data corresponding to that vertex data is that vertex data itself. If the vertex data is outside the clipping range, the visible vertex data corresponding to that vertex data is the newly added vertex data corresponding to the intersection of the preset triangle corresponding to that vertex data and the boundary of the clipping range. In other words, a method is provided to enable the cloud server to calculate the visible vertex data corresponding to any vertex data of each visible vertex data, thereby further reducing the computing power consumption of the client's GPU.
[0029] In another possible implementation, obtaining the model pruning data corresponding to the target model includes any one of the following:
[0030] The CPU receives model trimming data corresponding to the target model sent by the client, wherein the model trimming data corresponding to the target model is obtained by the CPU analyzing the target model;
[0031] The model pruning data corresponding to the target model is obtained from the GPU of the client. The model pruning data corresponding to the target model is obtained by the GPU analyzing the target model.
[0032] Receive the target model sent by the client, analyze and obtain the model pruning data corresponding to the target model based on the target model.
[0033] By adopting the above technical solution, on the one hand, the model pruning data received by the cloud server is obtained by the client's CPU analyzing the target model. That is, the CPU directly analyzes the target model to obtain the model pruning data, without the need for the GPU in the client to perform calculations and analysis on the target model, thus further reducing the GPU's computing power consumption. On the other hand, the model pruning data obtained by the cloud server is obtained by the client's GPU analyzing the target model. The cloud server performs pruning calculations based on the model pruning data. That is, in the process of pruning the target model, only the GPU needs to perform calculations based on the target model to obtain the model pruning data, thereby reducing the GPU's computing power consumption. Furthermore, after receiving the target model sent by the client, the cloud server analyzes the target model to obtain the model pruning data. That is, the pruning calculations on the target model are performed by the cloud server, without the need for the GPU and CPU to perform pruning calculations on the target model, thus saving the computing power consumption of the GPU and CPU, and further reducing the client's computing power consumption.
[0034] In another possible implementation, sending the clipping calculation result to the client so that the client can render the model using the GPU includes any of the following:
[0035] The clipping calculation result is sent to the client's CPU, so that the CPU clips the target model based on the clipping calculation result and controls the GPU to render the model;
[0036] The clipping calculation results are sent to the client's GPU so that the GPU can render the model based on the clipping calculation results.
[0037] By adopting the above technical solution, on the one hand, the cloud server sends the clipping calculation results to the client's CPU, which clips the target model, and then the GPU renders the model. The CPU processes the clipping calculation results before the GPU renders them. In other words, during the model clipping process, only the GPU needs to render the model, thereby reducing the GPU's computing power consumption during the model clipping process. On the other hand, the cloud server sends the clipping calculation results directly to the client's GPU, which directly renders the model based on the clipping calculation results. This also reduces the computing power consumption during the model clipping process.
[0038] Secondly, embodiments of this application provide a 3D model rendering method, executed by a client, the method comprising:
[0039] The CPU acquires the model pruning data corresponding to the target model and sends it to the cloud server corresponding to the target model. The model pruning data includes: pruning range and vertex data. The vertex data is the vertex data corresponding to each vertex contained in the target model.
[0040] The CPU receives the clipping calculation results corresponding to the target model and controls the GPU to render the model based on the clipping calculation results. The clipping calculation results are obtained by the cloud server by performing clipping calculations on the target model according to the model clipping data corresponding to the target model. The clipping calculation results are used to characterize the model information in the target model that is within the clipping range.
[0041] By adopting the above technical solution, the client sends the model clipping data to the cloud server via the CPU. The cloud server then performs clipping calculations on the target model to obtain the clipping calculation results. After receiving the clipping calculation results from the cloud server, the CPU controls the GPU to render based on the clipping calculation results. In other words, the clipping calculation results are obtained by the cloud server performing clipping calculations on the model clipping data corresponding to the target model, without requiring the GPU to perform clipping calculations on the model clipping data, thereby reducing the computing power consumption of the client's GPU.
[0042] In one possible implementation, the model pruning data corresponding to the target model is sent to the cloud server corresponding to the target model, and prior to this, the following steps are also included:
[0043] From the cloud server cluster, randomly select any one cloud server as the cloud server corresponding to the target model; or...
[0044] The target server is determined to be the cloud server corresponding to the target model, and the target server is a cloud server that is currently in an idle state.
[0045] By adopting the above technical solution, on the one hand, any cloud server can be selected from the cloud server cluster as the cloud server corresponding to the target model. The corresponding cloud server performs the pruning calculation on the target model. Consequently, the client GPU does not need to perform the pruning calculation on the target model to obtain the pruning calculation result, thereby reducing the computing power consumption of the client GPU. On the other hand, the client can also use an idle cloud server as the cloud server corresponding to the target model. While reducing GPU computing power consumption, the idle cloud server can directly perform the pruning calculation on the target model, thereby reducing the waiting time for the cloud server to start the calculation, which is conducive to improving the efficiency of model rendering.
[0046] In another possible implementation, the pruning calculation result includes visible vertex data, wherein controlling the GPU to perform model rendering based on the pruning calculation result includes any one of the following:
[0047] Based on the visible vertex data, the target model is cropped using the GPU, and the cropped model is rendered using the GPU;
[0048] The CPU clips the target model based on the visible vertex data, and the GPU renders the clipped model. The clipped model is sent from the CPU to the GPU.
[0049] By adopting the above technical solution, on the one hand, when the client's CPU receives the visible vertex data, it forwards the visible vertex data to the GPU, which then performs cropping based on the visible vertex data to obtain the cropped target model. The model is then rendered. That is, during the cropping calculation, the GPU only needs to perform the step of cropping the visible vertex data to obtain the cropped model, reducing the cropping calculation process for each vertex and thus reducing the GPU's computing power consumption. On the other hand, after receiving the visible vertex data, the client's CPU crops the target model and sends the cropped model to the GPU. The GPU directly renders based on the cropped model. In other words, the GPU does not need to perform calculations on the visible vertex data or crop the target model; it only renders based on the cropped model, further reducing the GPU's computing power consumption.
[0050] Thirdly, embodiments of this application provide a 3D model cutting device, which adopts the following technical solution:
[0051] A 3D model cutting device, the device comprising:
[0052] The data acquisition module is used to acquire model clipping data corresponding to the target model. The model clipping data includes clipping range and vertex data, wherein the vertex data is the vertex data corresponding to each vertex contained in the target model.
[0053] The trimming calculation module is used to perform trimming calculations on the target model based on the model trimming data corresponding to the target model, and obtain trimming calculation results. The trimming calculation results are used to characterize the model information in the target model that is within the trimming range.
[0054] The result sending module is used to send the clipping calculation results to the client so that the client can perform model rendering through the GPU.
[0055] By adopting the above technical solution, the pruning calculation module performs pruning calculation on the target model according to the model pruning data corresponding to the target model obtained by the data acquisition module. The result sending module sends the pruning calculation result to the client, and the client then renders the model through the GPU. That is, in this embodiment, the cloud server is used to perform pruning calculation on the target model, and the GPU does not need to perform pruning calculation. The GPU only needs to render the model according to the pruning calculation result, thereby reducing the computing power consumption of the GPU.
[0056] In one possible implementation, when the clipping calculation module performs clipping calculations on the target model based on the model clipping data corresponding to the target model to obtain the clipping calculation result, it is specifically used for:
[0057] Based on the clipping range and the vertex data, calculate the data for each visible vertex. Each visible vertex is a vertex included in the clipped model, and the clipped model is the model within the clipping range of the target model; or...
[0058] Based on the clipping range and the vertex data, calculate the data of each visible vertex, and clip the target model based on the data of each visible vertex to obtain the clipped model.
[0059] In one possible implementation, when the clipping calculation module calculates the data of each visible vertex based on the clipping range and the data of each vertex, it is specifically used for:
[0060] Based on the clipping range, vertex data to be processed and vertex data to be retained are determined from each vertex data. The vertex data to be processed are vertex data located outside the clipping range, and the vertex data to be retained are vertex data located within the clipping range.
[0061] From the vertex data, determine the associated vertex data corresponding to the vertex data to be processed, and the associated vertex data and the vertex data to be processed can form a preset triangle;
[0062] Based on the vertex data to be processed and the corresponding associated vertex data, new vertex data is determined. The new vertex is the intersection point between the preset triangle and each boundary, and does not belong to any of the vertices. The boundary is the face that makes up the clipping range.
[0063] The newly added vertex data and the retained vertex data are determined as the respective visible vertex data.
[0064] In another possible implementation, when the clipping calculation module calculates the visible vertex data corresponding to any vertex data based on the clipping range and any vertex data, it is specifically used for:
[0065] Based on the clipping range, it is determined whether any vertex data belongs to vertex data to be processed or vertex data to be retained;
[0066] If it belongs to the vertex data to be processed, then determine the associated vertex data corresponding to any vertex data from the vertex data;
[0067] Based on any vertex data and its corresponding associated vertex data, determine whether there is any newly added vertex data;
[0068] If it exists, the newly added vertex data will be identified as visible vertex data;
[0069] If a vertex belongs to the retained vertex data, then any vertex data is determined as the visible vertex data.
[0070] In another possible implementation, when the data acquisition module acquires the model pruning data corresponding to the target model, it is specifically used for:
[0071] The CPU receives model trimming data corresponding to the target model sent by the client, wherein the model trimming data corresponding to the target model is obtained by the CPU analyzing the target model; or,
[0072] The model pruning data corresponding to the target model is obtained from the client's GPU, and the model pruning data corresponding to the target model is obtained by the GPU analyzing the target model; or,
[0073] Receive the target model sent by the client, analyze and obtain the model pruning data corresponding to the target model based on the target model.
[0074] In another possible implementation, when the result sending module sends the pruning calculation result to the client so that the client can perform model rendering via the GPU, it is specifically used for:
[0075] The clipping calculation result is sent to the client's CPU, so that the CPU clips the target model based on the clipping calculation result and controls the GPU to render the model; or,
[0076] The clipping calculation results are sent to the client's GPU so that the GPU can render the model based on the clipping calculation results.
[0077] Fourthly, embodiments of this application provide a 3D model rendering apparatus, which adopts the following technical solution:
[0078] A 3D model rendering device, comprising:
[0079] The data sending module is used to acquire the model clipping data corresponding to the target model through the CPU and send it to the cloud server corresponding to the target model. The model clipping data includes: clipping range and vertex data, wherein the vertex data is the vertex data corresponding to each vertex contained in the target model.
[0080] The result receiving module is used to receive the pruning calculation result corresponding to the target model through the CPU, and control the GPU to perform model rendering based on the pruning calculation result. The pruning calculation result is obtained by the cloud server performing pruning calculation on the target model according to the model pruning data corresponding to the target model. The pruning calculation result is used to characterize the model information in the target model that is within the pruning range.
[0081] By adopting the above technical solution, the data sending module sends the model clipping data to the cloud server via the CPU. The cloud server then performs clipping calculations on the target model to obtain the clipping calculation results. After receiving the clipping calculation results sent by the cloud server via the CPU, the result receiving module controls the GPU to render according to the clipping calculation results. In other words, the clipping calculation results are obtained by the cloud server performing clipping calculations on the model clipping data corresponding to the target model, without requiring the GPU to perform clipping calculations on the model clipping data, thereby reducing the computing power consumption of the client's GPU.
[0082] In one possible implementation, the device further includes a first selection module or a second selection module, wherein:
[0083] The first selection module is used to randomly select any cloud server from the cloud server cluster as the cloud server corresponding to the target model;
[0084] The second selection module is used to determine the target server as the cloud server corresponding to the target model, wherein the target server is a cloud server that is currently in an idle state.
[0085] In another possible implementation, the pruning calculation result includes visible vertex data; the result receiving module, when controlling the GPU to perform model rendering based on the pruning calculation result, is specifically used for:
[0086] Based on the aforementioned visual vertex data, and by cropping the target model using the GPU, and then rendering the cropped model using the GPU; or...
[0087] The CPU clips the target model based on the visible vertex data, and the GPU renders the clipped model. The clipped model is sent from the CPU to the GPU.
[0088] Fifthly, this application provides a cloud server, which adopts the following technical solution:
[0089] A cloud server, the cloud server comprising:
[0090] At least one processor;
[0091] Memory;
[0092] At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, the at least one application being configured to: execute the above-described 3D model cutting method.
[0093] Sixthly, this application provides a client application that adopts the following technical solution:
[0094] A client comprising:
[0095] At least one processor;
[0096] Memory;
[0097] At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, the at least one application being configured to: execute the 3D model rendering method described above.
[0098] Seventhly, this application provides a computer-readable storage medium, which adopts the following technical solution:
[0099] A computer-readable storage medium includes: a computer program stored thereon that can be loaded by a processor and execute the above-described 3D model cutting method.
[0100] Eighthly, this application provides a computer-readable storage medium, which adopts the following technical solution:
[0101] A computer-readable storage medium includes: a computer program stored thereon that can be loaded by a processor and execute the 3D model rendering method described above.
[0102] In summary, this application includes the following beneficial technical effects:
[0103] The cloud server performs pruning calculations on the target model based on the model pruning data corresponding to the target model, and sends the pruning calculation results to the client. The client then renders the model using the GPU. In other words, in this embodiment, the cloud server performs pruning calculations on the target model, and the GPU does not need to perform pruning calculations. The GPU only needs to render the model based on the pruning calculation results, thereby reducing the GPU's computing power consumption. Attached Figure Description
[0104] Figure 1 This is a schematic diagram illustrating the principle of model rendering in the embodiments of this application;
[0105] Figure 2 This is a flowchart illustrating a 3D model cutting method in an embodiment of this application;
[0106] Figure 3 This is a schematic diagram of the first type of newly added vertex in the embodiments of this application;
[0107] Figure 4 This is a second schematic diagram of the newly added vertices in the embodiments of this application;
[0108] Figure 5 This is a flowchart illustrating the 3D model rendering method according to an embodiment of this application;
[0109] Figure 6 This is a schematic diagram illustrating the interaction between the cloud server and the client in an embodiment of this application;
[0110] Figure 7 This is a schematic diagram of the modules of the 3D model cutting device according to an embodiment of this application;
[0111] Figure 8 This is a schematic diagram of the modules of the 3D model rendering apparatus according to an embodiment of this application;
[0112] Figure 9 This is a schematic diagram of a cloud server according to an embodiment of this application. Detailed Implementation
[0113] The following is in conjunction with the appendix Figure 1-9 This application will be described in further detail.
[0114] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0115] Model rendering is usually handled by the GPU. When rendering a 3D model, the GPU typically passes the 3D model through the input assembly stage, the geometry processing stage, and the rasterization stage in sequence. After that, the pixel shader performs shading and outputs the rendered model.
[0116] Specifically, refer to Figure 1In the input assembly stage, the basic primitives such as points, lines, and triangles of the 3D model are output to the geometry processing stage as vertex data. The geometry processing stage uses vertex shaders, shell shaders, surface subdivision primitive generation operations, domain shaders, and geometry shaders to perform geometric transformations, lighting, projection, primitive clipping, and viewport coordinate transformations on the 3D model. This converts the vertex data of the 3D model from three-dimensional coordinates to two-dimensional screen coordinates. Then, in the rasterization stage, the primitives in two-dimensional screen coordinates output by the geometry processing stage are converted into pixels visible on the screen. Finally, the pixel shader performs coloring to achieve model rendering. In the geometry processing stage, primitive clipping is used to extract the portion of the 3D model that is within the viewport area, or in other words, to clip the portion of the model that is outside the viewport area. This reduces the amount of work done on the portion of the model within the viewport area during subsequent viewport coordinate transformation and rasterization processing. The portion of the model outside the viewport area is usually the part that cannot be displayed. Deleting and clipping this part of the model before viewport coordinate transformation and rasterization processing, and clipping the undisplayed part of the model in advance during the geometry processing stage, helps to reduce the amount of computation in the viewport coordinate transformation and rasterization processing stages, thereby greatly improving the GPU's computing power consumption.
[0117] In cloud gaming, the cloud server sends a 3D model to the client. This 3D model is used to simulate a more realistic game scene. When the client receives the 3D model, it processes and renders the model by sequentially going through the input assembly stage, the geometry processing stage, and the rasterization processing stage, in order to achieve a more realistic game scene.
[0118] However, during primitive clipping in the geometry processing stage, the GPU needs to analyze each vertex, which consumes too much computing power. At the same time, the speed of clipping calculation is affected by the performance of the client's GPU. For clients with poor GPU performance, it will take a long time, affecting the rendering efficiency of the model and negatively impacting the client's gaming experience.
[0119] To reduce GPU computing power consumption and improve rendering efficiency, thereby enhancing the user's gaming experience, this application provides a 3D model slicing method, executed by a cloud server, wherein, referring to... Figure 2 The method may include:
[0120] Step S201: Obtain the model clipping data corresponding to the target model.
[0121] The model clipping data includes the clipping range and vertex data, where vertex data refers to the vertex data corresponding to each vertex contained in the target model.
[0122] Specifically, the target model is a 3D model to be clipped. In order to reduce the computing power consumption of the client's GPU, the cloud server obtains the model clipping data corresponding to the 3D model to be clipped.
[0123] The methods by which the cloud server obtains the model clipping data corresponding to the 3D model to be clipped can include: after the client GPU obtains vertex data during the input assembly stage, the cloud server obtains the model clipping data corresponding to the 3D model to be clipped from the client GPU; or it can include: when the client GPU performs clipping calculations, the cloud server obtains the model clipping data corresponding to the 3D model to be clipped from the client GPU; or it can include: the cloud server obtains the data from a memory in which the model clipping data corresponding to the target model is pre-stored.
[0124] Model clipping data is used to clip the target model. When clipping the model, the part within the viewport range needs to be retained, and the part outside the viewport range needs to be clipped. The clipping range included in the model clipping data represents the set range that needs to be retained, which is the viewport range.
[0125] The target model is the 3D model to be clipped. The 3D model includes multiple vertices, each corresponding to one vertex data. For example, if the target model is a cuboid, then the number of vertices is 8, and the clipping data corresponding to the target model includes eight vertex data.
[0126] Vertex data is used to represent the positions of vertices in the target model and the connections between them. Specifically, the target model consists of points, lines, and surfaces. The relative positions of the vertices are not sufficient to fully determine the outline of the target model. It is also necessary to combine the connections between the vertices and connect them to form the outline of the target model.
[0127] To more clearly describe the target model, primitives are typically used. These primitives include points, lines, triangles, and faces. When using triangular primitives to describe the target model, each face of the target model is divided into two non-intersecting triangles. The vertices of each triangle become the vertices of the target model, meaning the target model is divided into a 3D model composed of multiple triangles. In other words, describing the target model can be done by dividing it into multiple primitives. If each primitive is represented using vertex data, then the individual primitives of the target model can be determined using the vertex data, and the target model can be determined based on these primitives.
[0128] Specifically, vertex data includes vertex coordinates, which represent the position of the corresponding vertex. For example, if the origin coordinates are (0, 0, 0), the vertex coordinates corresponding to vertex A are (0, 0, 6), and the vertex coordinates corresponding to vertex B are (0, 6, 6). Additionally, to describe the various triangular primitives of the target model, each vertex data also includes an index. Each vertex corresponds to one index. For the three vertices that can form a preset triangular primitive, the corresponding indexes are related to each other. That is, based on the index of any vertex, the two indexes associated with that index can be found, as well as the vertices corresponding to each associated index. In other words, based on the relationship between the indexes, the three vertices that can form a preset triangular primitive can be determined. For example, for a triangular primitive X, the indexes of its three vertices are X1, X2, and X3. X1, X2, and X3 are related to each other. Based on index X2, the two associated indexes, X1 and X2, can be found.
[0129] Step S202: Based on the model clipping data corresponding to the target model, perform clipping calculations on the target model to obtain the clipping calculation results.
[0130] The clipping calculation results are used to characterize the model information within the clipping range of the target model.
[0131] Specifically, when the cloud server obtains the model pruning data, it performs pruning calculations on the target model to obtain the pruning result. In this embodiment, using the cloud server to perform pruning calculations on the target model reduces the computing power consumption of the GPU, thereby improving the user experience.
[0132] When the cloud server performs pruning calculations on the target model, it needs to use pruning calculation functions. These functions can be pre-stored in the cloud server and retrieved from storage when the model pruning data is obtained. Alternatively, the pruning calculation functions can be obtained from the obtained model pruning data, meaning that the model pruning data includes the pruning calculation functions.
[0133] The purpose of pruning the target model is to retain the portion of the target model that falls within the pruning range and remove the portion that falls outside the pruning range. In other words, the pruning calculation is used to obtain the model information within the pruning range of the target model. The calculated pruning result represents the model information within the pruning range of the target model. After the pruning calculation, the client or cloud server can prune the target model based on the result to obtain the model within the pruning range.
[0134] Step S203: Send the clipping calculation results to the client so that the client can render the model using the GPU.
[0135] Specifically, the cloud server sends the clipping calculation results to the client, which can then perform model rendering based on the results. This eliminates the need for the GPU to consume excessive computing power for clipping calculations, thereby reducing the client's GPU computing power consumption. This further improves the efficiency of model rendering and ultimately enhances the user's gaming experience.
[0136] This application provides a 3D model cutting method. The cloud server performs cutting calculations on the target model based on the model cutting data corresponding to the target model, sends the cutting calculation results to the client, and then the client renders the model using the GPU. That is, in this application embodiment, the cloud server performs cutting calculations on the target model, and the GPU does not need to perform cutting calculations. The GPU only needs to render the model based on the cutting calculation results, thereby reducing the GPU's computing power consumption.
[0137] Furthermore, as can be seen from the above embodiments, the cloud server needs to obtain the model pruning data of the target model before performing pruning calculations. The method for obtaining the model pruning data corresponding to the target model can be implemented using any one of Method 1, Method 2, and Method 3. Specifically:
[0138] Method 1: Receive the model trimming data corresponding to the target model sent by the client's CPU.
[0139] The model pruning data corresponding to the target model is obtained by the CPU analyzing the target model.
[0140] Specifically, after analyzing the target model, the client's CPU obtains the vertex data and clipping range of the target model, and sends the vertex data and clipping range to the cloud server. This allows the cloud server to retrieve the target model's clipping data from the client's CPU. On one hand, the cloud server performs clipping calculations based on the clipping data, eliminating the need for the GPU to perform clipping calculations and reducing GPU computing power consumption. On the other hand, the client's CPU analyzes the target model to obtain the clipping data, eliminating the need for the GPU to analyze the obtained clipping data, further reducing the client's GPU computing power consumption.
[0141] In addition, the model pruning data sent by the client's CPU can also be obtained by the CPU from the client's GPU. Specifically, after the GPU analyzes the target model and obtains the model pruning data, it sends it to the client's CPU or is obtained by the client's CPU. After the CPU obtains the model pruning data, it forwards the model pruning data to the cloud server, and then the cloud server obtains it.
[0142] Method 2: Obtain the model pruning data corresponding to the target model from the client's GPU.
[0143] The model pruning data corresponding to the target model is obtained by the GPU analyzing the target model.
[0144] Specifically, the model pruning data corresponding to the target model can be sent to the cloud server by the client's GPU before performing pruning calculations on the target model, or the cloud server can obtain the data from the client's GPU before performing pruning calculations on the client's GPU.
[0145] In the GPU rendering pipeline, the GPU analyzes the target model during the input assembly stage to obtain vertex data and clipping range, and then enters the geometry processing stage to perform geometric transformations, lighting, projection, and primitive clipping. The cloud server can obtain the model clipping data from the GPU either when the GPU completes the input assembly stage or when the GPU completes the projection process during the geometry processing stage.
[0146] In this approach, the cloud server retrieves model clipping data from the GPU when the GPU completes the input assembly stage. This method, compared to retrieving model clipping data only after the GPU completes projection processing in the geometry processing stage, further reduces GPU computational power consumption. Specifically, when the GPU completes the input assembly stage, the cloud server retrieves the model clipping data from the GPU and performs clipping calculations on the target model based on this data. After the cloud server performs the clipping calculations, the GPU can pre-calculate the geometry based on the calculation results to obtain the clipped model. The clipped model is then processed in the geometry processing stage. Therefore, in the geometry processing stages, such as geometric transformations, lighting, and projection, the clipped portion no longer needs to be processed, thus reducing the GPU's computational load, further improving GPU rendering efficiency, alleviating the GPU's workload, and enhancing the user experience.
[0147] Method 3: Receive the target model sent by the client, analyze it based on the target model, and obtain the model pruning data corresponding to the target model.
[0148] Specifically, the target model can be received from the client's CPU or GPU. After receiving the target model from the client, the cloud server analyzes it to obtain the corresponding model trimming data. This eliminates the need for the client's CPU and GPU to analyze the target model; instead, the cloud server performs the analysis, reducing both GPU and CPU computational power consumption.
[0149] After the cloud server obtains the model pruning data, it performs pruning calculations based on the model pruning data. Specifically, in step S202, based on the model pruning data corresponding to the target model, pruning calculations are performed on the target model to obtain the pruning calculation results. This includes either step S202a (not shown in the figure) or step S202b (not shown in the figure), wherein:
[0150] Step S202a: Calculate the data of each visible vertex based on the clipping range and the data of each vertex.
[0151] In this context, each visible vertex is a vertex contained in the clipped model, and the clipped model is the model within the clipping range of the target model.
[0152] Specifically, the method of cropping the target model to obtain the cropped model may include: determining the vertices corresponding to the part of the target model within the cropping range based on the vertex data and the cropping range, which are the visible vertices; and then determining the cropped model, that is, determining the part of the target model within the cropping range, based on the visible vertex data corresponding to each visible vertex.
[0153] After obtaining the model clipping data, the cloud server performs clipping calculations on the target model. The clipping calculations include calculating the data of each visible vertex based on the model clipping data. The data of each visible vertex is the clipping calculation result obtained after the clipping calculation.
[0154] After calculating the data of each visible vertex, the cloud server sends the clipping calculation result to the client, so that the client can obtain the clipped model based on the visible vertex data. Then, the GPU renders the clipped model.
[0155] Step S202b: Calculate the data of each visible vertex according to the clipping range and the data of each vertex, and clip the target model based on the data of each visible vertex to obtain the clipped model.
[0156] Specifically, after obtaining the model clipping data, the cloud server performs clipping calculations on the target model. The clipping calculation process may include: obtaining the data of each visible vertex based on the model clipping data, and then obtaining the clipped model based on the data of each visible vertex. The clipping calculation result is the clipped model, which is then sent to the client so that the client can render based on the clipped model. The processing of obtaining the clipped model based on the visible vertex data is calculated and processed by the cloud server, eliminating the need for the client to perform the model clipping process again, thus further reducing the client's computing power consumption.
[0157] In the process of clipping the target model in the above embodiment, the data of each visible vertex is calculated according to the clipping range and the data of each vertex. This may include steps Sa1 (not shown in the figure), Sa2 (not shown in the figure), Sa3 (not shown in the figure), and Sa4 (not shown in the figure), wherein:
[0158] Step Sa1: Determine the vertex data to be processed and the vertex data to be retained from each vertex data based on the clipping range.
[0159] Among them, the vertex data to be processed are the vertex data located outside the clipping range, and the vertex data to be retained are the vertex data located within the clipping range.
[0160] Specifically, the method for determining the vertex data to be processed and the vertex data to be retained from each vertex data includes: traversing each vertex data, sorting each vertex data in a preset order, and determining whether each vertex data is outside the clipping range. If there is vertex data outside the clipping range, then the vertex data outside the clipping range is determined as vertex data to be processed; if there is vertex data within the clipping range, then the vertex data within the clipping range is determined as vertex data to be retained.
[0161] Specifically, when the entire target model is within the clipping range, the vertex data corresponding to each target model belongs to the retained vertex data; when the entire target model is outside the clipping range, the vertex data corresponding to each target model belongs to the vertex data to be processed; when the target model is partially outside the range and partially within the clipping range, the vertex data corresponding to each vertex outside the clipping range is the retained vertex data, and the vertex data corresponding to each vertex within the clipping range is the vertex data to be processed.
[0162] To prune the target model, it is necessary to retain the model within the pruning range and prune the model outside the pruning range. Therefore, during the pruning calculation process, the vertex data to be retained is calculated, that is, the vertex data within the pruning range of each vertex data is calculated, so as to prune the target model.
[0163] When the target model has both retained vertex data and vertex data to be processed, that is, when part of the target model is within the clipping range and part of the target model is outside the clipping range, there must be an intersection between the target model and the boundary of the clipping range. In other words, in order to form a relatively complete model within the clipping range based on the visible vertex data, after deleting the vertices outside the clipping range, it is also necessary to determine the vertices corresponding to the intersection position of the target model and the boundary of the clipping range, that is, the newly added vertices.
[0164] Step Sa2: Determine the associated vertex data corresponding to the vertex data to be processed from each vertex data.
[0165] Among them, the associated vertex data and the vertex data to be processed can form a preset triangle.
[0166] Specifically, primitives are the basic units that make up an image, and cropping is usually performed based on primitives. In this embodiment, triangular primitives are used for cropping calculations. The triangular primitives are determined before the cropping calculations are performed. Each vertex is used as a vertex of a triangular primitive, and each face of the model is divided into two triangles. Every three vertices form a triangular primitive, and each triangular primitive does not intersect in space. All the triangles are combined to form the target model.
[0167] The subscript indexes included in the vertex data are used to represent the correspondence between the three vertices of a triangular primitive. That is, the other two vertices that form a triangular primitive with any given vertex data can be determined based on the subscript index of any given vertex data, as well as the vertex data corresponding to each of the other two vertices. For example, triangular primitive a includes vertices a1, a2, and a3, and triangular primitive b includes vertices b1, b2, and b3. a1, a2, a3, b1, b2, and b3 are the subscript indices corresponding to each vertex. If the subscript index corresponding to the current vertex data is a2, then the other two vertices that form a preset triangular primitive with this vertex data can be found based on the subscript indexes of each vertex data, that is, vertices a1 and a3 can be found.
[0168] Associated vertex data refers to data that represents the vertex data that can form a preset triangle primitive. A triangle has three vertices. For any vertex data to be processed, that vertex corresponds to one vertex of the triangle. Associated vertices are the other two vertices in the triangle corresponding to the vertex to be processed. That is, each vertex data to be processed corresponds to two associated vertex data. Based on the index of the vertex to be processed, the other two vertices corresponding to that index are determined. The determined vertices are used as the associated vertices of the vertex to be processed. For example, if the index of the vertex to be processed is a3, then the associated vertices are vertices a1 and a2. That is, associated vertex data 1 is the vertex data corresponding to vertex a1, and associated vertex data 2 is the vertex data corresponding to vertex a2.
[0169] Step Sa3: Based on the vertex data to be processed and the corresponding associated vertex data, determine the new vertex data.
[0170] The newly added vertex is the intersection point between the preset triangle and each boundary, and does not belong to any vertex. The boundary is the face that makes up the clipping range.
[0171] Step Sa4: Determine the newly added vertex data and the retained vertex data as the data of each visible vertex.
[0172] Specifically, the vertex data to be processed is located outside the clipping range. During clipping, the vertex data to be processed needs to be deleted. In order to make the target model after clipping a closed model, it is also necessary to determine the intersection point formed by the line connecting the vertex to be processed and the associated vertex and the boundary of the clipping range, which is the newly added vertex.
[0173] Specifically, the method for determining new vertex data based on the vertex data to be processed and the corresponding associated vertex data may include: determining whether the two associated vertices corresponding to the vertex to be processed are within the clipping range; if neither of the two associated vertices is within the clipping range, that is, all three vertices of the preset triangle are outside the clipping range, then the preset triangle corresponding to the vertex to be processed must have no intersection with the boundary of the clipping range, that is, the vertex to be processed has no corresponding new vertex.
[0174] If one of the two associated vertices is within the clipping range (i.e., the vertex to be processed is outside the clipping range), and the associated vertex is within the clipping range, then the line connecting the vertex to be processed and the associated vertex must intersect the boundary of the clipping range. In other words, the line connecting the two vertices and the boundary of the clipping range must have one and only one intersection point, which is a newly added vertex. Furthermore, if the other associated vertex is outside the clipping range, the line connecting the two associated vertices and the boundary of the clipping range must also have one and only one intersection point, which is also a newly added vertex; that is, the vertex to be processed corresponds to two newly added vertices. When determining the two newly added vertices corresponding to the vertex to be processed, line segments are drawn from the associated vertices within the clipping range to the vertex to be processed and the other associated vertex. The coordinates of the intersection point of each line segment with the boundary of the clipping range are determined, and the index of this intersection point is set, corresponding to the index of the associated vertices within the clipping range. (Refer to...) Figure 3 The subscript index of the vertex to be processed is 1, and the two associated vertices are 2 and 3. Vertex 3 is within the clipping range, and vertex 2 is outside the clipping range. A line segment is drawn from vertex 3 to vertex 1, which intersects the boundary of the clipping range at intersection point 1.1, and the subscript index of this intersection point is 1.1. A line segment is drawn from vertex 3 to vertex 2, which intersects the boundary of the clipping range at intersection point 2.1, and the subscript index of this intersection point is 2.1.
[0175] If both associated vertices are within the clipping range, the number of new vertices corresponding to the vertex to be processed is 2, meaning the vertex to be processed corresponds to two new vertices. The line connecting the two associated vertices does not intersect the boundary of the clipping range. When both associated vertices are within the clipping range, starting from the vertex to be processed, line segments are drawn to the two associated vertices respectively. The coordinates of the intersection point of each line segment with the boundary of the clipping range are determined. This intersection point is treated as a new vertex, and an index is set corresponding to it, so that this index corresponds to the index of each associated vertex. For example, refer to... Figure 4 The index of the vertex to be processed is 1, and the two associated vertices are 2 and 3. Vertex 3 and vertex 2 are both within the clipping range. A line segment is drawn from vertex 1 to vertex 2, which intersects the boundary of the clipping range at intersection point 1.1, and the index of this intersection point is 1.1. A line segment is drawn from vertex 1 to vertex 3, which intersects the boundary of the clipping range at intersection point 1.2, and the index of this intersection point is 1.2.
[0176] After identifying the new vertices, the new vertex data and the retained vertex data are used as visible vertex data, so that a model within the clipping range in the target model can be constructed based on the visible vertex data.
[0177] In the above embodiments, after determining the vertex data to be processed and the retained vertex data, the associated vertex data corresponding to each vertex data to be processed is determined, and then the newly added vertex data corresponding to each vertex data to be processed is determined. In another possible implementation, after determining the vertex data to be processed and the retained vertex data, the vertex data to be processed can be traversed, and the associated vertex data and the corresponding newly added vertex data of each vertex data to be processed can be determined in turn.
[0178] Specifically, after determining the vertex data to be processed and the vertex data to be retained, the vertex data to be processed are sorted in a preset order; the preset steps are executed cyclically until the preset conditions are met. The preset steps include: determining the current vertex data to be processed in a preset order, determining the associated vertex data corresponding to the current vertex data to be processed, and determining the new vertex data corresponding to the current vertex data to be processed based on the current vertex data to be processed and the corresponding associated vertex data.
[0179] The preset conditions may include the fact that the currently pending vertex data is the last pending vertex data. In this embodiment, the method for determining the associated vertex data corresponding to the pending vertex data, as well as the corresponding newly added vertex data, can be referred to the above embodiments, and will not be repeated here.
[0180] In addition, in the above method of determining visible vertex data based on the clipping range and vertex data, each vertex data is first classified into vertex data to be processed and vertex data to be retained. Then, the new vertex data corresponding to each vertex data to be processed is determined. In another possible implementation, the visible vertex data can be determined by traversing each vertex data. For example, the target model includes vertex data a1, vertex data a2, ... vertex data an. After determining the visible vertex data corresponding to vertex data a1, the visible vertex data of vertex data a2 is determined, and so on until the visible vertex data of vertex data an is determined.
[0181] The process involves calculating the visible vertex data corresponding to any given vertex based on the clipping range and the data of any given vertex. Specifically, this includes steps Sb1 (not shown in the figure), Sb2 (not shown in the figure), Sb3 (not shown in the figure), Sb4 (not shown in the figure), and Sb5 (not shown in the figure).
[0182] Step Sb1: Determine whether any vertex data belongs to the vertex data to be processed or the vertex data to be retained based on the clipping range.
[0183] Step Sb2: If it belongs to the vertex data to be processed, then determine the associated vertex data corresponding to any vertex data from the vertex data.
[0184] Step Sb3: Based on any vertex data and its corresponding associated vertex data, determine whether there is any newly added vertex data.
[0185] Step Sb4: If it exists, determine the newly added vertex data as visible vertex data.
[0186] Step Sb5: If it belongs to the retained vertex data, then determine any vertex data as visible vertex data.
[0187] Specifically, when determining the visible vertex data corresponding to any vertex data, if the vertex data is within the clipping range, then the visible vertex data corresponding to the vertex data is the vertex data itself; if the vertex data is outside the clipping range, it is necessary to determine whether the preset triangle corresponding to the vertex data, that is, the preset triangle primitive, intersects with the boundary of the clipping range. If there is an intersection, each intersection is taken as the visible vertex corresponding to the vertex data; if there is no intersection, the visible vertex data corresponding to the vertex data is an empty set.
[0188] The above text introduced the method for determining the visible vertex data corresponding to any vertex data. Then, the visible vertex data corresponding to each vertex data can be determined in the same way. After traversing each vertex data, the visible vertex data corresponding to each vertex data is used as the visible vertex data corresponding to the target model.
[0189] The method for determining whether new vertex data exists based on vertex data and associated vertex data can be found in step Sa3 of the above embodiment, and will not be repeated here.
[0190] After determining the visible vertex data, the clipping calculation result is further obtained. In step S203, the clipping calculation result is sent to the client so that the client can perform model rendering through the GPU. The method of sending the clipping calculation result to the client can be implemented by method one or method two, specifically:
[0191] Method 1: Send the clipping calculation results to the client's CPU, so that the CPU can clip the target model based on the clipping calculation results and control the GPU to render the model.
[0192] Specifically, when the clipping calculation result is visible vertex data, the clipping calculation result is sent to the client's CPU. The client's CPU can then clip the target model based on the visible vertex data to obtain the clipped model. The clipped model is then sent to the GPU so that the GPU can perform model rendering based on the clipped model. The GPU no longer needs to obtain the clipped model based on the visible vertex data, but can directly perform model rendering based on the clipped model, thereby reducing GPU computing power consumption.
[0193] When the clipping calculation result corresponds to the clipped model, the cloud server sends the clipping calculation result to the client's CPU. The client's CPU forwards the clipped model to the GPU, so that the GPU can perform model rendering based on the clipped model. The cloud server completes the model clipping calculation and model clipping steps, reducing the GPU's computing power consumption.
[0194] Method 2: Send the clipping calculation results to the client's GPU so that the GPU can render the model based on the clipping calculation results.
[0195] Specifically, when the clipping calculation result corresponds to visible vertex data, the cloud server directly sends the clipping calculation result to the client's GPU, so that the client's GPU can clip the target model based on the visible vertex data to obtain the clipped model. The model is then rendered based on the clipped model. The cloud server calculates the visible vertex data, that is, it calculates each vertex of the target model within the clipping range. This reduces the number of clipping calculation steps for the target model by the GPU and reduces the GPU's computing power consumption.
[0196] When the clipping calculation result corresponds to the clipped model, the cloud server sends the clipped model directly to the client's GPU, further reducing the GPU's computing power consumption. In addition, the cloud server forwards the clipped model directly to the GPU, reducing the CPU forwarding process, which helps to further improve the efficiency of model rendering.
[0197] The above embodiments provide a 3D model slicing method from the perspective of a cloud server. This application also provides a 3D model rendering method from the perspective of a client, wherein the method is executed by the client, as described above. Figure 5 The method may include:
[0198] Step S501: Obtain the model trimming data corresponding to the target model through the CPU and send it to the cloud server corresponding to the target model.
[0199] The model clipping data includes the clipping range and vertex data, where vertex data refers to the vertex data corresponding to each vertex contained in the target model.
[0200] Specifically, the client obtains model pruning data through the CPU and sends the model pruning data to the corresponding cloud server, which then enables the cloud server to perform pruning calculations on the target model based on the model pruning data.
[0201] The methods by which the client CPU obtains model pruning data may include: obtaining the target model and analyzing the target model to obtain the corresponding model pruning data; the methods by which the client CPU obtains model pruning data may also include: obtaining model pruning data from the GPU; the model pruning data is obtained by the GPU analyzing the target model, and the target model may be sent from the CPU to the GPU or sent from the cloud server to the GPU.
[0202] Step S502: Receive the clipping calculation results corresponding to the target model through the CPU, and control the GPU to render the model based on the clipping calculation results.
[0203] The pruning calculation result is obtained by the cloud server pruning the target model based on the model pruning data corresponding to the target model. The pruning calculation result is used to characterize the model information in the target model that is within the pruning range.
[0204] Specifically, the client sends the model clipping data to the cloud server via the CPU. The cloud server then performs clipping calculations on the target model to obtain the clipping calculation results. After receiving the clipping calculation results from the cloud server, the CPU controls the GPU to render based on the clipping calculation results. In other words, the clipping calculation results are obtained by the cloud server performing clipping calculations on the model clipping data corresponding to the target model, without requiring the GPU to perform clipping calculations on the model clipping data, thereby reducing the computing power consumption of the client's GPU.
[0205] In cloud gaming, the server side usually includes more than one cloud server, but rather a cloud server cluster. Therefore, after the client obtains the model trimming data corresponding to the target model through the CPU, it can send the model trimming data corresponding to the target model to one of the cloud servers in the cloud server cluster.
[0206] Before sending the model pruning data corresponding to the target model to the corresponding cloud server, the process includes either step Sc1 (not shown in the figure) or step Sc2 (not shown in the figure), wherein:
[0207] Step Sc1: Randomly select any cloud server from the cloud server cluster as the cloud server corresponding to the target model.
[0208] Specifically, in the cloud server cluster on the server side, any cloud server is randomly selected as the cloud server corresponding to the target model. By setting up the cloud server cluster, when the cloud gaming server receives multiple model trimming data, it can use multiple cloud servers to perform trimming calculations. For the client, this can speed up the trimming calculation of the target model.
[0209] Step Sc2: Determine the target server as the cloud server corresponding to the target model.
[0210] The target server is a cloud server that is currently idle.
[0211] Specifically, since the cloud server cluster corresponds to multiple cloud servers, some cloud servers may be pruning models for other clients while others are idle. In order to shorten the pruning calculation time of the model, the idle cloud servers are used as target servers, that is, as the cloud servers corresponding to the target model. Then, after the target model is sent to the cloud server, the cloud server can directly perform pruning calculation on the target model, reducing the waiting time for the cloud server to start pruning calculation on the target model, which further helps to improve the efficiency of model rendering.
[0212] Furthermore, after the corresponding cloud server calculates the clipping calculation result, the client receives the clipping calculation result sent by the corresponding cloud server. When the clipping calculation result is visible vertex data, the client can control the GPU to perform model rendering based on the clipping calculation result using either method one or method two. Specifically:
[0213] Method 1: Based on visible vertex data, the target model is cropped using the GPU, and the cropped model is rendered using the GPU.
[0214] Specifically, the method of controlling the GPU to prune the target model based on the visible vertex data can include: when the CPU receives the visible vertex data, it forwards the visible vertex data to the GPU so that the GPU can prune the target model based on the visible vertex data to obtain the pruned model, and then the GPU performs model rendering; or the client GPU receives the visible vertex data sent by the cloud server, then performs pruning calculations on the target model based on the visible vertex data to obtain the pruned model, and then the GPU performs model rendering on the pruned model.
[0215] Method 2: The CPU clips the target model based on the visible vertex data, and the GPU renders the clipped model.
[0216] The cropped model is sent from the CPU to the GPU.
[0217] Specifically, after the client CPU receives the visible vertex data, it obtains the clipped model based on the visible vertex data. Then, the client CPU sends the clipped model to the GPU, which can directly render the model based on the clipped model. The GPU does not need to perform the operation of obtaining the clipped model based on the visible vertex data, thus further reducing the GPU's computing power consumption.
[0218] Furthermore, when the clipping calculation result is a clipped model, the client can control the GPU to render the model based on the clipping calculation result in the following ways: The client can control the GPU to directly render the model based on the clipped model. Alternatively, the cloud server can perform the clipping of the target model to obtain the clipped model. Compared to methods one and two, this method eliminates the need for the client to perform clipping based on visible vertex data, thus further reducing the client's CPU and GPU computing power consumption.
[0219] The above embodiments provide a 3D model cutting method from the perspective of a cloud server and a 3D model rendering method from the perspective of a client. Based on this, the embodiments of this application also describe a 3D model cutting and rendering method from the perspective of client-cloud server interaction, referring to... Figure 6 Specifically, the client determines the cloud server corresponding to the target model from the cloud server cluster, and sends the model clipping data corresponding to the target model to the corresponding cloud server via the CPU. After receiving the model clipping data, the cloud server calculates the data of each visible vertex corresponding to the model within the clipping range in the target model based on the model clipping data, and obtains the clipped model based on each visible vertex data. The clipped model is then sent to the client as the clipping calculation result. The client receives the clipping calculation result via the CPU and sends the clipping calculation result to the GPU. The GPU obtains the clipped model based on the clipping calculation result and performs model rendering based on the clipped model. This eliminates the need for the client's CPU and GPU to perform clipping calculations on the target model, reducing the GPU's computing power consumption.
[0220] This application also describes a 3D model cutting device from the perspective of virtual modules or virtual units, as detailed in the following embodiments.
[0221] Reference Figure 7 A 3D model cutting device 700, the device 700 comprising:
[0222] The data acquisition module 701 is used to acquire the model clipping data corresponding to the target model. The model clipping data includes: clipping range and vertex data. The vertex data is the vertex data corresponding to each vertex contained in the target model.
[0223] The trimming calculation module 702 is used to perform trimming calculations on the target model based on the model trimming data corresponding to the target model, and obtain the trimming calculation results. The trimming calculation results are used to characterize the model information in the target model that is within the trimming range.
[0224] The result sending module 703 is used to send the clipping calculation results to the client so that the client can render the model using the GPU.
[0225] Specifically, the trimming calculation module 702 performs trimming calculations on the target model based on the model trimming data corresponding to the target model obtained by the data acquisition module 701. The result sending module 703 sends the trimming calculation results to the client, and the client then renders the model using the GPU. In other words, in this embodiment, the cloud server is used to perform trimming calculations on the target model, and the GPU does not need to perform trimming calculations. The GPU only needs to render the model based on the trimming calculation results, thereby reducing the GPU's computing power consumption.
[0226] In one possible implementation of this application embodiment, when the clipping calculation module 702 performs clipping calculations on the target model based on the model clipping data corresponding to the target model and obtains the clipping calculation result, it is specifically used for:
[0227] Based on the clipping range and the data of each vertex, calculate the data of each visible vertex. Each visible vertex is the vertex contained in the clipped model, and the clipped model is the model within the clipping range of the target model; or...
[0228] Based on the clipping range and the data of each vertex, the data of each visible vertex is calculated, and the target model is clipped based on the data of each visible vertex to obtain the clipped model.
[0229] In one possible implementation of this application embodiment, when the clipping calculation module 702 calculates the data of each visible vertex based on the clipping range and the data of each vertex, it is specifically used for:
[0230] Based on the clipping range, the vertex data to be processed and the vertex data to be retained are determined from each vertex data. The vertex data to be processed are the vertex data outside the clipping range, and the vertex data to be retained are the vertex data within the clipping range.
[0231] Determine the associated vertex data corresponding to the vertex data to be processed from each vertex data. The associated vertex data and the vertex data to be processed can form a preset triangle.
[0232] Based on the vertex data to be processed and the corresponding associated vertex data, the new vertex data is determined. The new vertex is the intersection point between the preset triangle and each boundary, and does not belong to any vertex. The boundary is the face that makes up the clipping range.
[0233] The newly added vertex data and the retained vertex data are identified as the data of each visible vertex.
[0234] In one possible implementation of this application embodiment, when the clipping calculation module 702 calculates the visible vertex data corresponding to any vertex data based on the clipping range and any vertex data, it is specifically used for:
[0235] Based on the clipping range, determine whether any vertex data belongs to the vertex data to be processed or the vertex data to be retained;
[0236] If it belongs to the vertex data to be processed, then determine the associated vertex data corresponding to any vertex data from the vertex data;
[0237] Based on any vertex data and its corresponding associated vertex data, determine whether there is any newly added vertex data;
[0238] If it exists, the newly added vertex data will be identified as visible vertex data;
[0239] If it belongs to the retained vertex data, then any vertex data will be determined as visible vertex data.
[0240] In one possible implementation of this application embodiment, when the data acquisition module 701 acquires the model clipping data corresponding to the target model, it is specifically used for:
[0241] The CPU receives model trimming data corresponding to the target model sent by the client. This model trimming data is obtained by the CPU analyzing the target model; or...
[0242] The model pruning data corresponding to the target model is obtained from the client's GPU. This model pruning data is obtained by the GPU analyzing the target model; or...
[0243] Receive the target model sent by the client, analyze it based on the target model, and obtain the corresponding model pruning data.
[0244] In one possible implementation of this application embodiment, when the result sending module 703 sends the clipping calculation result to the client so that the client can perform model rendering via GPU, it is specifically used for:
[0245] The clipping calculation results are sent to the client's CPU, allowing the CPU to clip the target model based on the results and control the GPU to render the model; or,
[0246] The clipping calculation results are sent to the client's GPU so that the GPU can render the model based on the clipping calculation results.
[0247] This application also describes a 3D model rendering apparatus from the perspective of a virtual module or virtual unit, as detailed in the following embodiments.
[0248] Reference Figure 8 A 3D model rendering device 800, comprising:
[0249] The data sending module 801 is used to obtain the model clipping data corresponding to the target model through the CPU and send it to the cloud server corresponding to the target model. The model clipping data includes: clipping range and vertex data. The vertex data is the vertex data corresponding to each vertex contained in the target model.
[0250] The result receiving module 802 is used to receive the clipping calculation results corresponding to the target model through the CPU, and control the GPU to render the model based on the clipping calculation results. The clipping calculation results are obtained by the cloud server to perform clipping calculations on the target model according to the model clipping data corresponding to the target model. The clipping calculation results are used to characterize the model information in the target model that is within the clipping range.
[0251] Specifically, the data sending module 801 sends the model clipping data to the cloud server via the CPU, and the cloud server performs clipping calculations on the target model to obtain the clipping calculation results. After the result receiving module 802 receives the clipping calculation results sent by the cloud server via the CPU, it controls the GPU to render according to the clipping calculation results. In other words, the clipping calculation results are obtained by the cloud server performing clipping calculations on the model clipping data corresponding to the target model, without the need for the GPU to perform clipping calculations on the model clipping data, thereby reducing the computing power consumption of the client's GPU.
[0252] In one possible implementation of this application embodiment, the device 800 further includes a first selection module or a second selection module, wherein:
[0253] The first selection module is used to randomly select any cloud server from the cloud server cluster as the cloud server corresponding to the target model.
[0254] The second selection module is used to determine the target server as the cloud server corresponding to the target model, and the target server is a cloud server that is currently in an idle state.
[0255] In one possible implementation of this application embodiment, the pruning calculation result includes visible vertex data; the result receiving module 802, when controlling the GPU to perform model rendering based on the pruning calculation result, is specifically used for:
[0256] Based on visible vertex data, and by cropping the target model using the GPU, followed by rendering the cropped model using the GPU; or...
[0257] The CPU clips the target model based on the visible vertex data, and the GPU renders the clipped model. The clipped model is sent from the CPU to the GPU.
[0258] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0259] This application also describes a cloud server from the perspective of a physical device, as shown in Figure 9. Figure 9 The cloud server 900 shown includes a processor 901 and a memory 903. The processor 901 and the memory 903 are connected, for example, via a bus 902. Optionally, the cloud server 900 may also include a transceiver 904. It should be noted that in practical applications, the transceiver 904 is not limited to one type, and the structure of this cloud server 900 does not constitute a limitation on the embodiments of this application.
[0260] Processor 901 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 901 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0261] Bus 902 may include a pathway for transmitting information between the aforementioned components. Bus 902 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 902 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0262] The memory 903 may be a ROM (Read Only Memory) or other type of static storage device capable of storing static information and instructions, RAM (Random Access Memory) or other type of dynamic storage device capable of storing information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0263] The memory 903 stores application code that executes the scheme of this application, and its execution is controlled by the processor 901. The processor 901 executes the application code stored in the memory 903 to implement the content shown in the foregoing method embodiments.
[0264] This application also describes a client from the perspective of a physical device, which includes a processor and a memory. The processor and memory are connected, for example, via a bus. Optionally, the cloud server may also include a transceiver. It should be noted that in practical applications, the transceiver is not limited to one. Specifically, the structure of each component inside the client can be referred to the structure of the cloud server in the above embodiments, and will not be repeated here.
[0265] This application provides a computer-readable storage medium storing a computer program. When the program is run on a computer, it enables the computer to execute the corresponding content in the aforementioned 3D model cutting method embodiments. In this application embodiment, the cloud server performs clipping calculations on the target model based on the model clipping data corresponding to the target model, sends the clipping calculation results to the client, and then the client renders the model using the GPU. That is, in this application embodiment, the cloud server performs clipping calculations on the target model, eliminating the need for the GPU to perform clipping calculations. The GPU only needs to render the model based on the clipping calculation results, thereby reducing the GPU's computing power consumption.
[0266] This application also provides another computer-readable storage medium storing a computer program that, when run on a computer, enables the computer to execute the corresponding content in the aforementioned 3D model rendering method embodiments. In this application embodiment, the client sends model clipping data to a cloud server via the CPU, and the cloud server performs clipping calculations on the target model to obtain the clipping calculation result. After receiving the clipping calculation result from the cloud server, the CPU controls the GPU to render according to the clipping calculation result. That is, the clipping calculation result is obtained by the cloud server performing clipping calculations on the model clipping data corresponding to the target model, without requiring the GPU to perform clipping calculations on the model clipping data, thereby reducing the computing power consumption of the client's GPU.
[0267] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0268] The above are only some embodiments of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for cutting a 3D model, characterized in that, The method, executed by a cloud server, includes: The system receives a target model sent by the client, analyzes and obtains model clipping data corresponding to the target model based on the target model, and the model clipping data includes: clipping range and vertex data, wherein the vertex data is the vertex data corresponding to each vertex contained in the target model; Based on the model pruning data corresponding to the target model, a pruning calculation is performed on the target model to obtain a pruning calculation result. The pruning calculation result is used to characterize the model information in the target model that is within the pruning range. The clipping calculation results are sent to the client so that the client can render the model using the GPU; Based on the model clipping data corresponding to the target model, clipping calculations are performed on the target model to obtain the clipping calculation results, including: calculating the data of each visible vertex according to the clipping range and the data of each vertex, and clipping the target model based on the data of each visible vertex to obtain the clipped model; The step of calculating the data of each visible vertex based on the clipping range and the data of each vertex includes: Based on the clipping range, vertex data to be processed and vertex data to be retained are determined from each vertex data. The vertex data to be processed are vertex data located outside the clipping range, and the vertex data to be retained are vertex data located within the clipping range. When the target model has both retained vertex data and vertex data to be processed, the associated vertex data corresponding to the vertex data to be processed is determined from the vertex data. The associated vertex data and the vertex data to be processed can form a preset triangle. The subscript index included in the vertex data is used to represent the correspondence between the three vertices of the corresponding preset triangle primitive. The associated vertex data represents the data that can form a preset triangle primitive with the corresponding vertex data. The preset triangle includes three vertices. For any vertex data to be processed, any vertex to be processed corresponds to one vertex of the corresponding preset triangle, and the associated vertices are the other two vertices in the preset triangle corresponding to the vertex to be processed. Based on the vertex data to be processed and the corresponding associated vertex data, new vertex data is determined. The new vertex is the intersection point between the preset triangle and each boundary, and does not belong to any of the vertices. The boundary is the face that makes up the clipping range. The newly added vertex data and the retained vertex data are determined as the respective visible vertex data; Specifically, determining new vertex data based on the vertex data to be processed and the corresponding associated vertex data includes: Determine whether the two related vertices corresponding to the vertex to be processed are within the clipping range; If neither of the two associated vertices is within the clipping range, then the vertex to be processed will not have a corresponding new vertex. If one of the two associated vertices is within the clipping range and the other associated vertex is outside the clipping range, then when determining the two new vertices corresponding to the vertex to be processed, the associated vertex within the clipping range draws line segments to the vertex to be processed and the other associated vertex, respectively. The coordinates of the intersection point of each line segment with the boundary of the clipping range are determined, and the index of the intersection point is set and corresponds to the index of the associated vertex within the clipping range. If both associated vertices are within the clipping range, then starting from the vertex to be processed, draw line segments to the two associated vertices respectively, determine the coordinates of the intersection point of each line segment with the boundary of the clipping range, treat the intersection point as a new vertex, and set the subscript index corresponding to the intersection point. The subscript index corresponds to the subscript index of each associated vertex.
2. The method according to claim 1, characterized in that, Based on the clipping range and any vertex data, calculate the visible vertex data corresponding to any vertex data, including: Based on the clipping range, it is determined whether any vertex data belongs to vertex data to be processed or vertex data to be retained. If it belongs to the vertex data to be processed, then determine the associated vertex data corresponding to any vertex data from the vertex data; Based on any vertex data and its corresponding associated vertex data, determine whether there is any newly added vertex data; If it exists, the newly added vertex data will be identified as visible vertex data; If a vertex belongs to the retained vertex data, then any vertex data is determined as the visible vertex data.
3. The method according to claim 1, characterized in that, Sending the cropping calculation result to the client so that the client can render the model using the GPU includes any one of the following: The clipping calculation result is sent to the client's CPU, so that the CPU clips the target model based on the clipping calculation result and controls the GPU to render the model; The clipping calculation results are sent to the client's GPU so that the GPU can render the model based on the clipping calculation results.
4. A 3D model rendering method, characterized in that, The method is executed by a client, which communicates with the cloud server according to any one of claims 1-3, and includes: The CPU acquires the model pruning data corresponding to the target model and sends it to the cloud server corresponding to the target model. The model pruning data includes: pruning range and vertex data. The vertex data is the vertex data corresponding to each vertex contained in the target model. The CPU receives the clipping calculation results corresponding to the target model and controls the GPU to render the model based on the clipping calculation results. The clipping calculation results are obtained by the cloud server by performing clipping calculations on the target model according to the model clipping data corresponding to the target model. The clipping calculation results are used to characterize the model information in the target model that is within the clipping range.
5. The method according to claim 4, characterized in that, Sending the model pruning data corresponding to the target model to the cloud server corresponding to the target model, before that includes: From the cloud server cluster, randomly select any cloud server as the cloud server corresponding to the target model; or, The target server is determined to be the cloud server corresponding to the target model, and the target server is a cloud server that is currently in an idle state.
6. The method according to claim 4, characterized in that, The clipping calculation results include visible vertex data; The control of GPU for model rendering based on the pruning calculation results includes any one of the following: Based on the visible vertex data, the target model is cropped using the GPU, and the cropped model is rendered using the GPU; The CPU clips the target model based on the visible vertex data, and the GPU renders the clipped model. The clipped model is sent from the CPU to the GPU.
7. A cloud server, characterized in that, The cloud server includes: At least one processor; Memory; At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, said at least one application being configured to: perform the 3D model cutting method according to any one of claims 1-3.
8. A client application, characterized in that, The client includes: At least one processor; Memory; At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, said at least one application being configured to: perform the model rendering method according to any one of claims 4-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed in the computer, the computer is caused to perform the method according to any one of claims 1-6.