Rendering method of fragmentation model in virtual scene and related device
By determining the target frame center point and maximum collision size of the broken model in the virtual scene, and adjusting the position in combination with the distance field value, the problem of penetration in the rendering result was solved, and the rendering effect was improved.
Patent Information
- Application Number
- CN202511524901.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-01-27
AI Technical Summary
Existing technologies do not consider whether fragments collide with the scene surface when rendering broken models in virtual scenes, resulting in a penetration phenomenon in the rendering results and reducing the rendering effect.
By determining the target frame center point position and maximum collision size of the fragment model, the distance field value of the scene voxels is obtained, the position of the fragment model is adjusted to avoid collision, and rendering is performed based on the adjusted position.
This avoids the phenomenon of fragmented models penetrating the scene surface in the rendering result, thus improving the rendering effect.
Smart Images

Figure CN121414940A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a rendering method and related apparatus for a broken model in a virtual scene. Background Technology
[0002] With the rapid development of rendering technology, it can be used for virtual scenes. These virtual scenes may include fragmented models, and when rendering fragmented models within a virtual scene, the fragmented models can be rendered based on baked textures.
[0003] In related technologies, the rendering method for a broken model in a virtual scene is as follows: by obtaining the baked texture of the broken model through the multiple vertex positions of each fragment model included in the broken model, the broken model is rendered based on the baked texture of the broken model to obtain the rendering result of the broken model.
[0004] However, the above method renders the broken model by baking a texture determined by multiple vertex positions of each fragment model, without considering whether the fragment model collides with the scene surface of the virtual scene. This results in a penetration phenomenon between the broken model and the scene surface in the rendering result, thereby reducing the rendering effect. Summary of the Invention
[0005] To address the aforementioned technical issues, this application provides a rendering method and related apparatus for broken models in a virtual scene, which can prevent the broken models from penetrating the scene surface in the rendering result, thereby improving the rendering effect.
[0006] The embodiments of this application disclose the following technical solutions:
[0007] On one hand, embodiments of this application provide a method for rendering a broken model in a virtual scene, the method comprising:
[0008] For each fragment model included in the fragment model in the virtual scene, the center point and collision size of the fragment model are determined based on the vertex positions of multiple target frames of the fragment model, so as to obtain the target frame center point position and maximum collision size of the fragment model; the maximum collision size is the maximum distance from the vertex of the fragment model to the center point.
[0009] Obtain the distance field value of the scene voxel to which the center point of the target frame in the virtual scene belongs; the distance field value is the minimum distance from the center point of the scene voxel to the scene surface;
[0010] If it is determined that the fragment model collides with the scene surface based on the maximum collision size and the distance field value, the position of the center point of the target frame is adjusted according to the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames, so as to obtain the adjusted position of the fragment model.
[0011] The fragment model is rendered according to the adjusted position to obtain the rendering result of the fragment model.
[0012] On the other hand, embodiments of this application provide a rendering device for a broken model in a virtual scene, the device comprising: a determining unit, an acquiring unit, an adjusting unit, and a rendering unit;
[0013] The determining unit is used to determine the center point and collision size of each fragment model included in the fragment model in the virtual scene based on the vertex positions of multiple target frames of the fragment model, so as to obtain the target frame center point position and maximum collision size of the fragment model; the maximum collision size is the maximum distance from the vertex to the center point of the fragment model.
[0014] The acquisition unit is used to acquire the distance field value of the scene voxel to which the center point of the target frame in the virtual scene belongs; the distance field value is the minimum distance from the center point of the scene voxel to the scene surface;
[0015] The adjustment unit is used to adjust the position of the center point of the target frame according to the direction vector of the distance field value, the target frame movement speed of the fragment model and the interval time between adjacent frames if it is determined that the fragment model collides with the scene surface by the maximum collision size and the distance field value, so as to obtain the adjusted position of the fragment model.
[0016] The rendering unit is used to render the fragment model according to the adjusted position to obtain the rendering result of the fragment model.
[0017] On the other hand, embodiments of this application provide a computer device, the computer device including a processor and a memory:
[0018] The memory is used to store computer programs and to transfer the computer programs to the processor;
[0019] The processor is configured to execute the method described in any of the foregoing aspects according to instructions in the computer program.
[0020] On the other hand, embodiments of this application provide a computer-readable storage medium for storing a computer program that, when run on a computer device, causes the computer device to perform the methods described in any of the foregoing aspects.
[0021] On the other hand, embodiments of this application provide a computer program product, including a computer program that, when run on a computer device, causes the computer device to perform the method described in any of the foregoing aspects.
[0022] As can be seen from the above technical solution, for each fragment model included in the fragment model in the virtual scene, the target frame center point position of the fragment model and the maximum distance from the vertex of the fragment model to the center point, i.e., the maximum collision size, are determined by the vertex positions of multiple target frames of the fragment model. The target frame center point position of the fragment model is the basic data for rendering the fragment model, and the maximum collision size of the fragment model is the basis for determining whether the fragment model collides with the scene surface, providing a foundation for subsequent rendering of the fragment model. The minimum distance from the center point of the scene voxel to the scene surface, i.e., the distance field value, of the scene voxel to which the target frame center point position belongs in the virtual scene is obtained. The distance field value of the scene voxel to which the target frame center point position belongs is the basis for determining whether the fragment model collides with the scene surface, facilitating consideration of whether the fragment model collides with the scene surface of the virtual scene during subsequent rendering of the fragment model. When a collision between a fragment model and the scene surface is determined based on the maximum collision size and distance field value, the center point position of the target frame is adjusted using the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval between adjacent frames. This achieves the calculation of the adjusted position of the target frame center point of the fragment model when considering collisions between the fragment model and the scene surface of the virtual scene. The fragment model is then rendered based on the adjusted position to obtain the rendering result. Since the adjusted position takes into account the adjustment of the fragment model after collisions with the scene surface of the virtual scene, it avoids the phenomenon of the fragment model penetrating the scene surface in the rendering result, thereby improving the rendering effect. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A schematic diagram illustrating the rendering result of a fractured model provided for related technologies;
[0025] Figure 2 A system schematic diagram illustrating a rendering method for a broken model in a virtual scene, provided as an embodiment of this application;
[0026] Figure 3 A flowchart illustrating a rendering method for a broken model in a virtual scene, provided as an embodiment of this application;
[0027] Figure 4 A schematic diagram illustrating the rendering steps of a broken model in a virtual scene, provided as an embodiment of this application;
[0028] Figure 5 A schematic diagram illustrating the rendering result of a fractured model provided in an embodiment of this application;
[0029] Figure 6 A step diagram illustrating the process of adjusting the target frame center point position of a fragment model and determining the moving speed of the fragment model in the next frame, as provided in an embodiment of this application;
[0030] Figure 7 This application provides a schematic diagram of the positive X-axis direction, negative X-axis direction, positive Y-axis direction, negative Y-axis direction, positive Z-axis direction, and negative Z-axis direction with the center point of the scene voxel as the origin.
[0031] Figure 8 A structural diagram of a rendering device for a broken model in a virtual scene provided in an embodiment of this application;
[0032] Figure 9 A structural diagram of a server provided in an embodiment of this application;
[0033] Figure 10 This is a structural diagram of a terminal provided in an embodiment of this application. Detailed Implementation
[0034] The embodiments of this application will now be described with reference to the accompanying drawings.
[0035] Currently, the common method for rendering broken models in virtual scenes is to obtain baked textures for the broken model by analyzing the vertex positions of each fragment, and then render the broken model based on these baked textures. However, research has found that rendering broken models using baked textures determined by the vertex positions of each fragment does not consider whether the fragments collide with the virtual scene surface. This leads to a "penetration" effect between the broken model and the scene surface in the rendered result, thus degrading the rendering quality. For example, if the virtual scene is a game scene and the broken model is a stone model, see [reference needed]. Figure 1 ,Should Figure 1 This is a schematic diagram of the rendering result of a broken model provided for related technologies, in which the stone model shows a penetration phenomenon with the ground in the game scene.
[0036] This application provides a rendering method for a broken model in a virtual scene. For each fragment model included in the broken model in the virtual scene, the method determines the target frame center point position of the fragment model and the maximum distance from each vertex to the center point (i.e., the maximum collision size) by using multiple target frame vertex positions of the fragment model. The target frame center point position of the fragment model is the basic data for rendering the fragment model, and the maximum collision size is the basis for determining whether the fragment model collides with the scene surface, providing a foundation for subsequent rendering of the fragment model. The method also obtains the minimum distance (distance field value) from the center point of the scene voxel to which the target frame center point position belongs to the scene surface. The distance field value of the scene voxel to which the target frame center point position belongs is the basis for determining whether the fragment model collides with the scene surface, facilitating consideration of whether the fragment model collides with the scene surface of the virtual scene during subsequent rendering of the fragment model. When a collision between a fragment model and the scene surface is determined based on the maximum collision size and distance field value, the center point position of the target frame is adjusted using the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval between adjacent frames. This achieves the calculation of the adjusted position of the target frame center point of the fragment model when considering collisions between the fragment model and the scene surface of the virtual scene. The fragment model is then rendered based on the adjusted position to obtain the rendering result. Since the adjusted position takes into account the adjustment of the fragment model after collisions with the scene surface of the virtual scene, it avoids the phenomenon of the fragment model penetrating the scene surface in the rendering result, thereby improving the rendering effect.
[0037] Next, we will introduce the system architecture of the rendering method for fragmented models in virtual scenes. See [link / reference] Figure 2 ,Should Figure 2 This is a system schematic diagram of a method for rendering a broken model in a virtual scene according to an embodiment of this application. The system includes a terminal 201 and a server 202, which are used to execute the method for rendering a broken model in a virtual scene.
[0038] Terminal 201 can be a smartphone, tablet computer, laptop computer, desktop computer, intelligent voice interaction device, vehicle terminal, extended reality device or aircraft, etc., but is not limited to these.
[0039] Among them, server 202 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services, but it is not limited to these.
[0040] Furthermore, terminal 201 and server 202 can be connected directly or indirectly via wired or wireless communication, and this application does not impose any restrictions. For example, terminal 201 and server 202 can be connected via a network, which can be a wired or wireless network.
[0041] Terminal 201 obtains multiple target frame vertex positions of each fragment model included in the fragment model in the virtual scene; terminal 201 sends multiple target frame vertex positions of each fragment model to server 202.
[0042] As an example, the virtual scene is a game scene, the broken model is a stone model, and the terminal 201 obtains the multiple target frame vertex positions of each broken model included in the stone model in the game scene, which are M current frame vertex positions, where M is a positive integer and M≥2; the terminal 201 sends the M current frame vertex positions of each broken model to the server 202.
[0043] For each fragment model included in the fragment model in the virtual scene, server 202 determines the center point and collision size of the fragment model based on the vertex positions of multiple target frames of the fragment model, and obtains the center point position and maximum collision size of the target frames of the fragment model; the maximum collision size is the maximum distance from the vertex of the fragment model to the center point.
[0044] As an example, based on the above example, server 202 determines the target frame center point position of each fragment model included in the stone model in the game scene by using the multiple current frame vertex positions of the fragment model, and the maximum distance from the vertex of the fragment model to the center point, i.e., the maximum collision size.
[0045] Server 202 obtains the distance field value of the scene voxel to which the center point of the target frame in the virtual scene belongs; the distance field value is the minimum distance from the center point of the scene voxel to the scene surface.
[0046] As an example, based on the above example, server 202 obtains the minimum distance from the center point of the scene voxel to the scene surface, i.e., the Signed Distance Field (SDF) value, to the center point of the current frame in the game scene.
[0047] If server 202 determines that the fragment model collides with the scene surface based on the maximum collision size and distance field value, it adjusts the position of the center point of the target frame according to the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames, and obtains the adjusted position of the fragment model.
[0048] As an example, based on the above example, the target frame movement speed is the current frame movement speed; then, when the server 202 determines that the fragment model collides with the scene surface based on the maximum collision size and SDF value, it adjusts the position of the current frame center point to obtain the adjusted position by using the direction vector of the SDF value, the current frame movement speed of the fragment model, and the interval time between adjacent frames.
[0049] Server 202 renders the fragment model according to the adjusted position and obtains the rendering result of the fragment model; server 202 sends the rendering result of the fragment model to terminal 201 so that terminal 201 can display the rendering result of the fragment model.
[0050] As an example, based on the above example, server 202 renders the fragment model based on the adjusted position to obtain the rendering result of the fragment model; server 202 sends the rendering result of the fragment model to terminal 201 so that terminal 201 can display the rendering result of the fragment model.
[0051] The target frame center point position of the aforementioned fragment model is the basic data for rendering the fragment model. The maximum collision size of the fragment model is the basis for determining whether the fragment model collides with the scene surface, providing a foundation for subsequent rendering of the fragment model. The distance field value of the scene voxel to which the target frame center point position belongs is also the basis for determining whether the fragment model collides with the scene surface, making it easier to consider whether the fragment model collides with the scene surface of the virtual scene when rendering the fragment model. When considering the collision between the fragment model and the scene surface of the virtual scene, after calculating the adjusted position of the target frame center point position of the fragment model, the fragment model is rendered based on the adjusted position after considering the collision between the fragment model and the scene surface of the virtual scene. This can avoid the fragment model penetrating the scene surface in the rendering result, thereby improving the rendering effect.
[0052] It should be noted that, in the embodiments of this application, the execution device for the game character control method is a computer device, which can be a server or a terminal. The method provided in the embodiments of this application can be executed by the terminal or the server alone, or by the terminal and the server in cooperation. Specifically, when the method provided in the embodiments of this application is executed by the terminal or the server alone, its execution method is similar to... Figure 1 The corresponding embodiments are similar, mainly by merging the execution steps of terminal 201 and server 202 into the execution steps of the terminal, or merging the execution steps of terminal 201 and server 202 into the execution steps of the server.
[0053] Next, taking the method provided in the embodiments of this application as an example of a computer device executing the method, and in conjunction with the accompanying drawings, we will give a detailed description of the rendering method of the broken model in the virtual scene provided in the embodiments of this application.
[0054] See Figure 3 ,Should Figure 3 A flowchart illustrating a rendering method for a broken model in a virtual scene, provided in an embodiment of this application, is included. The method comprises:
[0055] S301: For each fragment model included in the fragment model in the virtual scene, the center point and collision size of the fragment model are determined according to the multiple target frame vertex positions of the fragment model, and the target frame center point position and maximum collision size of the fragment model are obtained; the maximum collision size is the maximum distance from the vertex of the fragment model to the center point.
[0056] S302: Obtain the distance field value of the scene voxel to which the center point of the target frame in the virtual scene belongs; the distance field value is the minimum distance from the center point of the scene voxel to the scene surface.
[0057] In related technologies, the rendering method for broken models in virtual scenes typically involves obtaining a baked texture map of the broken model using multiple vertex positions of each fragment, and then rendering the broken model based on this baked texture map. However, research has found that rendering the broken model using baked texture maps determined by multiple vertex positions of each fragment does not consider whether the fragments collide with the virtual scene surface. This leads to a penetration effect between the broken model and the scene surface in the rendering result, thus reducing the rendering quality.
[0058] In this embodiment of the application, in order to solve the above problems, firstly, when rendering the fragment model, it is necessary to determine the position of the center point of the fragment model. Secondly, in order to consider whether the fragment model collides with the scene surface of the virtual scene when rendering the fragment model, it is necessary to determine the maximum distance from the vertex of the fragment model to the center point, i.e., the maximum collision size, and the minimum distance from the center point of the scene voxel to which the center point position belongs in the virtual scene to the scene surface, i.e., the distance field value.
[0059] Based on this, for each fragment model included in the fragment model in the virtual scene, the position of the center point of the target frame of the fragment model and the maximum distance from the vertex of the fragment model to the center point, i.e., the maximum collision size, are determined by the multiple target frame vertex positions of the fragment model; the minimum distance from the center point of the scene voxel to the scene surface, i.e., the distance field value, is obtained.
[0060] Among them, virtual scene is digital 3D scene, such as game scene; broken model is virtual model that simulates the phenomenon of object breaking; fragment model is model obtained by breaking the broken model into pieces; multiple target frame vertex positions are the positions of multiple vertices of fragment model in target frame; target frame center point position is the position of center point of fragment model in target frame; scene voxel to which the target frame center point position belongs is the scene voxel of multiple scene voxels in virtual scene including the target frame center point position.
[0061] The target frame center point position of the S301-S302 fragment model is the basic data for rendering the fragment model, providing a foundation for subsequent rendering of the fragment model; the maximum collision size of the fragment model is the basis for determining whether the fragment model collides with the scene surface; the distance field value of the scene voxel to which the target frame center point position belongs is the basis for determining whether the fragment model collides with the scene surface, making it easier to consider whether the fragment model collides with the scene surface of the virtual scene when rendering the fragment model later.
[0062] As an example of S301-S302, the virtual scene is a game scene, the broken model is a stone model, and the multiple target frame vertex positions are M current frame vertex positions, where M is a positive integer and M≥2; for each broken model included in the stone model in the game scene, the computer device determines the target frame center point position of the broken model as the current frame center point position, and the maximum distance from the vertex of the broken model to the center point, i.e., the maximum collision size, through the M current frame vertex positions of the broken model; the computer device obtains the minimum distance from the center point of the scene voxel to the scene surface, i.e., the SDF value, to the scene surface.
[0063] S303: If it is determined that the fragment model collides with the scene surface through the maximum collision size and the distance field value, the position of the center point of the target frame is adjusted according to the direction vector of the distance field value, the target frame movement speed of the fragment model and the time interval between adjacent frames, so as to obtain the adjusted position of the fragment model.
[0064] S304: Render the fragment model according to the adjusted position to obtain the rendering result of the fragment model.
[0065] In this embodiment, after executing the above S301-S302 to determine the target frame center point position and maximum collision size of the fragment model, as well as the distance field value of the scene voxel to which the target frame center point position belongs in the virtual scene, based on the maximum collision size and distance field value as the basis for determining whether the fragment model collides with the scene surface, it can be determined whether the fragment model collides with the scene surface through the maximum collision size and distance field value. If so, that is, the fragment model collides with the scene surface, the target frame center point position of the fragment model needs to be adjusted. The adjusted position is obtained by adjusting the target frame center point position by the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames.
[0066] Based on this, when it is determined that the fragment model collides with the scene surface based on the maximum collision size and the distance field value, the position of the center point of the target frame is adjusted by using the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames to obtain the adjusted position; the fragment model is then rendered based on the adjusted position to obtain the rendering result of the fragment model.
[0067] Among them, the direction vector of the distance field value is the vector representing the direction from the center point of the scene voxel to the scene surface; the target frame movement speed is the movement speed of the fragment model in the target frame; the adjacent frame interval time is the interval time between two adjacent frames; the adjusted position is the position of the center point of the fragment model in the adjusted target frame; the rendering result is the result obtained by rendering the fragment model based on the adjusted position.
[0068] The implementation of S303-S304 calculates the adjusted position of the target frame center point of the fragment model when considering the collision between the fragment model and the scene surface of the virtual scene. Based on the adjusted position of the fragment model after considering the collision between the fragment model and the scene surface of the virtual scene, the fragment model is rendered based on the adjusted position, which can avoid the fragment model and the scene surface from penetrating in the rendering result, thereby improving the rendering effect.
[0069] As an example of S303-S304, based on the examples of S301-S302 above, the target frame movement speed is the current frame movement speed; when the computer device determines that the fragment model collides with the scene surface based on the maximum collision size and SDF value, it adjusts the position of the center point of the current frame to obtain the adjusted position by using the direction vector of the SDF value, the current frame movement speed of the fragment model, and the interval time between adjacent frames; the computer device renders the fragment model based on the adjusted position to obtain the rendering result of the fragment model.
[0070] See Figure 4 ,Should Figure 4This is a schematic diagram illustrating the rendering steps of a broken model in a virtual scene according to an embodiment of this application. The steps include: for each fragment model included in the broken model in the virtual scene, determining the target frame center point position and maximum collision size of the fragment model based on multiple target frame vertex positions; obtaining the distance field value of the scene voxel to which the target frame center point position belongs in the virtual scene; determining whether the fragment model collides with the scene surface using the maximum collision size and the distance field value; if so, adjusting the target frame center point position based on the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames to obtain the adjusted position; and rendering the fragment model using the adjusted position to obtain the rendering result of the fragment model.
[0071] See Figure 5 ,Should Figure 5 This is a schematic diagram illustrating the rendering result of a broken model provided in an embodiment of this application. Based on the above example, in this rendering result, the stone model collides with the ground in the game scene without penetrating, enhancing the realism of the game scene and thus improving the gaming experience.
[0072] As can be seen from the above technical solution, for each fragment model included in the fragment model in the virtual scene, the target frame center point position of the fragment model and the maximum distance from the vertex of the fragment model to the center point, i.e., the maximum collision size, are determined by the vertex positions of multiple target frames of the fragment model. The target frame center point position of the fragment model is the basic data for rendering the fragment model, and the maximum collision size of the fragment model is the basis for determining whether the fragment model collides with the scene surface, providing a foundation for subsequent rendering of the fragment model. The minimum distance from the center point of the scene voxel to the scene surface, i.e., the distance field value, of the scene voxel to which the target frame center point position belongs in the virtual scene is obtained. The distance field value of the scene voxel to which the target frame center point position belongs is the basis for determining whether the fragment model collides with the scene surface, facilitating consideration of whether the fragment model collides with the scene surface of the virtual scene during subsequent rendering of the fragment model. When a collision between a fragment model and the scene surface is determined based on the maximum collision size and distance field value, the center point position of the target frame is adjusted using the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval between adjacent frames. This achieves the calculation of the adjusted position of the target frame center point of the fragment model when considering collisions between the fragment model and the scene surface of the virtual scene. The fragment model is then rendered based on the adjusted position to obtain the rendering result. Since the adjusted position takes into account the adjustment of the fragment model after collisions with the scene surface of the virtual scene, it avoids the phenomenon of the fragment model penetrating the scene surface in the rendering result, thereby improving the rendering effect.
[0073] In this embodiment, the target frame vertex positions are the positions of multiple vertices of the fragment model in the target frame, and the target frame center point position is the position of the center point of the fragment model in the target frame. The target frame center point position can be determined by adding the multiple target frame vertex positions and dividing by the number of vertices of the fragment model. The maximum collision size is the maximum distance from the vertex of the fragment model to the center point. The maximum collision size can be determined by calculating the interval distance between each target frame vertex position and the target frame center point position and comparing their sizes.
[0074] Based on this, when executing the above-mentioned S301, which determines the center point and collision size of the fragment model based on the vertex positions of multiple target frames of the fragment model, and obtains the target frame center point position and maximum collision size of the fragment model, the specific implementation may include: first, determining the target frame center point position of the fragment model using the vertex positions of multiple target frames and the number of vertices of the fragment model; then, determining the maximum distance from the vertices of the fragment model to the center point, i.e., the maximum collision size, using the vertex positions of multiple target frames and the target frame center point position. Therefore, this application provides a possible implementation, and the above-mentioned S301 may include, for example, S301a-S301b (not shown in the figure).
[0075] S301a: Based on the vertex positions of multiple target frames and the number of vertices in the fragment model, determine the center point of the fragment model to obtain the center point position of the target frames.
[0076] S301b: Based on the vertex positions of multiple target frames and the center point position of the target frames, determine the collision size of the fragment model and obtain the maximum collision size.
[0077] The number of vertices refers to the total number of vertices in the fragment model.
[0078] Specifically, S301a can be: summing the vertex positions of multiple target frames to obtain the summed positions; and dividing the summed positions by the number of vertices in the fragment model to obtain the maximum collision size.
[0079] Based on the fact that the center point of the fragment model is determined by multiple vertices of the fragment model, the above S301a-S301b can accurately determine the position of the center point of the target frame of the fragment model by using the positions of multiple target frame vertices and the number of vertices of the fragment model; by using the positions of multiple target frame vertices and the position of the center point of the target frame, the distance between each vertex of the fragment model and the center point can be accurately determined, thereby accurately determining the maximum collision size of the fragment model.
[0080] As an example of S301a-S301b, based on the examples of S301-S302 above, the computer device first determines the current frame center point position of the fragment model by using the M current frame vertex positions and the number of vertices M of the fragment model; then the computer device determines the maximum collision size of the fragment model by using the M current frame vertex positions and the current frame center point position.
[0081] In this embodiment of the application, the maximum collision size is obtained by calculating and comparing the distance between the vertex position and the center point position of each target frame. The maximum collision size is determined by calculating the distance between the vertex position and the center point position of each target frame. There are multiple distances between the vertex positions and the center point positions of multiple target frames. The maximum collision size is determined by comparing the multiple distances to obtain the maximum distance.
[0082] Based on this, when executing the above-mentioned S301b, which determines the collision size of the fragment model based on the vertex positions and center point positions of multiple target frames, and obtains the maximum collision size, it may include: first calculating the interval distance between the vertex position and the center point position of each target frame; then, based on the interval distance between the vertex position and the center point position of each target frame, using the maximum distance as the maximum collision size of the fragment model. Therefore, this application provides a possible implementation, and the above-mentioned S301b may include, for example, S301bb-S301bc (not shown in the figure).
[0083] S301bb: Determine the distance between the vertex position and the center point position of each target frame to obtain the interval distance between the vertex position and the center point position of each target frame.
[0084] S301bb: The maximum distance is determined based on the interval between the vertex position of each target frame and the center point position of the target frame, thus obtaining the maximum collision size.
[0085] The distance between the vertex position and the center point of each target frame is the spatial distance between the vertex position and the center point of each target frame in the virtual scene.
[0086] The above S301bb-S301bc calculates the interval distance between the vertex position and the center point position of each target frame, obtaining multiple interval distances between the vertex positions and the center point positions of multiple target frames, which can accurately represent multiple collision sizes of the fragment model; based on the interval distance between the vertex position and the center point position of each target frame, the maximum distance is taken as the maximum collision size of the fragment model, realizing the accurate determination of the maximum collision size from multiple collision sizes.
[0087] As an example of S301bb-S301bc, based on the examples of S301a-S301b above, the computer device first calculates the distance between the vertex position and the center point position of each current frame; then, based on the distance between the vertex position and the center point position of each current frame, the computer device takes the maximum distance among the M distances as the maximum collision size of the fragment model.
[0088] In this embodiment, the adjusted position is obtained by adjusting the center point position of the target frame based on the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval between adjacent frames. Considering that the displacement of the fragment model can be determined by the target frame movement speed and the interval between adjacent frames, the displacement vector of the fragment model can be determined by combining the direction vector of the distance field value, and the adjusted position of the fragment model can be determined by combining the center point position of the target frame.
[0089] Based on this, the specific implementation of adjusting the position of the target frame center point according to the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames in the above-mentioned S303, to obtain the adjusted position of the fragment model, may include: obtaining a displacement vector based on the direction vector of the distance field value, combined with the target frame movement speed of the fragment model and the interval time between adjacent frames; adjusting the position of the target frame center point of the fragment model based on the displacement vector to obtain the adjusted position of the fragment model. Therefore, this application provides a possible implementation method in which the step of adjusting the position of the target frame center point according to the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames in the above-mentioned S303, for example, may include S303a-S303b (not shown in the figure).
[0090] S303a: The displacement is determined based on the direction vector, the target frame's moving speed, and the time interval between adjacent frames to obtain the displacement vector.
[0091] S303b: Adjust the position of the center point of the target frame according to the displacement vector to obtain the adjusted position.
[0092] The displacement vector is the direction vector of the fragment model toward the distance field value, which is obtained by moving the adjacent frame interval according to the target frame's moving speed.
[0093] Based on the direction vector of the distance field value representing the movement direction of the fragment model after colliding with the scene surface, the above S303a-S303b, combined with the target frame movement speed of the fragment model and the interval time between adjacent frames, obtains the displacement vector, which can accurately determine the movement vector of the fragment model after colliding with the scene surface; based on the displacement vector, the target frame center point position of the fragment model is adjusted, realizing the adjustment of the target frame center point position of the fragment model based on the movement vector of the fragment model after colliding with the scene surface, so as to obtain the adjusted position of the fragment model, making the adjusted position accurately represent the adjusted position of the fragment model after colliding with the scene surface of the virtual scene.
[0094] As an example of S303a-S303b, based on the examples of S303-S304 above, the computer device obtains a displacement vector by combining the current frame movement speed of the fragment model and the interval time between adjacent frames with the direction vector of the SDF value; the computer device adjusts the current frame center point position of the fragment model based on the displacement vector to obtain the adjusted position of the fragment model.
[0095] Specifically, the adjusted position of the fragment model = the current frame center point position of the fragment model + the direction vector of the SDF value × the current frame movement speed of the fragment model × the interval between adjacent frames. The interval between adjacent frames can be ∆t.
[0096] Furthermore, in this embodiment, considering the collision between the fragment model and the scene surface, the moving speed of the fragment model in the next frame is determined not only by the adjusted position of the fragment model, the center point position of the previous frame, and the interval time between adjacent frames, but also by the moving speed of the fragment model in the target frame, the standardized direction vector, and the collision force of the fragment model. Moreover, the collision force of the fragment model affects the speed determined by the adjusted position of the fragment model, the center point position of the previous frame, and the interval time between adjacent frames.
[0097] Based on this, the next frame movement speed of the fragment model can be determined by considering the adjusted position of the fragment model, the center point position of the previous frame, the interval between adjacent frames, the target frame movement speed of the fragment model, the standardized direction vector of the distance field value, and the collision force of the fragment model. Therefore, this application provides a possible implementation method, which may further include, for example, S1 (not shown in the figure): determining the speed based on the adjusted position, the center point position of the fragment model in the previous frame, the interval between adjacent frames, the target frame movement speed, the standardized direction vector, and the collision force of the fragment model to obtain the next frame movement speed of the fragment model.
[0098] Among them, the target frame moving speed is the moving speed of the fragment model corresponding to the target frame; the normalized direction vector is the direction vector after normalization; and the next frame moving speed is the moving speed of the fragment model in the next frame corresponding to the target frame.
[0099] S1 above addresses the scenario where a fragment model collides with the scene surface. Based on the adjusted position of the fragment model, the center point position of the previous frame, the time interval between adjacent frames, the target frame movement speed of the fragment model, the standardized direction vector of the distance field value, and the collision force of the fragment model, the movement speed of the fragment model in the next frame is determined. This means that the movement speed of the fragment model in the next frame is affected not only by the adjusted position of the fragment model, the center point position of the previous frame, and the time interval between adjacent frames, but also by the target frame movement speed of the fragment model, the standardized direction vector of the distance field value, and the collision force of the fragment model, thus achieving accurate determination of the movement speed of the fragment model in the next frame.
[0100] As an example of S1, based on the examples of S303-S304 above, the target frame moving speed is the current frame moving speed; the computer device determines the next frame moving speed of the fragment model based on the adjusted position of the fragment model, the position of the center point of the previous frame, the time interval between adjacent frames, the current frame moving speed of the fragment model, the standardized direction vector of the distance field value, and the collision force of the fragment model.
[0101] In this embodiment, the moving speed of the fragment model in the next frame is determined by the base speed and collision speed of the fragment model after it collides with the scene surface. On the one hand, the adjusted position of the fragment model, the center point position of the previous frame, and the time interval between adjacent frames, combined with the collision force of the fragment model, are used to determine the base speed of the fragment model after it collides with the scene surface. On the other hand, the moving speed of the fragment model in the target frame, the standardized direction vector, and the collision force of the fragment model are used to determine the collision speed of the fragment model after it collides with the scene surface. Thus, the base speed and collision speed are used to determine the moving speed of the fragment model in the next frame.
[0102] Based on this, when performing the above-mentioned S1 to determine the velocity based on the adjusted position, the center point position of the fragment model in the previous frame, the interval time between adjacent frames, the target frame movement speed, the standardized direction vector, and the collision force of the fragment model, and to obtain the movement speed of the fragment model in the next frame, the specific implementation may include: determining a first velocity representing the base velocity by combining the adjusted position of the fragment model, the center point position of the previous frame, and the interval time between adjacent frames with the collision force of the fragment model; determining a second velocity representing the collision velocity by combining the target frame movement speed of the fragment model, the standardized direction vector, and the collision force of the fragment model; and superimposing the first velocity and the second velocity to obtain the movement speed of the fragment model in the next frame. Therefore, this application provides a possible implementation, and the above-mentioned S1 may include, for example, S1a-S1c (not shown in the figure).
[0103] S1a: Determine the velocity based on the adjusted position, the center point position of the previous frame, the time interval between adjacent frames, and the collision force to obtain the first velocity.
[0104] S1b: Determine the second velocity by using the target frame's moving speed, the standardized direction vector, and the collision force.
[0105] S1c: The first speed and the second speed are superimposed to obtain the movement speed of the next frame.
[0106] The first velocity represents the base velocity of the fragment model in the previous frame after it collides with the scene surface in the target frame; the second velocity is the collision velocity of the fragment model after it collides with the scene surface.
[0107] The above S1a-S1c determine the first velocity by combining the adjusted position of the fragment model, the center point position of the previous frame, and the time interval between adjacent frames with the collision force of the fragment model. This velocity accurately represents the basic velocity of the fragment model after it collides with the scene surface. The second velocity is determined by combining the target frame movement velocity of the fragment model, the standardized direction vector, and the collision force of the fragment model. This velocity accurately represents the collision velocity of the fragment model after it collides with the scene surface. The first and second velocities are superimposed to obtain the movement velocity of the fragment model in the next frame. This velocity accurately represents the movement velocity of the fragment model in the next frame after it collides with the scene surface.
[0108] As an example of S1a-S1c, based on the example of S1 above, the computer device determines a first velocity representing the base velocity by combining the adjusted position of the fragment model, the center point position of the previous frame, and the time interval between adjacent frames, along with the collision force of the fragment model; the computer device determines a second velocity representing the collision velocity by combining the target frame movement velocity of the fragment model, the standardized direction vector, and the collision force of the fragment model; the computer device superimposes the first velocity and the second velocity to obtain the movement velocity of the fragment model in the next frame.
[0109] Specifically, the formula for calculating the movement speed of the fragment model in the next frame is as follows:
[0110] ;
[0111] Among them, C P P is the adjusted position of the fragment model, P is the center point position of the fragment model in the previous frame, ∆t is the time interval between adjacent frames, B is the collision force of the fragment model, V is the target frame movement speed of the fragment model, and N is the normalized direction vector.
[0112] In this embodiment, the maximum collision size is the maximum distance from the vertex to the center point of the fragment model. The scene voxel to which the center point of the target frame of the fragment model belongs has a distance field value, which is the minimum distance from the center point of the scene voxel to the scene surface. If the maximum collision size is close to the distance field value, it indicates that the fragment model has collided with the scene surface. That is, in the above S303, determining that the fragment model has collided with the scene surface by the maximum collision size and the distance field value is actually that the absolute value of the difference between the maximum collision size and the distance field value is less than a preset value greater than 0. Based on this, this application provides a possible implementation method. The step of determining that the fragment model has collided with the scene surface by the maximum collision size and the distance field value in the above S303 may include, for example, the following S2 (not shown in the figure): if the absolute value of the difference between the maximum collision size and the distance field value is less than a preset value, it is determined that the fragment model has collided with the scene surface, and the preset value is greater than 0.
[0113] Among them, the absolute value of the difference between the maximum collision size and the distance field value is the difference between the maximum collision size and the distance field value; the preset value is the pre-configured error value.
[0114] If the absolute value of the difference between the maximum collision size and the distance field value is less than a preset value greater than 0, it means that the maximum distance from the vertex of the fragment model to the center point is close enough to the minimum distance from the center point of the scene voxel where the fragment model is located to the scene surface, so that the collision between the fragment model and the scene surface can be determined more accurately.
[0115] As an example of S1a-S1c, based on the example of S1 above, the preset value is ε; when the absolute value of the difference between the maximum collision size and the distance field value is less than ε, the computer device determines that the fragment model has collided with the scene surface, and ε>0.
[0116] See Figure 6 ,Should Figure 6 This application provides a step diagram illustrating the process of adjusting the target frame center point position of a fragment model and determining the next frame's movement speed. The steps include: determining whether the absolute value of the difference between the maximum collision size of the fragment model and the distance field value of the scene voxel where the fragment model is located is less than a preset value; if so, determining that the fragment model has collided with the scene surface; obtaining a displacement vector based on the direction vector of the distance field value, combined with the target frame's movement speed and the interval between adjacent frames; adjusting the target frame center point position of the fragment model based on the displacement vector to obtain the adjusted position of the fragment model; determining a first speed by combining the adjusted position of the fragment model, the center point position of the previous frame, the interval between adjacent frames, and the collision force of the fragment model; determining a second speed by combining the target frame's movement speed, the standardized direction vector, and the collision force of the fragment model; and superimposing the first and second speeds to obtain the next frame's movement speed of the fragment model.
[0117] In this embodiment, the virtual scene can be uniformly divided into multiple three-dimensional meshes, i.e., multiple scene voxels. These multiple scene voxels can be obtained by dividing the virtual scene based on a preset voxel size, or by dividing the virtual scene based on a preset number of voxels. Based on this, this application provides a possible implementation method in which the virtual scene includes multiple scene voxels, and the steps for obtaining multiple scene voxels include the following S3 (not shown in the figure) or S4 (not shown in the figure).
[0118] S3: Divide the virtual scene into voxels according to the preset voxel size to obtain multiple scene voxels.
[0119] S4: Divide the virtual scene into voxels according to the preset number of voxels to obtain multiple scene voxels.
[0120] Among them, the preset voxel size is the size of the pre-configured 3D mesh; the preset voxel number is the number of pre-configured 3D meshes; and multiple scene voxels are multiple 3D meshes.
[0121] The S3 divides the virtual scene based on a preset voxel size, so that the virtual scene is evenly divided into multiple three-dimensional meshes of preset voxel size, resulting in multiple scene voxels. This method does not require calculating the size of the three-dimensional mesh and can simply and quickly realize the voxel division of the virtual scene.
[0122] The S4 divides the virtual scene based on a preset number of voxels, so that the virtual scene is evenly divided into a three-dimensional mesh of a preset number of voxels, resulting in multiple scene voxels. This method calculates the size of the three-dimensional mesh based on the size of the virtual scene and the preset number of voxels, avoiding redundant areas of non-virtual scene included in multiple scene voxels, and accurately and without redundancy to achieve voxel division of the virtual scene.
[0123] As an example of S3, based on the examples of S301-S302 above, the computer device divides the game scene into multiple scene voxels based on a preset voxel size. The preset voxel size can be 1024×1024×1024.
[0124] As an example of S4, based on the examples of S301-S302 above, the computer device divides the game scene based on a preset number of voxels to obtain multiple scene voxels.
[0125] In this embodiment of the application, based on the aforementioned distance field value being the minimum distance from the center point of the scene voxel to the scene surface, the distance field value can be determined by calculating the interval distance from the center point of the scene voxel to the scene surface in each of the multiple preset directions and comparing their magnitudes; that is, the distance field value is determined by calculating the interval distance from the center point to the scene surface in each preset direction, so that the center point has multiple interval distances to the scene surface in the multiple preset directions, and the minimum distance is obtained by comparing the multiple interval distances to determine the distance field value.
[0126] Based on this, the step of obtaining the distance field value in S302 above may include: firstly, calculating the interval distance from the center point of the scene voxel to the scene surface in each preset direction, based on the omnidirectional directions covering the scene voxel in multiple preset directions; and then, based on the interval distance from the center point of the scene voxel to the scene surface in each preset direction, taking the minimum distance as the distance field value of the scene voxel. Therefore, this application provides a possible implementation, and the step of obtaining the distance field value in S302 above may include, for example, the following S5-S6 (not shown in the figure).
[0127] S5: Determine the distance from the center point of the scene voxel to the scene surface in each of the multiple preset directions, and obtain the interval distance from the center point to the scene surface in each preset direction; the multiple preset directions cover the omnidirectional directions of the scene voxel based on the center point.
[0128] S6: Determine the minimum distance based on the interval distance from the center point to the scene surface in each preset direction, and obtain the distance field value.
[0129] The distance between the center point and the scene surface in each preset direction is the return distance of the ray emitted from the center point of the scene voxel to the scene surface in each preset direction.
[0130] S5-S6 calculates the interval distance from the center point of the scene voxel to the scene surface in each preset direction for the omnidirectional coverage of multiple preset directions, thus obtaining multiple interval distances from the center point of the scene voxel to the scene surface in multiple preset directions. Based on the interval distance from the center point to the scene surface in each preset direction, the minimum distance is taken as the distance field value of the scene voxel, thereby accurately determining the interval distance from the center point of the scene voxel to the nearest scene surface, i.e., the distance field value, from multiple interval distances.
[0131] As an example of S5-S6, based on the examples of S301-S302 above, the multiple preset directions are K preset directions, where K is a positive integer and K≥6. The computer device first calculates the distance between the center point of the scene voxel and the scene surface in each preset direction, based on the omnidirectional directions of the scene voxel covered by the K preset directions. Then, based on the distance between the center point of the scene voxel and the scene surface in each preset direction, the computer device takes the maximum distance among the K distances as the SDF value of the scene voxel.
[0132] In this embodiment, based on multiple preset directions covering the omnidirectional directions of the scene voxels based on their center points, and considering that the scene voxels are three-dimensional meshes, in a three-dimensional coordinate system, they at least include positive X-axis, negative X-axis, positive Y-axis, negative Y-axis, positive Z-axis, and negative Z-axis directions with the center point of the scene voxel as the origin. Therefore, to improve the efficiency of determining the distance field value of the scene voxels, the multiple preset directions can cover the positive X-axis, negative X-axis, positive Y-axis, negative Y-axis, positive Z-axis, and negative Z-axis directions with the center point of the scene voxel as the origin. Based on this, this application provides a possible implementation where the multiple preset directions include the positive X-axis, negative X-axis, positive Y-axis, negative Y-axis, positive Z-axis, and negative Z-axis directions with the center point as the origin.
[0133] The positive X-axis direction is along the direction indicated by the positive X-axis arrow, and the negative X-axis direction is the opposite direction to the positive X-axis direction; the positive Y-axis direction is along the direction indicated by the positive Y-axis arrow, and the negative Y-axis direction is the opposite direction to the positive Y-axis direction; the positive Z-axis direction is along the direction indicated by the positive Z-axis arrow, and the negative Z-axis direction is the opposite direction to the positive Z-axis direction.
[0134] This method employs multiple preset directions, including the positive X-axis, negative X-axis, positive Y-axis, negative Y-axis, positive Z-axis, and negative Z-axis directions with the center point as the origin. These preset directions cover the basic omnidirectional directions of the scene voxels. When the number of basic omnidirectional directions is relatively small, the distance field value of the scene voxels can be quickly determined, thereby improving the efficiency of determining the distance field value of the scene voxels while ensuring a certain level of accuracy.
[0135] See Figure 7 ,Should Figure 7 This application provides a schematic diagram illustrating the positive X-axis, negative X-axis, positive Y-axis, negative Y-axis, positive Z-axis, and negative Z-axis directions, with the center point of a scene voxel as the origin. Specifically, for each scene voxel, a three-dimensional coordinate system, the XYZ coordinate system, is constructed with the center point of the scene voxel as the origin. The direction indicated by the arrow along the positive X-axis is the positive X-axis direction, and the direction opposite to the positive X-axis direction is the negative X-axis direction. Similarly, the direction indicated by the arrow along the positive Y-axis is the positive Y-axis direction, and the direction opposite to the positive Y-axis direction is the negative Y-axis direction. Likewise, the direction indicated by the arrow along the positive Z-axis is the positive Z-axis direction, and the direction opposite to the positive Z-axis direction is the negative Z-axis direction.
[0136] In this embodiment, the fragmentation model can be divided into multiple fragment models. These multiple fragment models can be obtained by dividing the fragmentation model based on a preset fragment size, or by dividing the fragmentation model based on a preset fragment quantity. Based on this, this application provides a possible implementation method in which the fragmentation model includes multiple fragment models, and the steps for obtaining multiple fragment models may include, for example, the following S7 (not shown in the figure) or S8 (not shown in the figure).
[0137] S7: Divide the broken model into multiple fragment models according to the preset fragment size.
[0138] S8: Divide the broken model into multiple fragment models according to the preset number of fragments.
[0139] Among them, the preset fragment size is the size of the pre-configured crushing model; the preset fragment quantity is the number of pre-configured crushing models.
[0140] The S7 is based on a pre-defined fragment size segmentation model, which uniformly divides the fragmentation model into multiple fragment sizes, resulting in multiple fragment models. This method eliminates the need to calculate the size of the fragment models, and can quickly and easily achieve the segmentation of fragment models.
[0141] The S8 is based on a pre-set number of fragments and a segmentation model. It adaptively and flexibly segments the fragmentation model into multiple fragment models, thus obtaining multiple fragment models. This method does not require uniformly segmenting the fragmentation model into multiple fragment models, and achieves the segmentation processing of the fragment model more naturally and realistically.
[0142] As an example of S7, based on the examples of S301-S302 above, the computer device obtains multiple fragment models based on a pre-set fragment size stone model.
[0143] As an example of S8, based on the examples of S301-S302 above, the computer device divides the stone model into multiple fragment models based on a preset number of fragments.
[0144] It should be noted that, based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods.
[0145] In summary, the rendering method for broken models in virtual scenes provided in this application can prevent the fragments of the broken model from penetrating the scene surface in the rendered result, thereby improving the rendering effect, enhancing the realism of the virtual scene, and thus improving the interactive experience of the virtual scene. This rendering method for broken models in virtual scenes can be used in game scenes. Furthermore, the rendering method for broken models in virtual scenes provided in this application enables collision detection between the fragments and the scene surface during the rendering process. This collision detection has extremely low performance overhead and very short computation time.
[0146] based on Figure 3 Corresponding to the rendering method for a broken model in a virtual scene provided in the embodiments, this application also provides a rendering apparatus for a broken model in a virtual scene, see [link to relevant documentation]. Figure 8 ,Should Figure 8 The present application provides a structural diagram of a rendering device for a broken model in a virtual scene. The rendering device 800 for the broken model in the virtual scene includes: a determining unit 801, an acquiring unit 802, an adjusting unit 803, and a rendering unit 804.
[0147] The determining unit 801 is used to determine the center point and collision size of each fragment model included in the fragment model in the virtual scene based on the vertex positions of multiple target frames of the fragment model, and obtain the target frame center point position and maximum collision size of the fragment model; the maximum collision size is the maximum distance from the vertex of the fragment model to the center point.
[0148] The acquisition unit 802 is used to acquire the distance field value of the scene voxel to which the center point of the target frame in the virtual scene belongs; the distance field value is the minimum distance from the center point of the scene voxel to the scene surface;
[0149] The adjustment unit 803 is used to adjust the position of the center point of the target frame according to the direction vector of the distance field value, the target frame movement speed of the fragment model and the interval time between adjacent frames if it is determined that the fragment model collides with the scene surface through the maximum collision size and the distance field value, so as to obtain the adjusted position of the fragment model.
[0150] Rendering unit 804 is used to render the fragment model according to the adjusted position and obtain the rendering result of the fragment model.
[0151] In one possible implementation, the determining unit 801 is specifically used for:
[0152] Based on the vertex positions of multiple target frames and the number of vertices in the fragment model, the center point of the fragment model is determined to obtain the center point position of the target frames;
[0153] Based on the vertex positions of multiple target frames and the center point position of the target frames, the collision size of the fragment model is determined to obtain the maximum collision size.
[0154] In one possible implementation, the determining unit 801 is specifically used for:
[0155] The distance between the vertex position and the center point position of each target frame is determined to obtain the interval distance between the vertex position and the center point position of each target frame.
[0156] The maximum collision size is obtained by determining the maximum distance between the vertex position of each target frame and the center point position of the target frame.
[0157] In one possible implementation, the adjustment unit 803 is specifically used for:
[0158] Displacement is determined based on the direction vector, the target frame's moving speed, and the time interval between adjacent frames, thus obtaining the displacement vector.
[0159] The position of the center point of the target frame is adjusted based on the displacement vector to obtain the adjusted position.
[0160] In one possible implementation, the adjustment unit 803 is also used for:
[0161] The velocity is determined based on the adjusted position, the center point position of the fragment model in the previous frame, the time interval between adjacent frames, the moving speed of the target frame, the standardized direction vector, and the collision force of the fragment model, so as to obtain the moving speed of the fragment model in the next frame.
[0162] In one possible implementation, the adjustment unit 803 is specifically used for:
[0163] The velocity is determined based on the adjusted position, the center point position of the previous frame, the time interval between adjacent frames, and the collision force to obtain the first velocity;
[0164] The target frame's moving speed, the standardized direction vector, and the collision force are used to determine the velocity, thus obtaining the second velocity;
[0165] The first and second speeds are superimposed to obtain the movement speed for the next frame.
[0166] In one possible implementation, the determining unit 801 is further configured to:
[0167] If the absolute value of the difference between the maximum collision size and the distance field value is less than the preset value, it is determined that the fragment model has collided with the scene surface. The preset value is greater than 0.
[0168] In one possible implementation, the device 800 further includes: a partitioning unit;
[0169] Dividing units, used for:
[0170] The virtual scene is divided into voxels according to a preset voxel size to obtain multiple scene voxels; or,
[0171] The virtual scene is divided into voxels according to a preset number of voxels to obtain multiple scene voxels.
[0172] In one possible implementation, the determining unit 801 is further configured to:
[0173] The distance from the center point of the scene voxel to the scene surface in each of the multiple preset directions is determined to obtain the interval distance from the center point to the scene surface in each preset direction; the multiple preset directions cover the omnidirectional directions of the scene voxel based on the center point;
[0174] The minimum distance is determined based on the interval distance from the center point to the scene surface in each preset direction, and the distance field value is obtained.
[0175] In one possible implementation, the multiple preset directions include the positive X-axis direction, the negative X-axis direction, the positive Y-axis direction, the negative Y-axis direction, the positive Z-axis direction, and the negative Z-axis direction, with the center point as the origin.
[0176] In one possible implementation, the fragmentation model includes multiple fragmentation models, and the device 800 also includes: a segmentation unit;
[0177] Block unit, used for:
[0178] The fragmentation model is divided into multiple fragment models based on a preset fragment size; or...
[0179] The fragmentation model is divided into multiple fragment models based on a preset number of fragments.
[0180] As can be seen from the above technical solution, the rendering device for the broken model in the virtual scene includes a determination unit, an acquisition unit, an adjustment unit, and a rendering unit. The determination unit, for each fragment model included in the broken model in the virtual scene, determines the target frame center point position of the fragment model and the maximum distance from the vertex to the center point (i.e., the maximum collision size) by using the vertex positions of multiple target frames of the fragment model. The target frame center point position of the fragment model is the basic data for rendering the fragment model, and the maximum collision size is the basis for determining whether the fragment model collides with the scene surface, providing a foundation for subsequent rendering of the fragment model. The acquisition unit acquires the minimum distance (distance field value) from the center point of the scene voxel to which the target frame center point position belongs in the virtual scene to the scene surface. The distance field value of the scene voxel to which the target frame center point position belongs is the basis for determining whether the fragment model collides with the scene surface, facilitating consideration of whether the fragment model collides with the scene surface during subsequent rendering of the fragment model. The adjustment unit, based on the maximum collision size and distance field value, determines the collision between the fragment model and the scene surface. It then adjusts the target frame's center point position using the direction vector of the distance field value, the target frame's movement speed, and the interval between adjacent frames. This achieves the adjusted position of the target frame's center point when considering collisions between the fragment model and the virtual scene's surface. The rendering unit renders the fragment model based on this adjusted position, resulting in a better rendering effect. By considering the adjusted position after a collision with the virtual scene's surface, the unit avoids penetration between the fragment model and the scene surface in the rendering result, thus improving the rendering quality.
[0181] This application also provides a computer device, which may be a server, see [link to previous document]. Figure 9 ,Should Figure 9 This application provides a structural diagram of a server 900. The server 900 can vary significantly due to different configurations or performance characteristics. It may include one or more processors, such as a central processing unit (CPU) 922, and a memory 932, as well as one or more storage media 930 (e.g., one or more mass storage devices) for storing application programs 942 or data 944. The memory 932 and storage media 930 can be temporary or persistent storage. The program stored in the storage media 930 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 922 may be configured to communicate with the storage media 930 and execute the series of instruction operations stored in the storage media 930 on the server 900.
[0182] Server 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input / output interfaces 958, and / or one or more operating systems 941, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0183] In this embodiment, the central processing unit 922 in the server 900 can execute the methods provided in the various optional implementations of the above embodiments.
[0184] The computer device provided in this application embodiment can also be a terminal, see [link to relevant documentation]. Figure 10 ,Should Figure 10 This is a structural diagram of a terminal provided in an embodiment of this application. Taking a smartphone as an example, the smartphone includes components such as a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless Fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090. The input unit 1030 may include a touch panel 1031 and other input devices 1032, the display unit 1040 may include a display panel 1041, and the audio circuit 1060 may include a speaker 1061 and a microphone 1062. Those skilled in the art will understand that... Figure 10 The smartphone structure shown does not constitute a limitation on smartphones and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0185] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various functions and data processing of the smartphone by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the smartphone (such as audio data, phonebook, etc.). In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0186] The processor 1080 is the control center of the smartphone, connecting various parts of the smartphone via various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 1020 and by accessing data stored in the memory 1020. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1080.
[0187] In this embodiment, the processor 1080 in the smartphone can execute the methods provided in the various optional implementations of the above embodiments.
[0188] According to one aspect of this application, a computer-readable storage medium is provided for storing a computer program that, when run on a computer device, causes the computer device to perform the methods provided in various optional implementations of the above embodiments.
[0189] According to one aspect of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the methods provided in various optional implementations of the above embodiments.
[0190] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0191] The terms "first," "second," etc., used in this application's specification and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0192] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0193] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0194] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0195] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), RAM, magnetic disks, or optical disks.
[0196] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0197] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for rendering a broken model in a virtual scene, characterized in that, The method includes: For each fragment model included in the fragment model in the virtual scene, the center point and collision size of the fragment model are determined based on the vertex positions of multiple target frames of the fragment model, so as to obtain the target frame center point position and maximum collision size of the fragment model; the maximum collision size is the maximum distance from the vertex of the fragment model to the center point. Obtain the distance field value of the scene voxel to which the center point of the target frame in the virtual scene belongs; the distance field value is the minimum distance from the center point of the scene voxel to the scene surface; If it is determined that the fragment model collides with the scene surface based on the maximum collision size and the distance field value, the position of the center point of the target frame is adjusted according to the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames, so as to obtain the adjusted position of the fragment model. The fragment model is rendered according to the adjusted position to obtain the rendering result of the fragment model.
2. The method according to claim 1, characterized in that, The step of determining the center point and collision size of the fragment model based on the vertex positions of multiple target frames of the fragment model, and obtaining the center point position and maximum collision size of the target frames of the fragment model, includes: Based on the vertex positions of the multiple target frames and the number of vertices of the fragment model, the center point of the fragment model is determined to obtain the center point position of the target frames; Based on the vertex positions of the multiple target frames and the center point position of the target frames, the collision size of the fragment model is determined to obtain the maximum collision size.
3. The method according to claim 2, characterized in that, The step of determining the collision size of the fragment model based on the vertex positions of the multiple target frames and the center point position of the target frames, and obtaining the maximum collision size, includes: The distance between the vertex position and the center point position of each target frame is determined to obtain the interval distance between the vertex position and the center point position of each target frame; The maximum collision size is obtained by determining the maximum distance between the vertex position of each target frame and the center point position of the target frame.
4. The method according to claim 1, characterized in that, The step of adjusting the position of the center point of the target frame based on the direction vector of the distance field value, the target frame movement speed of the fragment model, and the interval time between adjacent frames to obtain the adjusted position of the fragment model includes: Displacement is determined based on the direction vector, the target frame's moving speed, and the interval between adjacent frames to obtain a displacement vector; The position of the center point of the target frame is adjusted according to the displacement vector to obtain the adjusted position.
5. The method according to claim 1, characterized in that, The method further includes: The velocity is determined based on the adjusted position, the center point position of the fragment model in the previous frame, the interval between adjacent frames, the target frame movement speed, the standardized direction vector, and the collision force of the fragment model, so as to obtain the movement speed of the fragment model in the next frame.
6. The method according to claim 5, characterized in that, The step of determining the velocity based on the adjusted position, the previous frame center point position of the fragment model, the interval between adjacent frames, the target frame movement velocity, the standardized direction vector, and the collision force of the fragment model, to obtain the next frame movement velocity of the fragment model, includes: The speed is determined based on the adjusted position, the center point position of the previous frame, the interval time between adjacent frames, and the collision force to obtain a first speed; The target frame's moving speed, the standardized direction vector, and the collision force are used to determine the speed, thereby obtaining a second speed. The first speed and the second speed are superimposed to obtain the movement speed of the next frame.
7. The method according to claim 1, characterized in that, The step of determining whether the fragment model collides with the scene surface using the maximum collision size and the distance field value includes: If the absolute value of the difference between the maximum collision size and the distance field value is less than a preset value, it is determined that the fragment model has collided with the scene surface, and the preset value is greater than 0.
8. The method according to claim 1, characterized in that, The virtual scene includes multiple scene voxels, and the steps for obtaining the multiple scene voxels include: The virtual scene is divided into voxel segments according to a preset voxel size to obtain the multiple scene voxels; or, The virtual scene is divided into voxels according to a preset number of voxels to obtain the multiple scene voxels.
9. The method according to claim 1, characterized in that, The steps for obtaining the distance field value include: The distance from the center point of the scene voxel to the scene surface in each of the multiple preset directions is determined to obtain the interval distance from the center point to the scene surface in each preset direction; the multiple preset directions cover the omnidirectional directions of the scene voxel based on the center point; The minimum distance is determined based on the interval distance from the center point to the scene surface in each preset direction, and the distance field value is obtained.
10. The method according to claim 9, characterized in that, The plurality of preset directions include the positive X-axis direction, negative X-axis direction, positive Y-axis direction, negative Y-axis direction, positive Z-axis direction, and negative Z-axis direction with the center point as the origin.
11. The method according to claim 1, characterized in that, The fragmentation model includes multiple fragment models, and the steps for obtaining the multiple fragment models include: The fragmentation model is divided into multiple fragment models according to a preset fragment size; or... The fragmentation model is divided into multiple fragment models according to a preset number of fragments.
12. A rendering device for a broken model in a virtual scene, characterized in that, The device includes: a determining unit, an acquiring unit, an adjusting unit, and a rendering unit; The determining unit is used to determine the center point and collision size of each fragment model included in the fragment model in the virtual scene based on the vertex positions of multiple target frames of the fragment model, so as to obtain the target frame center point position and maximum collision size of the fragment model; the maximum collision size is the maximum distance from the vertex to the center point of the fragment model. The acquisition unit is used to acquire the distance field value of the scene voxel to which the center point of the target frame in the virtual scene belongs; the distance field value is the minimum distance from the center point of the scene voxel to the scene surface; The adjustment unit is used to adjust the position of the center point of the target frame according to the direction vector of the distance field value, the target frame movement speed of the fragment model and the interval time between adjacent frames if it is determined that the fragment model collides with the scene surface by the maximum collision size and the distance field value, so as to obtain the adjusted position of the fragment model. The rendering unit is used to render the fragment model according to the adjusted position to obtain the rendering result of the fragment model.
13. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store computer programs and to transfer the computer programs to the processor; The processor is configured to execute the method according to any one of claims 1-11 according to instructions in the computer program.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when run on a computer device, causes the computer device to perform the method according to any one of claims 1-11.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is run on a computer device, it causes the computer device to perform the method according to any one of claims 1-11.