Model processing method and apparatus, storage medium, and electronic device
By acquiring control points on the control model, creating a bounding box model and segmenting the target plane, and determining and controlling the movement parameters of the segmented plane, the problem of low model processing efficiency in the existing technology is solved, and the effect of quickly generating deformation motion effects such as spatial collapse is achieved.
Patent Information
- Application Number
- CN202411754644.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2044-12-02
AI Technical Summary
Existing model processing methods involve complex processes and high generation difficulty in producing model deformation and motion effects such as spatial collapse, resulting in low model processing efficiency.
By acquiring multiple control points on the control model, a bounding box model is created and a target plane facing the virtual camera is determined. The target plane is segmented based on the position of the control points, the movement parameters of the segmented plane are determined, and the movement of the segmented plane is controlled to generate target deformation motion effects.
It simplifies the generation of target deformation motion effects, improves model processing efficiency, and can quickly generate effects such as infinitely looping inward collapse, reducing development difficulty and manufacturing cycle.
Smart Images

Figure CN119680188B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a model processing method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the rapid development of life and technology, people often use games for entertainment. In some games, special effects are often needed to enhance the gaming experience. For example, 3D models can be processed to generate deformation and movement effects such as ground fissures and collapses.
[0003] Research and practice of existing technologies have revealed that the process of generating model deformation and motion effects such as spatial collapse using existing model processing methods is quite complex and difficult, resulting in low model processing efficiency. Summary of the Invention
[0004] This application provides a model processing method, apparatus, storage medium, and electronic device that can generate target models with target deformation and motion effects, simplifying the generation of target deformation and motion effects and thus effectively improving model processing efficiency.
[0005] This application provides a model processing method, including:
[0006] Obtain a control model, on which multiple control points are set;
[0007] Create a bounding box model that surrounds the control model, and determine the target plane facing the virtual camera in the bounding box model;
[0008] Based on the current positions of the multiple control points, the target plane is segmented to obtain the segmentation plane corresponding to each control point in the target plane;
[0009] Determine the movement parameters required for each of the segmented planes to achieve the target deformation motion effect, wherein the movement parameters of at least two segmented planes are different;
[0010] The segmentation plane is moved according to the moving parameters to obtain a target model with target deformation motion effects.
[0011] Accordingly, embodiments of this application provide a model processing apparatus, including:
[0012] An acquisition unit is used to acquire a control model, on which multiple control points are set;
[0013] A creation unit is used to create a bounding box model that surrounds the control model, and to determine the target plane facing the virtual camera in the bounding box model.
[0014] A segmentation unit is used to segment the target plane based on the current positions of the multiple control points, so as to obtain the segmentation plane corresponding to each control point in the target plane;
[0015] A determining unit is used to determine the movement parameters required for each of the segmented planes to achieve the target deformation motion effect, wherein the movement parameters of at least two segmented planes are different;
[0016] The control unit is used to control the movement of the segmentation plane according to the movement parameters to obtain a target model with target deformation motion effects.
[0017] Furthermore, embodiments of this application also provide a computer-readable storage medium storing a computer program adapted for loading by a processor to execute steps in any of the model processing methods provided in embodiments of this application.
[0018] Furthermore, this application also provides an electronic device, including a processor and a memory, wherein the memory stores an application program, and the processor is used to run the application program in the memory to implement the model processing method provided in this application.
[0019] This application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. When the processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the electronic device to perform the steps in the model processing method provided in this application.
[0020] This application embodiment obtains a control model with multiple control points; creates a bounding box model surrounding the control model, and determines the target plane facing the virtual camera within the bounding box model; based on the current positions of the multiple control points, the target plane is segmented to obtain the segmented planes corresponding to each control point within the target plane; determines the movement parameters required for each segmented plane to achieve target deformation motion effects, wherein at least two segmented planes have different movement parameters; and controls the movement of the segmented planes according to the movement parameters to obtain a target model with target deformation motion effects. Thus, by constructing a control model and a bounding box model surrounding the control model, the target plane facing the camera within the bounding box model is segmented based on the current positions of multiple control points in the control model. Planes simulating fission effects are constructed based on each segmented plane. By controlling the movement of each segmented plane according to the movement parameters, a target model with target deformation motion effects can be obtained, realizing the generation of target deformation motion effects such as spatial collapse. This simplifies the generation difficulty of target deformation motion effects and effectively improves model processing efficiency. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.
[0022] Figure 1 This is a schematic diagram illustrating an implementation scenario of a model processing method provided in this application embodiment;
[0023] Figure 2 This is a schematic flowchart of a model processing method provided in an embodiment of this application;
[0024] Figure 3a This is a schematic diagram of the initial control model of a model processing method provided in an embodiment of this application;
[0025] Figure 3b This is a schematic diagram of the control model of a model processing method provided in an embodiment of this application;
[0026] Figure 3c This is a schematic diagram of the target plane of a model processing method provided in an embodiment of this application;
[0027] Figure 3d This is a schematic diagram of the segmentation plane of a model processing method provided in an embodiment of this application;
[0028] Figure 3e This is another schematic diagram of a segmented plane of a model processing method provided in an embodiment of this application;
[0029] Figure 4a This is a schematic diagram of the target model of a model processing method provided in an embodiment of this application;
[0030] Figure 4b This is a schematic diagram of another target model of a model processing method provided in an embodiment of this application;
[0031] Figure 5 This is a schematic diagram of the structure of the model processing device provided in the embodiments of this application;
[0032] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0034] This application provides a model processing method, apparatus, storage medium, and electronic device. The model processing apparatus can be integrated into an electronic device, which may be a server or a terminal, etc.
[0035] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN) acceleration services, and big data and artificial intelligence platforms. The terminal can include, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0036] Please see Figure 1 Taking the integration of model processing devices into electronic devices as an example, Figure 1 This is a schematic diagram illustrating an implementation scenario of the model processing method provided in this application. The electronic device can be a terminal or a server. The electronic device can acquire a control model, which has multiple control points. It can create a bounding box model surrounding the control model and determine the target plane facing the virtual camera within the bounding box model. Based on the current positions of the multiple control points, it can segment the target plane to obtain the segmented planes corresponding to each control point in the target plane. It can determine the movement parameters required for each segmented plane to achieve the target deformation motion effect, wherein at least two segmented planes have different movement parameters. It can control the movement of the segmented planes according to the movement parameters to obtain a target model with the target deformation motion effect.
[0037] It should be noted that, Figure 1 The illustrated scenario of the model processing method is merely an example. The implementation environment of the model processing method described in this application is intended to more clearly illustrate the technical solutions of this application and does not constitute a limitation on the technical solutions provided in this application. Those skilled in the art will recognize that, with the evolution of data processing and the emergence of new business scenarios, the technical solutions provided in this application are equally applicable to similar technical problems.
[0038] The solutions provided in this application are specifically illustrated through the following embodiments. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.
[0039] This embodiment will be described from the perspective of a model processing device, which can be integrated into an electronic device, which can be a terminal and / or a server, and this application does not impose any limitations on it.
[0040] Please see Figure 2 , Figure 2 This is a flowchart illustrating the model processing method provided in an embodiment of this application. The model processing method includes:
[0041] In step 101, the control model is obtained.
[0042] The control model has multiple control points.
[0043] The control model can be a model used to construct the deformation effect, which may include a splitting effect. The control point can be a point set in the control model.
[0044] Optionally, the control point can be a point in the control model where motion occurs.
[0045] There are several ways to obtain the control model. For example, an initial control model can be constructed, which includes multiple line segments that share a common starting endpoint. On each line segment in the initial control model, multiple control points are randomly generated to obtain the control model. The control points are configured to move cyclically along their respective line segments toward the starting endpoint.
[0046] The initial control model can be a model used to construct the region where deformation occurs. This initial control model can include multiple line segments, each of which can be of equal length. The number of line segments included in the initial control module can be set according to actual needs; for example, it can include 3, 7, or 9 line segments. The starting endpoint can be the endpoint that serves as the starting point of a line segment.
[0047] For example, please refer to Figure 3a , Figure 3aThis is a schematic diagram of the initial control model of a model processing method provided in this application embodiment. The initial control model may include seven line segments, all of which share the same starting endpoint as the center of the initial control model. Specifically, a line segment of arbitrary length can be created, and the created line segment can be copied 6 times. Each time it is copied, it can be cyclically moved 360° / 7 = 51.4286° around the starting endpoint, so that the copied line segments are distributed around the starting endpoint to form a circle, thereby obtaining an initial control model including multiple line segments sharing a common starting endpoint.
[0048] The number of control points randomly generated on each line segment can be the same or different, and the number of control points generated can also be set according to actual needs. This application embodiment does not limit this.
[0049] For example, please refer to Figure 3b , Figure 3b This is a schematic diagram of a control model for a model processing method provided in an embodiment of this application. Multiple control points can be randomly generated on each line segment of the initial control model. The number of randomly generated control points on each line segment can be the same or different. Each control point can be configured with a corresponding point number, and each point number is used to identify a control point.
[0050] Optionally, control points in the control model can be configured to move cyclically along their respective line segments toward the starting endpoint to achieve an infinitely looping, inwardly collapsing deformation effect in subsequent operations. For example, each control point can be configured to move from its initial position along its line segment toward the starting endpoint. Upon reaching the starting endpoint, the control point returns to the ending endpoint of the line segment, and from there continues to move along the line segment toward the starting endpoint until it reaches the starting endpoint again. Then, the control point returns to the ending endpoint of the line segment and continues moving along the line segment toward the starting endpoint, thus achieving cyclic movement of the control points along the line segment.
[0051] In one embodiment, there are several ways to configure the control point to move cyclically along the line segment toward the starting endpoint. For example, a third distance from the control point to the starting endpoint of the line segment can be obtained; the motion control parameters of the control point at the current moment can be determined based on the third distance, and the motion control parameters can be cyclically changed over time within the range of 0 to a target value; the target distance from the control point to the starting endpoint of the line segment at the current moment can be determined based on the motion control parameters; and the control point can be controlled to move cyclically based on the target distance.
[0052] The third distance can be the distance between the control point and the starting endpoint at the current moment. The motion control parameter can be a parameter that cycles through time from 0 to a target value, used to control the control point to move cyclically along the line segment. The target value can be a value indicating the maximum range of cyclic movement of the control point along the line segment; for example, it can be the distance between the starting and ending endpoints of the line segment, i.e., the length of the line segment. Thus, 0 can indicate the location of the starting endpoint, and the target value can indicate the location of the ending endpoint. Optionally, the line segment length can be normalized, i.e., the target value can be 1. Thus, 0 can indicate the location of the starting endpoint, and 1 can indicate the location of the ending endpoint. The target distance can be the distance between the position the control point should reach at the next moment and the starting endpoint.
[0053] There are several ways to determine the motion control parameters of the control point at the current moment based on the third distance. For example, the line segment length and motion control function can be obtained, and the third distance can be divided by the line segment length to obtain the position ratio value corresponding to the control point. Then, the motion control parameters of the control point at the current moment can be determined based on the position ratio value and the time function through the motion control function.
[0054] The motion control function can be a function that generates a value that cycles over time from 0 to a target value based on the current position of the control point.
[0055] For example, the length of a line segment can be mapped to a range of 0-1, where 0 represents the position of the starting endpoint and 1 represents the position of the ending endpoint. Taking a target value of 1 as an example, all control points can be traversed. For each control point, the current position of control point P can be obtained, allowing the query of the distance between control point P and the starting endpoint of the line segment (the third distance). Dividing the third distance by the line segment length yields the position ratio value t. This position ratio value t indicates the proportion of the control point's current position relative to the line segment length. For example, assuming the line segment length is 2 meters and the control point is 1 meter from the starting endpoint, the third distance is 1 meter, and the position ratio value t is 0.5. Then, the motion control function can be used to determine the motion control parameters T corresponding to the control point at the current moment based on the position ratio value t. This motion control function can be expressed as:
[0056] T = frac(t - (time * 0.25))
[0057] Here, `frac()` represents a function to extract the decimal part of a real number, `time` can represent a time function used to obtain the current time, `t` can represent the positional ratio corresponding to the third distance, and `T` can represent the motion control parameter. Based on the third distance, a value that cycles between 0 and 1 can be obtained, which is the motion control parameter. Therefore, based on the motion control parameter and the line segment length, the target distance from the control point to the starting endpoint of the line segment at the current moment can be calculated. For example, assuming the motion control parameter is 0.4 and the line segment length is 2 meters, the target distance can be 2 × 0.4 = 0.8, meaning that at the next moment, the distance from the control point to the starting endpoint will be 0.8 meters. This target distance value can then be assigned to the current control point to control its movement.
[0058] In one specific embodiment, for each control point, the current control point position P can be obtained, the starting endpoint position is P0, and the ending endpoint of the line segment is P1. Let P1 – P0, we can obtain a vector P0P1 pointing from P0 to P1, which has both magnitude and direction. Let P – P0, we can obtain a vector P0P pointing from P0 to the current control point P. The projection length of vector P0P onto vector P0P1 is calculated, and then the projection length is divided by the magnitude of vector P0P1, i.e., the line segment length, thereby normalizing the projection length and obtaining the position ratio value t. When t=1, it means the control point is at the end point P1 of the line segment. When t=0, it means the control point is at the beginning point P0 of the line segment. Then, through the motion control function T=frac(t-(time*0.25)), the motion control parameters corresponding to the control point are obtained in a loop between 0 and 1. Based on the line segment length and the motion control parameters, the target distance between the current position of the control point and the beginning point of the line segment can be calculated, so that the control point can move to the position at the target distance from the beginning point.
[0059] In step 102, a bounding box model of the bounding control model is created, and the target plane facing the virtual camera in the bounding box model is determined.
[0060] The bounding box model can be a model that encloses the control model. The bounding box model's material can be configured based on the desired effect, making it visible and possessing a specific material. For example, when achieving a ground collapse deformation effect, the bounding box model's material can be set to the ground model's material; similarly, when achieving a collapse effect on any plane, the bounding box model's material can be set according to actual needs. The virtual camera can be a virtual camera within the virtual scene where the control model resides, and the target plane can be the plane within the bounding box model facing the virtual camera.
[0061] Optionally, after determining the target plane, the target plane can be extracted, and other planes in the bounding box model can be deleted, leaving only the planar model of the target plane.
[0062] For example, please refer to Figure 3c , Figure 3c This is a schematic diagram of the target plane of a model processing method provided in an embodiment of this application, which can extract the target plane facing the virtual camera.
[0063] There are several ways to determine the target plane facing the virtual camera in the bounding box model. For example, the normal vector of each plane in the bounding box model and the camera direction vector of the virtual camera can be obtained. Based on the normal vector and the camera direction vector, the angle information between the normal direction of the plane and the camera direction of the virtual camera can be calculated. Based on the angle information, the target plane facing the virtual camera can be determined in the plane.
[0064] Here, the normal vector can be the vector of the normal of each plane in the bounding box model, the camera direction vector can be the vector of the camera direction of the virtual camera, and the included angle information can be the information indicating the angle between the normal of the plane and the camera direction. Thus, based on the included angle information, the target plane facing the virtual camera can be determined among multiple planes of the bounding box.
[0065] There are several ways to calculate the angle between the normal direction of the plane and the camera direction of the virtual camera based on the normal vector and the camera direction vector. For example, the dot product of the normal vector and the camera direction vector can be calculated to obtain the cosine value of the angle between the normal direction of the plane and the camera direction of the virtual camera, which is the angle between the normal direction of the plane and the camera direction of the virtual camera.
[0066] In step 103, the target plane is segmented based on the current positions of multiple control points to obtain the segmentation plane corresponding to each control point in the target plane.
[0067] The segmentation plane can be multiple planes obtained by dividing the target plane. Based on these multiple segmentation planes within the target plane, regions with a splitting effect can be simulated. This allows for the creation of target deformation and motion effects, such as ground fissures and collapses, spatial collapse, and object explosions.
[0068] There are several ways to segment the target plane based on the current positions of multiple control points to obtain the segmented plane corresponding to each control point in the target plane. For example, the segmentation indication information corresponding to the target plane can be calculated based on the current positions of multiple control points; the target plane can then be segmented based on the segmentation indication information to obtain the segmented plane corresponding to each control point in the target plane.
[0069] The segmentation indication information can be information indicating how to segment the target plane based on each control point, and can indicate the area corresponding to each control point in the target plane.
[0070] There are several ways to calculate the segmentation indication information corresponding to the target plane based on the current positions of multiple control points. For example, based on the current positions of multiple control points, the first distance between each position point in the target plane and each control point can be calculated; the target position point corresponding to each control point can be determined according to the first distance; and the segmentation indication information corresponding to the target plane can be generated based on the target position point corresponding to each control point. The segmentation indication information indicates the area corresponding to each control point in the target plane.
[0071] The first distance can be the distance between each position point and each control point in the target plane. Each position point can be a point in the target plane, and this first distance can be calculated by obtaining the world coordinates of each control point and the world coordinates of each position point in the target plane. The target position point corresponding to each control point can be the position point assigned to the segmentation plane corresponding to the control point when the target plane is segmented.
[0072] Optionally, the distance between the target location point corresponding to each control point and its corresponding control point is less than the distance between the target location point and other control points.
[0073] In one embodiment, the segmentation indication information can be Voronoi noise, also known as cellular noise, etc. For example, each control point can be used as a seed point to divide the position points in the space corresponding to the target plane, thus obtaining Voronoi noise. This Voronoi noise can indicate the target position points in the segmented planes corresponding to each control point among the position points in the target plane. Optionally, the Voronoi noise can be a noise map, in which cell regions corresponding to each control point are distributed, and the target position points corresponding to each control point are located in the cell regions corresponding to the corresponding control points. Therefore, based on Voronoi noise, the target plane can be divided into multiple cell regions, each cell region being a segmentation plane, and each segmentation plane corresponding to a control point. The distance between any position point in each segmentation plane and its corresponding control point is less than the distance between any other control point. In this way, a target plane simulating a segmentation effect can be obtained.
[0074] For example, please refer to Figure 3d , Figure 3d This is a schematic diagram of a segmentation plane for a model processing method provided in an embodiment of this application. Based on segmentation indication information, a target plane can be segmented into multiple segmentation planes to obtain a target plane that simulates a splitting effect. For clarity of description, in... Figure 3dIn the diagram, each segmented plane can display the corresponding control point number.
[0075] Optionally, since the control points cyclically move within the control model, the current positions of multiple control points in the model can be acquired in real time. Based on these positions, the target plane can be dynamically segmented to obtain the segmentation plane corresponding to each control point within the target plane. Therefore, the segmentation plane corresponding to the target plane is dynamically changing, which can be used to achieve dynamic splitting and cyclic collapse target deformation motion effects. For example, please refer to... Figure 3e , Figure 3e This is another schematic diagram of the segmented plane of a model processing method provided in an embodiment of this application. Since the control points are constantly cyclically moving, the positions of the control points acquired at different times are dynamically changing. Figure 3d The dividing plane shown is Figure 3e The shown segmentation planes are different. Therefore, based on the positions of dynamically changing control points, the target plane can be segmented to obtain dynamically changing segmentation planes in the target plane.
[0076] In step 104, the movement parameters required for each segmented plane to achieve the target deformation motion effect are determined.
[0077] At least two of the segmented planes have different movement parameters. The target deformation motion effect can be an effect used to simulate the deformation motion of an object, such as ground fissures, spatial collapse, or object explosion. The movement parameters can be parameters used to control the segmented planes, determined based on the target deformation motion effect to be achieved.
[0078] There are several ways to determine the movement parameters required for each segmented plane to achieve the target deformation motion effect. For example, the movement parameters may include the movement direction and the movement distance. A second distance between the center position of each segmented plane and the target plane can be calculated. Based on the second distance, the movement distance required for each segmented plane to achieve the target deformation motion effect can be determined, and the movement direction matching the target deformation motion effect of each segmented plane can be obtained.
[0079] The movement direction can be the direction in which the segmented plane moves, and the movement distance can be the distance the segmented plane moves. The second distance can be the distance between the center position of each segmented plane and the target plane. This second distance can be calculated by obtaining the world coordinates of the center position of the target plane and the world coordinates of the center positions of the segmented planes, or by obtaining the world coordinates of the starting endpoint in the control model and the world coordinates of the control points corresponding to the segmented planes.
[0080] There are several ways to determine the required movement distance for each segmented plane to achieve the target deformation motion effect based on the second distance, and to obtain the movement direction of each segmented plane matching the target deformation motion effect. For example, the second distance can be used as the required movement distance for each segmented plane to achieve the target deformation motion effect, and the movement direction of each segmented plane matching the target deformation motion effect can be obtained. For example, if the target deformation motion effect is an inward cyclic collapse effect, the movement direction can be upward. The closer the segmented plane is to the center of the target plane, the smaller the movement distance, and the farther the segmented plane is from the center of the target plane, the larger the movement distance. Thus, by controlling the dynamically changing segmented planes to move the corresponding movement distance in the upward direction, the target deformation motion effect of the object collapsing inward can be achieved. For example, if the target deformation motion effect is an outward explosion effect, the direction of movement can be diagonally upward. The movement direction corresponding to each segmented plane can be offset. The segmented plane that is closer to the center of the target plane moves closer to the top, while the segmented plane that is farther from the center of the target plane moves further away from the top. Also, the segmented plane that is closer to the center of the target plane moves a greater distance, while the segmented plane that is farther from the center of the target plane moves a smaller distance. Thus, by controlling the dynamically changing segmented planes to move a corresponding distance in the upward direction, the target deformation motion effect of the object exploding outward can be achieved.
[0081] In step 105, the segmentation plane is moved according to the movement parameters to obtain a target model with target deformation motion effects.
[0082] The target model can be a model with target deformation motion effects. In the target model, there are multiple segmentation planes that move according to corresponding movement parameters, thereby simulating the target deformation motion effects of an object splitting into multiple segments and moving.
[0083] There are several ways to control the movement of the segmentation plane according to the movement parameters to obtain a target model with target deformation motion effects. For example, the movement parameters can be used to control the movement distance of each segmentation plane along the movement direction to obtain a target model with target deformation motion effects.
[0084] There are several ways to control the movement distance of each segmented plane along the movement direction according to the movement parameters to obtain a target model with target deformation motion effects. For example, according to the movement parameters, the movement distance can be used as the extrusion height to perform extrusion operation on each segmented plane in the movement direction to obtain a target model with target deformation motion effects.
[0085] The extrusion operation can be described as extending a plane along the normal direction to create a three-dimensional model with thickness. The extrusion height can be the height at which the segmented planes are extruded. For example, taking the target deformation motion effect as an inward circular collapse effect, the extrusion operation can be performed on each segmented plane in the upward direction according to the movement parameters and the movement distance as the extrusion height. Based on the segmented planes with different extrusion heights and three-dimensional effects, a target model with the target deformation motion effect can be obtained.
[0086] Optionally, there are several other ways to control the movement of each segmentation plane along the movement direction by a distance according to the movement parameters to obtain a target model with target deformation motion effects. For example, for each segmentation plane, the segmentation plane can be copied to obtain a copy plane; according to the movement parameters, based on the initial position of the segmentation plane, the copy plane can be moved along the movement direction by the distance; and the corresponding vertices on the copy plane and the segmentation plane can be connected to form a facade connecting the copy plane and the segmentation plane to obtain a target model with target deformation motion effects.
[0087] Here, the copied plane can be a plane obtained by copying the segmented plane, the initial position can be the location of the segmented plane, and the elevation can be the plane connecting the copied plane and the segmented plane, thus obtaining a 3D model corresponding to the segmented plane to more realistically simulate the deformation and motion effects of the target. Since the vertices on the copied plane have the same index as the corresponding vertices on the segmented plane, before rendering, it can be declared that the corresponding vertices on the copied plane and the segmented plane are in the same plane, thus rendering the elevation connecting the copied plane and the segmented plane.
[0088] In one embodiment, taking the target deformation motion effect as an inward circular collapse effect as an example, please refer to... Figure 4a , Figure 4a This is a schematic diagram of the target model of a model processing method provided in this application embodiment. After dividing the target plane into multiple segmented planes, the moving distance can be used as the extrusion height, or the moving distance can be normalized and the normalized moving distance can be used as the extrusion height. Thus, the extrusion operation is performed on each segmented plane in the upward direction. Since the moving distances corresponding to the segmented planes with different distances from the center of the target plane are also different, based on the extrusion height and three-dimensional effect corresponding to each segmented plane, the inward circular collapse effect can be simulated more realistically and accurately, thereby obtaining a target model with target deformation motion effect and better effect.
[0089] Furthermore, since the control points in the control model undergo cyclical motion, the segmented plane obtained by dividing the target plane based on the moving control points also changes in real time. Therefore, the process of moving the segmented plane according to the movement parameters also changes dynamically. For example, please refer to... Figure 4b , Figure 4b This is a schematic diagram of another target model of a model processing method provided in an embodiment of this application. As can be seen, Figure 4a and Figure 4b The target models shown have distinct target deformation motion effects. Based on the control points of the cyclic motion in the control model, dynamically changing target deformation motion effects can be generated, simplifying the generation of target deformation motion effects and thus effectively improving the model processing efficiency.
[0090] In game development projects, it is often necessary to create special effects to enhance the game experience. For example, this involves processing 3D models to generate deformation and motion effects such as ground fissures and collapses. However, existing model processing methods for generating these effects are complex and difficult, resulting in low processing efficiency. Therefore, this application proposes a model processing method that can programmatically and quickly generate effects such as infinitely looping inward collapses. This allows for rapid fulfillment of such effect requirements, significantly reducing the development difficulty and production cycle of these effects.
[0091] As described above, this embodiment of the application obtains a control model with multiple control points; creates a bounding box model surrounding the control model; determines the target plane facing the virtual camera within the bounding box model; segments the target plane based on the current positions of the multiple control points, obtaining the segmented planes corresponding to each control point within the target plane; determines the movement parameters required for each segmented plane to achieve target deformation motion effects, wherein at least two segmented planes have different movement parameters; and controls the movement of the segmented planes according to the movement parameters to obtain a target model with target deformation motion effects. Thus, by constructing a control model and a bounding box model surrounding the control model, the target plane facing the camera within the bounding box model is segmented based on the current positions of multiple control points in the control model. A plane simulating a fission effect is constructed based on each segmented plane. By controlling the movement of each segmented plane according to the movement parameters, a target model with target deformation motion effects can be obtained, realizing the generation of target deformation motion effects such as spatial collapse. This simplifies the generation difficulty of target deformation motion effects and effectively improves model processing efficiency.
[0092] To better implement the above methods, embodiments of the present invention also provide a model processing device, which can be integrated into an electronic device, such as a terminal or a server.
[0093] For example, such as Figure 5 The diagram shown is a schematic representation of the model processing apparatus provided in an embodiment of this application. The model processing apparatus may include an acquisition unit 201, a creation unit 202, a segmentation unit 203, a determination unit 204, and a control unit 205, as follows:
[0094] Acquisition unit 201 is used to acquire the control model, which has multiple control points set on it;
[0095] Create unit 202 to create a bounding box model of the bounding control model and determine the target plane facing the virtual camera in the bounding box model;
[0096] The segmentation unit 203 is used to segment the target plane based on the current positions of multiple control points to obtain the segmentation plane corresponding to each control point in the target plane;
[0097] The determining unit 204 is used to determine the movement parameters required for each segmented plane to achieve the target deformation motion effect, wherein the movement parameters of at least two segmented planes are different;
[0098] The control unit 205 is used to control the movement of the segmentation plane according to the movement parameters to obtain a target model with target deformation motion effects.
[0099] In some embodiments, the segmentation unit 203 includes:
[0100] The calculation subunit is used to calculate the segmentation indication information corresponding to the target plane based on the current positions of multiple control points;
[0101] The segmentation sub-unit is used to segment the target plane based on the segmentation indication information to obtain the segmentation plane corresponding to each control point in the target plane.
[0102] In some embodiments, the computing subunit is configured to:
[0103] Based on the current positions of multiple control points, calculate the first distance between each location point and each control point in the target plane;
[0104] The target location points corresponding to each control point are determined based on the first distance. The target location points corresponding to each control point are the location points that are assigned to the segmentation plane corresponding to the control point when the target plane is segmented.
[0105] Based on the target location points corresponding to each control point, segmentation indication information is generated for the target plane. The segmentation indication information indicates the area corresponding to each control point in the target plane.
[0106] In some embodiments, the movement parameters include the movement direction and the movement distance. The determining unit 204 is configured to:
[0107] Calculate the second distance between the center position of each segmentation plane and the target plane;
[0108] The second distance determines the movement distance required for each segmented plane to achieve the target deformation motion effect, and obtains the movement direction of each segmented plane to match the target deformation motion effect.
[0109] In some embodiments, the control unit 205 includes:
[0110] The control subunit is used to control each segmented plane to move a distance along the moving direction according to the moving parameters, so as to obtain a target model with target deformation motion effects.
[0111] In some embodiments, the control subunit is configured to:
[0112] Based on the movement parameters, and with the movement distance as the extrusion height, the extrusion operation is performed on each segmented plane in the movement direction to obtain a target model with target deformation motion effects.
[0113] In some embodiments, the control subunit is configured to:
[0114] For each segmentation plane, the segmentation plane is copied to obtain a copied plane;
[0115] Based on the movement parameters and the initial position of the segmentation plane, the copy plane is moved a distance along the movement direction.
[0116] Connect the corresponding vertices on the copy plane and the segmentation plane to form a facade connecting the copy plane and the segmentation plane, thus obtaining a target model with target deformation motion effects.
[0117] In some embodiments, the acquisition unit 201 is configured to:
[0118] Construct an initial control model, which includes multiple line segments sharing a common starting endpoint;
[0119] In each line segment of the initial control model, multiple control points are randomly generated to obtain the control model, wherein the control points are configured to cyclically move along the line segment they belong to toward the starting endpoint.
[0120] In some embodiments, the model processing apparatus further includes a motion control unit for:
[0121] Obtain the third distance from the control point to the starting endpoint of the line segment it belongs to;
[0122] The motion control parameters of the control point at the current moment are determined based on the third distance, and the motion control parameters change cyclically within the range of 0 to the target value over time.
[0123] Based on motion control parameters, determine the target distance from the control point to the starting endpoint of the line segment at the current moment;
[0124] The control point is controlled to perform cyclical motion based on the target distance.
[0125] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0126] As can be seen from the above, in this embodiment of the application, the control model is obtained by the acquisition unit 201, and multiple control points are set on the control model; the creation unit 202 creates a bounding box model that surrounds the control model and determines the target plane facing the virtual camera in the bounding box model; the segmentation unit 203 segments the target plane based on the current position of multiple control points to obtain the segmentation plane corresponding to each control point in the target plane; the determination unit 204 determines the movement parameters required for each segmentation plane to achieve the target deformation motion effect, wherein at least two segmentation planes have different movement parameters; the control unit 205 controls the segmentation plane to move according to the movement parameters to obtain a target model with target deformation motion effect. Therefore, by constructing a control model and a bounding box model that encloses the control model, the target plane facing the camera in the bounding box model is segmented based on the current position of multiple control points in the control model. Based on each segmented plane, a plane simulating the fission effect is constructed. By controlling the movement of each segmented plane according to the movement parameters, a target model with target deformation motion effects can be obtained, realizing the generation of target deformation motion effects such as spatial collapse. This simplifies the generation difficulty of target deformation motion effects and effectively improves the model processing efficiency.
[0127] This application also provides an electronic device, such as... Figure 6 The diagram shows a structural schematic of an electronic device involved in an embodiment of this application. This electronic device can be a terminal or a server. Specifically:
[0128] The electronic device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figures does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0129] The processor 301 is the control center of the electronic device 300. It connects various parts of the electronic device 300 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, it performs various functions of the electronic device 300 and processes data, thereby monitoring the electronic device 300 as a whole.
[0130] In this embodiment, the processor 301 in the electronic device 300 loads the instructions corresponding to the processes of one or more applications into the memory 302 according to the following steps, and the processor 301 runs the applications stored in the memory 302 to realize various functions:
[0131] Obtain the control model, which has multiple control points set on it;
[0132] Create a bounding box model of the bounding control model, and determine the target plane facing the virtual camera in the bounding box model;
[0133] Based on the current positions of multiple control points, the target plane is segmented to obtain the segmentation plane corresponding to each control point in the target plane;
[0134] Determine the translation parameters required for each segmented plane to achieve the target deformation motion effect, wherein the translation parameters of at least two segmented planes are different;
[0135] By controlling the movement of the segmentation plane according to the movement parameters, a target model with target deformation motion effects is obtained.
[0136] This solution involves acquiring a control model with multiple control points; creating a bounding box model that encloses the control model; determining the target plane facing the virtual camera within the bounding box model; segmenting the target plane based on the current positions of the multiple control points to obtain the segmented planes corresponding to each control point within the target plane; determining the movement parameters required for each segmented plane to achieve target deformation motion effects, where at least two segmented planes have different movement parameters; and controlling the movement of the segmented planes according to the movement parameters to obtain a target model with target deformation motion effects. In this way, by constructing a control model and a bounding box model that encloses the control model, the target plane facing the camera within the bounding box model is segmented based on the current positions of multiple control points in the control model. Planes simulating fission effects are constructed based on these segmented planes. By controlling the movement of each segmented plane according to the movement parameters, a target model with target deformation motion effects can be obtained, enabling the generation of target deformation motion effects such as spatial collapse. This simplifies the generation of target deformation motion effects and effectively improves model processing efficiency.
[0137] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0138] Optional, such as Figure 6 As shown, the electronic device 300 also includes: a touch display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0139] The touch display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 301. It can also receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 303 can also be used as part of the input unit 306 to achieve input functions.
[0140] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0141] Audio circuitry 305 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and then processed by processor 301 before being transmitted via radio frequency circuitry 304 to, for example, another electronic device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.
[0142] The input unit 306 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0143] Power supply 307 is used to supply power to various components of electronic device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0144] although Figure 6 As not shown in the diagram, the electronic device 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0145] In the above embodiments, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be found in the relevant descriptions of other embodiments. It should be noted that the electronic device provided in this application's embodiments and the applicable model processing method in the above embodiments belong to the same concept, and its specific implementation process is detailed in the above method embodiments, and will not be repeated here.
[0146] As can be seen from the above, the electronic device provided in this application embodiment can obtain a control model, on which multiple control points are set; create a bounding box model surrounding the control model, and determine the target plane facing the virtual camera in the bounding box model; based on the current positions of multiple control points, segment the target plane to obtain the segmented planes corresponding to each control point in the target plane; determine the movement parameters required for each segmented plane to achieve the target deformation motion effect, wherein the movement parameters of at least two segmented planes are different; control the movement of the segmented planes according to the movement parameters to obtain a target model with target deformation motion effect. Thus, by constructing a control model and a bounding box model surrounding the control model, the target plane facing the camera in the bounding box model is segmented based on the current positions of multiple control points in the control model, and a plane simulating a fission effect is constructed based on each segmented plane. By controlling the movement of each segmented plane according to the movement parameters, a target model with target deformation motion effect can be obtained, realizing the generation of target deformation motion effects such as spatial collapse, simplifying the generation difficulty of target deformation motion effects, and thus effectively improving model processing efficiency.
[0147] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by a computer program, or by a computer program controlling related hardware. The computer program can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0148] Therefore, embodiments of this application provide a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps in any of the model processing methods provided in embodiments of this application. For example, the computer program can execute the following steps:
[0149] Obtain the control model, which has multiple control points set on it;
[0150] Create a bounding box model of the bounding control model, and determine the target plane facing the virtual camera in the bounding box model;
[0151] Based on the current positions of multiple control points, the target plane is segmented to obtain the segmentation plane corresponding to each control point in the target plane;
[0152] Determine the translation parameters required for each segmented plane to achieve the target deformation motion effect, wherein the translation parameters of at least two segmented planes are different;
[0153] By controlling the movement of the segmentation plane according to the movement parameters, a target model with target deformation motion effects is obtained.
[0154] This solution involves acquiring a control model with multiple control points; creating a bounding box model that encloses the control model; determining the target plane facing the virtual camera within the bounding box model; segmenting the target plane based on the current positions of the multiple control points to obtain the segmented planes corresponding to each control point within the target plane; determining the movement parameters required for each segmented plane to achieve target deformation motion effects, where at least two segmented planes have different movement parameters; and controlling the movement of the segmented planes according to the movement parameters to obtain a target model with target deformation motion effects. In this way, by constructing a control model and a bounding box model that encloses the control model, the target plane facing the camera within the bounding box model is segmented based on the current positions of multiple control points in the control model. Planes simulating fission effects are constructed based on these segmented planes. By controlling the movement of each segmented plane according to the movement parameters, a target model with target deformation motion effects can be obtained, enabling the generation of target deformation motion effects such as spatial collapse. This simplifies the generation of target deformation motion effects and effectively improves model processing efficiency.
[0155] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0156] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0157] Since the computer program stored in the computer-readable storage medium can execute the steps in any of the model processing methods provided in the embodiments of this application, the beneficial effects that any of the model processing methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0158] According to one aspect of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.
[0159] The foregoing has provided a detailed description of a model processing method, apparatus, storage medium, and electronic device provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A model processing method, characterized in that, include: Obtain a control model, on which multiple control points are set; Create a bounding box model that surrounds the control model, and determine the target plane facing the virtual camera in the bounding box model; Based on the current positions of the multiple control points, the target plane is segmented to obtain the segmentation plane corresponding to each control point in the target plane; Determine the movement parameters required for each of the segmented planes to achieve the target deformation motion effect, wherein the movement parameters of at least two segmented planes are different; The segmentation plane is moved according to the moving parameters to obtain a target model with target deformation motion effects.
2. The model processing method as described in claim 1, characterized in that, The step of segmenting the target plane based on the current positions of the multiple control points to obtain the segmented plane corresponding to each control point in the target plane includes: Based on the current positions of the multiple control points, calculate the segmentation indication information corresponding to the target plane; The target plane is segmented based on the segmentation indication information to obtain the segmentation plane corresponding to each control point in the target plane.
3. The model processing method as described in claim 2, characterized in that, The step of calculating the segmentation indication information corresponding to the target plane based on the current positions of the multiple control points includes: Based on the current positions of the multiple control points, calculate the first distance between each position point in the target plane and each of the control points; The target position point corresponding to each control point is determined based on the first distance. The target position point corresponding to each control point is the position point that is assigned to the segmentation plane corresponding to the control point when the target plane is segmented. Based on the target location points corresponding to each of the control points, segmentation indication information is generated for the target plane, and the segmentation indication information indicates the area corresponding to each of the control points in the target plane.
4. The model processing method as described in claim 1, characterized in that, The movement parameters include the movement direction and the movement distance. Determining the movement parameters required for each segmented plane to achieve the target deformation motion effect includes: Calculate the second distance between the center position of each of the segmentation planes and the target plane; Based on the second distance, determine the movement distance required for each of the segmented planes to achieve the target deformation motion effect, and obtain the movement direction of each of the segmented planes that matches the target deformation motion effect.
5. The model processing method as described in claim 4, characterized in that, The step of controlling the segmentation plane to move according to the movement parameters to obtain a target model with target deformation motion effects includes: According to the movement parameters, each of the segmentation planes is controlled to move by the movement distance along the movement direction to obtain a target model with target deformation motion effects.
6. The model processing method as described in claim 5, characterized in that, The step of controlling each of the segmented planes to move by the moving distance along the moving direction according to the moving parameters to obtain a target model with target deformation motion effects includes: According to the movement parameters, with the movement distance as the extrusion height, each of the segmented planes is extruded in the movement direction to obtain a target model with target deformation motion effects.
7. The model processing method as described in claim 5, characterized in that, The step of controlling each of the segmented planes to move by the moving distance along the moving direction according to the moving parameters to obtain a target model with target deformation motion effects includes: For each of the aforementioned segmentation planes, the segmentation plane is copied to obtain a copied plane; According to the movement parameters, based on the initial position of the segmentation plane, the copying plane is moved by the movement distance along the movement direction; Connect the corresponding vertices on the copy plane and the segmentation plane to form a facade connecting the copy plane and the segmentation plane, thus obtaining a target model with target deformation motion effects.
8. The model processing method according to any one of claims 1 to 7, characterized in that, The acquisition of the control model includes: Construct an initial control model, which includes multiple line segments sharing a common starting endpoint; In each line segment of the initial control model, multiple control points are randomly generated to obtain a control model, wherein the control points are configured to cyclically move along their respective line segments toward the starting endpoint.
9. The model processing method as described in claim 8, characterized in that, Before segmenting the target plane based on the current positions of the multiple control points, the method further includes: Obtain the third distance from the control point to the starting endpoint of the line segment; Based on the third distance, the motion control parameters of the control point at the current moment are determined, and the motion control parameters change cyclically within the range of 0 to the target value over time. Based on the motion control parameters, determine the target distance from the control point to the starting endpoint of the line segment at the current moment; The control point is controlled to perform the cyclical motion based on the target distance.
10. A model processing device, characterized in that, include: An acquisition unit is used to acquire a control model, on which multiple control points are set; A creation unit is used to create a bounding box model that surrounds the control model, and to determine the target plane facing the virtual camera in the bounding box model. A segmentation unit is used to segment the target plane based on the current positions of the multiple control points, so as to obtain the segmentation plane corresponding to each control point in the target plane; A determining unit is used to determine the movement parameters required for each of the segmented planes to achieve the target deformation motion effect, wherein the movement parameters of at least two segmented planes are different; The control unit is used to control the movement of the segmentation plane according to the movement parameters to obtain a target model with target deformation motion effects.
11. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of any one of the methods described in claims 1 to 9.
12. A computer-readable storage medium, characterized in that, It includes a computer program that, when run on an electronic device, causes the electronic device to perform the steps of any of the methods described in claims 1 to 9.
Citation Information
Patent Citations
Bounding box and space partitioning-based virtual object collision detection method
CN105469406A
Virtual terrain generation method and system, storage medium and electronic equipment
CN115512057A