Collision effect implementation method and device, equipment and storage medium
By acquiring and moving the edge points inside the collision model, real-time simulation of polygon collision deformation in Maya is achieved, solving the problems of cumbersome parameter setting and large calculations in the existing technology, and improving the simulation efficiency.
Patent Information
- Application Number
- CN202411224675.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-17
AI Technical Summary
The prior art has cumbersome parameters when simulating polygon collision deformation, which cannot achieve real-time preview and large calculations, resulting in a long simulation time and the real-time nature of polygon collision deformation cannot be achieved.
By obtaining the first target edge point interspersed inside the collision model, and determining the second target edge point based on the distance between the point and other edge points, moving the first target edge point to the second target edge point, forming a collision effect, real-time Computational and convenient polygon collision deformation simulation.
Real-time simulation of polygon collision deformation in Maya is realized, parameter setting is simplified, calculation is reduced, simulation efficiency is improved, and the problems of difficulty and time-consuming in the aforementioned technology are solved.
Smart Images

Figure CN119152158A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rendering technology, and in particular to a method for realizing a collision effect, a device for realizing a collision effect, a corresponding electronic device, and a corresponding computer-readable storage medium. Background Art
[0002] In scenes that need to simulate real-world physical interactions and deformation effects, there is a need to simulate polygon collision deformation in Maya (a 3D computer graphics software). For example, when a virtual character steps on the snow, it is necessary to simulate the real collision between objects to produce a concave effect.
[0003] Among the technologies related to simulating polygonal collision deformation, it can be mainly achieved through nCloth (an advanced cloth simulation tool) dynamic solution, which can be specifically manifested as continuously adjusting dynamic properties such as elasticity, mass, friction, etc. for testing to solve the collision deformation effect. However, the aforementioned method has problems such as many parameter setting steps, inability to preview the simulation effect in real time, and long simulation time due to large amount of calculation, and cannot achieve real-time simulation of polygonal collision deformation. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a collision effect implementation method, a collision effect implementation device, a corresponding electronic device and a corresponding computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0005] The embodiment of the present invention discloses a method for realizing a collision effect, which involves a collision model and a collided model, wherein the model surface of the collided model has a plurality of first edge points, and the model surface of the collision model has a plurality of second edge points. The method comprises:
[0006] Acquire a first target edge point interspersed within the collision model;
[0007] Determine, based on the distance between the first target edge point and the plurality of second edge points, a second target edge point where the first target edge point is located on the model surface of the collision model;
[0008] The first target edge point is moved to the position of the second target edge point to form a collision effect between the collided model and the collision model.
[0009] The embodiment of the present invention further discloses a collision effect realization device, which relates to a collision model and a collision-affected model, wherein the model surface of the collision-affected model has a plurality of first edge points, and the model surface of the collision model has a plurality of second edge points, and the device comprises:
[0010] An interlaced point acquisition module, used to acquire a first target edge point interlaced inside the collision model;
[0011] a target edge point determination module, configured to determine a second target edge point of the first target edge point on a model surface of the collision model based on a distance between the first target edge point and the plurality of second edge points;
[0012] The collision effect generating module is used to move the first target edge point to the position of the second target edge point to form a collision effect between the collided model and the collision model.
[0013] An embodiment of the present invention further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements any one of the collision effect implementation methods when executed by the processor.
[0014] The embodiment of the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any one of the collision effect realization methods is realized.
[0015] The embodiments of the present invention include the following advantages:
[0016] In an embodiment of the present invention, by interspersing the first target edge point inside the collision model on the model surface of the collided model, the second target edge point of the first target edge point on the model surface of the collision model can be determined based on the distance between the first target edge point and a plurality of second edge points, and then the first target edge point interspersed inside the collision model is moved to the position of the second target edge point to form a collision effect between the collided model and the collision model. By obtaining the interspersed point of the collided model and moving the interspersed point to the position of the second target edge point on the surface of the collision model, the collision effect of the collided model is calculated in real time, and the simulation of polygon collision deformation in Maya is conveniently realized. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flowchart of a method for realizing a collision effect according to an embodiment of the present invention;
[0018] Figure 2 is a flowchart of another embodiment of a method for realizing a collision effect of the present invention;
[0019] Figure 3 is a schematic diagram of realizing the direct collision effect provided by an embodiment of the present invention;
[0020] Figure 4 It is a schematic diagram of realizing the indirect collision effect provided by an example of the present invention;
[0021] Figure 5 is an example diagram of forming a collision effect provided by an embodiment of the present invention;
[0022] Figure 6 It is a structural block diagram of an embodiment of a device for realizing a collision effect of the present invention. DETAILED DESCRIPTION
[0023] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0024] In scenes that need to simulate real-world physical interactions and deformation effects, it involves the need to simulate polygon collision deformation in Maya.
[0025] As an example, when making character animation or special effects animation, you may need to simulate real collision reactions between objects, such as collisions between characters and objects in the environment, interactions between objects, etc.; as another example, in the game development process, in order to enhance the realism and interactivity of the game, it is necessary to simulate collision and deformation effects between elements such as characters, props, and environments; as yet another example, in the production of special effects for movies and television, it is often necessary to simulate complex physical phenomena, such as explosions, flying debris, collisions between cloth and objects, etc., in order to achieve realistic visual effects.
[0026] The embodiment of the present invention obtains the interpenetration point of the collided model and moves the interpenetration point to the position of the second target edge point on the surface of the collision model, thereby calculating the collision effect of the collided model in real time, and conveniently realizing the simulation of polygon collision deformation in Maya. Specifically, the interpenetration point of the collided model and the second target edge point on the surface of the collision model can be obtained based on ray collision detection, and the direct collision effect of the collided model in each frame of animation can be calculated; and the indirect collision effect can be formed by generating edge undulations around the collision position of the direct collision effect formed by the collided model, such as the concave position. In addition, the aforementioned direct collision effect and indirect collision effect can be realized based on the deformer interface of Maya, and the above-mentioned specific process can be encapsulated in the deformer class, thereby automatically and efficiently realizing the simulation of the collision effect, solving the problems of difficulty in realizing the collision effect, slow solution speed, cumbersome steps and long time when simulating the collision effect.
[0027] Reference Figure 1 , shows a flowchart of a method for realizing a collision effect according to an embodiment of the present invention, which may specifically include the following steps:
[0028] Step 101, obtaining a first target edge point interspersed inside the collision model;
[0029] The collision effect is mainly formed by the collision between at least two models.
[0030] At least two models that form a collision effect are usually models that exist in the scene and meet the collision requirements. Optionally, it involves a collider model and a collided model, which are used to describe two objects that collide during the collision effect simulation process.
[0031] Among them, the collision model refers to the object that actively initiates collision detection in the physical simulation. The model is usually a moving object or an object that does not deform within its boundary; the collided model refers to the object that is detected in the physical simulation to see if it is in contact with the collision model. The model is usually a stationary object or an object that deforms within its boundary.
[0032] Exemplarily, the collision model may be a foot model, and the collision-affected model may be a ground model.
[0033] The model surface of the collided model may have several first edge points, and the model surface of the colliding model may have several second edge points. Optionally, the edge points may refer to detection points located on the model surface, and the detection points may be evenly distributed.
[0034] When the collision model collides with the collided model, the model surface of the collided model may undergo collision deformation, and the collision deformation may be realized as a model surface formed by connecting the first edge points that move on the collided model.
[0035] In one embodiment of the present invention, in order to determine the first edge point that moves, the interpenetration point of the collided model may be determined. The interpenetration point may refer to the first edge point interpenetrating inside the collision model, which may be referred to as the first target edge point.
[0036] It should be noted that the number of interlaced points, that is, the number of first target edge points can be at least one, which can be specifically determined based on the collision area / range between the collision model and the collided model, the material of the collision model and the collided model, etc., and the embodiments of the present invention are not limited to this.
[0037] Optionally, the determination of the interpenetration point may be implemented based on ray collision detection.
[0038] Specifically, based on a plurality of first edge points of the collided model, rays may be emitted in the direction of the collision model to detect the first target edge points interspersed within the collision model. The specific ray collision detection process of the first target edge points is not limited in the embodiment of the present invention.
[0039] Step 102, determining a second target edge point of the first target edge point on the model surface of the collision model based on the distance between the first target edge point and a plurality of second edge points;
[0040] After determining the first target edge point, the distance between the first target edge point and each second edge point on the model surface of the collision model may be calculated, and based on the calculated distance values, the second target edge point on the model surface of the collision model may be determined.
[0041] Optionally, the second target edge point may be a point on the model surface of the collision model that is closest to the first target edge point. In an embodiment of the present invention, the position of the second target edge point may be used as the moving position of the first target edge point.
[0042] Step 103: Move the first target edge point to the position of the second target edge point to form a collision effect between the collided model and the collision model.
[0043] Specifically, the displacement between the first target edge point and the second target edge point can be applied to the first target edge point, and then the first target edge point is moved to the position of the second target edge point, so as to realize the real-time deformation process of the collided model and form a collision effect.
[0044] In an embodiment of the present invention, by interspersing the first target edge point inside the collision model on the model surface of the collided model, the second target edge point of the first target edge point on the model surface of the collision model can be determined based on the distance between the first target edge point and a plurality of second edge points, and then the first target edge point interspersed inside the collision model is moved to the position of the second target edge point to form a collision effect between the collided model and the collision model. By obtaining the interspersed point of the collided model and moving the interspersed point to the position of the second target edge point on the surface of the collision model, the collision effect of the collided model is calculated in real time, and the simulation of polygon collision deformation in Maya is conveniently realized.
[0045] Reference Figure 2 , shows a flowchart of another embodiment of a method for realizing a collision effect of the present invention, which may specifically include the following steps:
[0046] Step 201, based on a plurality of first edge points of the collided model, a ray is emitted in the direction of the collision model to detect and obtain a first target edge point interspersed inside the collision model;
[0047] The collision effect is mainly formed by the collision between at least two models, especially any collided model and any colliding model. When the collision model collides with the collided model, the model surface of the collided model may be deformed by the collision.
[0048] Exemplarily, the collision model may be a foot model, and the collided model may be a ground model. When the foot model collides with the ground model, the ground model made of snow may be deformed by collision.
[0049] The realization of collision deformation can be reflected as a model surface formed by connecting the first edge points that move on the collision model.
[0050] In one embodiment of the present invention, in order to determine the first edge point that moves, the interpenetration point of the collided model may be determined. The interpenetration point may refer to the first edge point interpenetrating inside the collision model, which may be referred to as the first target edge point.
[0051] Optionally, the determination of the interpenetration point may be implemented based on ray collision detection.
[0052] Specifically, rays may be emitted in the direction of the collision model based on a number of first edge points of the collided model to detect and obtain first target edge points interspersed within the collision model.
[0053] Optionally, the collision model is usually a moving object, and the collision model may have animation information. For example, when the collision model is a foot model, the animation information of the foot model may include walking animation information and the like.
[0054] In one embodiment of the present invention, each frame of animation can be traversed based on the animation information. When the collision model in the current frame of animation collides with the collided model, rays are emitted in the direction of the collision model based on several first edge points of the collided model to detect the first target edge point interspersed inside the collision model.
[0055] For example, assuming that the collision model is a foot model, the collided model is a ground model, and the animation information is the walking animation information of the foot model, the walking animation can be played based on the walking animation information, and each frame of the animation can be traversed. When the foot model and the ground model are interspersed, the first target edge point where the collided model is interspersed with the collision model in the current frame of the animation can be obtained based on ray collision detection, that is, the ground interspersed point where the ground model is interspersed with the foot model.
[0056] Among them, the OpenMaya.MFnMesh.allIntersections() function can be used to detect whether a ray emitted from a certain point intersects with a polygonal mesh and return the information of the intersection point. In this example, you can get the MObject of the ground and foot model, then get the current frame, and get the world space position of the second edge point of the foot model to use as the ray emission source point, and then use the OpenMaya.MFnMesh.allIntersections() function to get the ground intersect point where the ground model is interspersed with the foot model.
[0057] In practical applications, the ray direction of the emitted ray may be the direction of the collision model.
[0058] In order to ensure that the ray direction is toward the collision model, the preset normal direction of the emitted ray can be ensured to be the normal direction of the face formed by several first edge points toward the collision model. That is, based on several first edge points of the collided model, rays can be emitted in the preset normal direction to detect the first target edge point interspersed inside the collision model.
[0059] Optionally, the collision model is usually a closed model. When the collided model has an interpenetration point located inside the boundary of the collision model, it can be expressed as the number of collisions between the ray emitted by the first edge point and the collision model is an odd number; when the collided model does not have an interpenetration point located inside the boundary of the collision model, it can be expressed as the number of collisions between the ray emitted by the first edge point and the collision model is an even number.
[0060] In one embodiment of the present invention, the number of collisions between the ray emitted by each first edge point and the collision model can be obtained, and the first edge point whose emitted ray collides with the collision model an odd number of times is determined as the first target edge point interspersed inside the collision model.
[0061] Exemplarily, in Maya, an emitter can be created using a particle system, and the emitter can be set to emit particles from each first edge point of the collided model along a preset normal direction. Specifically, a particle emitter can be created at each first edge point of the collided model, and the direction of the particle emitter can be set to be the normal direction of the collision model on the facet formed by several first edge points; and the collision model can be set as a collision object of the particle system. At this time, a simulation can be run to observe whether the particles collide with the collision model. During the simulation, the number of collisions between the particles and the collision model can be recorded. If the number of collisions is an odd number, it can be explained that the first target edge point in the collided model is interspersed with the collision model.
[0062] Step 202, determining a second target edge point of the first target edge point on the model surface of the collision model based on the distance between the first target edge point and a plurality of second edge points;
[0063] After determining the first target edge point, the distance between the first target edge point and each second edge point on the model surface of the collision model may be calculated, and based on the calculated distance values, the second target edge point on the model surface of the collision model may be determined.
[0064] Optionally, the second target edge point may be a point on the model surface of the collision model that is closest to the first target edge point.
[0065] In one embodiment of the present invention, the distance between the first target edge point and each second edge point can be calculated to obtain multiple distance values, and then the multiple distance values are arranged in a preset order to obtain the second target edge point corresponding to the target distance value in the preset order.
[0066] As an example, assuming that the preset order is in order from large to small, the preset order may refer to the last position, in which case the target distance value at the last position is the smallest distance value, and the second target edge point corresponding to the target distance value is the point closest to the first target edge point; as another example, assuming that the preset order is in order from small to large, the preset order may refer to the first position, in which case the target distance value at the first position is the smallest distance value, and the second target edge point corresponding to the target distance value is the point closest to the first target edge point.
[0067] Step 203, moving the first target edge point to the position of the second target edge point to form a direct collision effect between the collided model and the collision model;
[0068] The collision effect may include a direct collision effect, which refers to an immediate response when two objects come into direct contact in physical space. This collision usually involves direct interaction between the surfaces of the two objects.
[0069] In an embodiment of the present invention, the position of the second target edge point can be used as the moving position of the first target edge point. At this time, the first target edge point can be moved to the position of the second target edge point to form a direct collision effect between the collided model and the collision model.
[0070] Specifically, the displacement between the first target edge point and the second target edge point can be applied to the first target edge point, and then the first target edge point is moved to the position of the second target edge point, so as to realize the real-time deformation process of the collided model and form a direct collision effect.
[0071] Alternatively, direct collision effects can be implemented as Figure 3As shown, it is assumed that A is the collided model, a is a number of first edge points on the model surface of the collided model A, B is the collision model, and b is a number of second edge points on the surface of the collision model B; when the collision model B and the collided model A begin to collide, as Figure 3 As shown in ②, the collided model A has a first target edge point interspersed inside the collision model B; the direct collision effect involves direct interaction between the model surfaces. At this time, the first target edge point of the collided model A that is interspersed inside the collision model B can be moved to the position where the first target edge point is closest to the model surface of the collision model B. The effect after the first target edge point is moved can be as shown below. Figure 3 As shown in ③, a direct collision effect between the collided model A and the collision model B is formed.
[0072] For example, assuming that the collision model is the foot model and the collided model is the ground model, the position of the closest point between the ground penetration point and the surface of the foot model can be calculated by using the OpenMaya.MFnMesh(MObject).getClosestPoint() function of the MayaAPI, and then the ground penetration point can be moved to the closest point on the surface of the foot model to make the surface of the ground model form, thereby forming a direct collision effect.
[0073] It should be noted that the continuous collision effect between the collision model and the collided model can be achieved by calculating each frame of animation in real time through MayaDeformer, and this is not limited in the embodiment of the present invention.
[0074] Step 204 , obtaining a plurality of third target edge points on the model surface of the collided model that are adjacent to the first target edge point, and moving the third target edge points to form an indirect collision effect between the collided model and the collision model.
[0075] The collision effect may also include indirect collision effect. Indirect collision effect refers to the secondary or chain reaction produced by the collision of objects. This effect usually does not involve direct contact between the surfaces of the objects, but is achieved through the transfer of force or energy caused by the collision.
[0076] In the embodiment of the present invention, an indirect collision effect may be formed by generating edge fluctuations around a collision position, such as a concave position, of a direct collision effect formed by the collision model.
[0077] Specifically, several third target edge points adjacent to the first target edge point on the model surface of the collided model can be obtained, as well as the normal direction of each third target edge point. Then, by moving each third target edge point along its normal direction by different preset distances, an indirect collision effect between the collided model and the collision model is formed.
[0078] Optionally, indirect collision effects can be implemented as Figure 4 As shown, it is assumed that A is the collided model, a is a number of first edge points on the model surface of the collided model A, B is the collision model, and b is a number of second edge points on the surface of the collision model B.
[0079] The first target edge point of the collision model A that is interspersed inside the collision model B is moved to the position where the first target edge point is closest to the model surface of the collision model B. The effect of the movement of the first target edge point can be as follows: Figure 4 As shown in ① in the figure, a direct collision effect between the collided model A and the collision model B is formed; after the direct collision effect is formed, a plurality of third target edge points adjacent to the first target edge point on the model surface of the collided model A can be obtained, and at this time, Figure 4 As shown in ② in FIG. 2 , each third target edge point is moved along its normal direction by different preset distances; the effect after the third target edge point is moved can be as follows Figure 4 As shown in ③, an indirect collision effect between the collided model A and the collision model B is formed.
[0080] For example, assuming that the collision model is a foot model and the collided model is a ground model, one or more circles of ground model points adjacent to the ground penetration point on the model surface of the ground model can be obtained by using the maya.cmds.polyListComponentConversion() function according to the ground penetration point, and then the undulating effect is achieved by moving the aforementioned adjacent points.
[0081] Among them, you can use the maya.cmds.polyNormalPerVertex() function to get the normal of each adjacent point, and then move the adjacent point along its own normal direction. The moving distance can be from slow to fast and then slow again, thus forming a slope. From a macro perspective, the ground around the foot seems to be "squeezed" a little height, thereby achieving an indirect collision effect.
[0082] Optionally, other deformation effects may be added to the indirect collision effect according to actual needs, such as a ground crushing effect; or a certain degree of ground rebound effect after the foot leaves the ground, etc., which is not limited in this embodiment of the present invention.
[0083] In an embodiment of the present invention, the above direct collision effect and indirect collision effect can be implemented based on the deformer interface of Maya, and the above specific process can be encapsulated in the deformer class, thereby automatically and efficiently simulating the collision effect, solving the problems of difficulty in simulating the collision effect, slow solving speed, cumbersome steps and long time consumption. That is, the above function can be encapsulated by the Maya.OpenMayaMpx.MPxDeformerNode deformer class that inherits the Maya API, so as to automatically calculate and move the position of the model point of the ground in each frame to achieve the collision animation effect.
[0084] For example, assuming that the collision model is a foot model and the collision model is a ground model, the collision effect realization method provided by the embodiment of the present invention can form the following: Figure 5 The collision effect shown; and based on the collision effect implementation of the deformer interface, a real-time preview of the collision effect generated in real time can be achieved.
[0085] In an embodiment of the present invention, by obtaining the interpenetration point of the collided model and moving the interpenetration point to the position of the second target edge point on the surface of the collision model, the collision effect of the collided model is calculated in real time, and the simulation of polygon collision deformation in Maya is conveniently realized. Specifically, the interpenetration point of the collided model and the second target edge point on the surface of the collision model can be obtained based on ray collision detection, and the direct collision effect of the collided model in each frame of animation can be calculated; and the indirect collision effect can be formed by generating edge undulations around the collision position of the direct collision effect formed by the collided model, such as the concave position. In addition, the aforementioned direct collision effect and indirect collision effect can be implemented based on Maya's deformer interface, and the above-mentioned specific process can be encapsulated in the deformer class, thereby automatically and efficiently realizing the simulation of the collision effect, solving the problems of difficulty in realizing the collision effect, slow solution speed, cumbersome steps and long time when simulating the collision effect.
[0086] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0087] Reference Figure 6, shows a structural block diagram of an embodiment of a collision effect realization device of the present invention, involving a collision model and a collision model, wherein the model surface of the collision model has a plurality of first edge points, and the model surface of the collision model has a plurality of second edge points, and specifically may include the following modules:
[0088] An interlaced point acquisition module 601 is used to acquire a first target edge point interlaced inside the collision model;
[0089] A target edge point determination module 602 is used to determine a second target edge point of the first target edge point on the model surface of the collision model based on the distance between the first target edge point and the plurality of second edge points;
[0090] The collision effect generating module 603 is used to move the first target edge point to the position of the second target edge point to form a collision effect between the collided model and the collision model.
[0091] In an embodiment of the present invention, the insertion point acquisition module 601 may include the following submodules:
[0092] The interpenetration point acquisition submodule is used to emit rays in the direction of the collision model based on a plurality of first edge points of the collided model, and detect and obtain first target edge points interpenetrating inside the collision model.
[0093] In one embodiment of the present invention, the collision model has animation information; the penetration point acquisition submodule may include the following units:
[0094] The interpenetration point acquisition unit is used to traverse each frame of animation based on the animation information. When the collision model in the current frame of animation collides with the collided model, a ray is emitted in the direction of the collision model based on several first edge points of the collided model to detect and obtain the first target edge point interspersed inside the collision model.
[0095] In one embodiment of the present invention, the insertion point acquisition unit may include the following subunits:
[0096] A ray emitting subunit is used to emit rays in a preset normal direction based on several first edge points of the collided model, and detect the first target edge points interspersed inside the collision model; wherein the preset normal direction is the normal direction of the facet formed by the several first edge points toward the collision model.
[0097] In an embodiment of the present invention, the collision model is a closed model; the penetration point acquisition unit may include the following subunits:
[0098] The interpenetration point acquisition subunit is used to obtain the number of collisions between the rays emitted by each first edge point and the collision model; the first edge point whose number of collisions between the emitted rays and the collision model is an odd number is determined as the first target edge point interpenetrated inside the collision model.
[0099] In one embodiment of the present invention, the target edge point determination module 602 may include the following submodules:
[0100] The target edge point determination submodule is used to calculate the distance between the first target edge point and each second edge point to obtain multiple distance values; arrange the multiple distance values in a preset order to obtain the second target edge point corresponding to the target distance value in the preset order.
[0101] In one embodiment of the present invention, the collision effect generation module 603 is also used to obtain a plurality of third target edge points on the model surface of the collided model that are adjacent to the first target edge point, and to obtain the normal direction of each third target edge point; and to move each third target edge point along its normal direction by a different preset distance to form a collision effect between the collided model and the collision model.
[0102] In an embodiment of the present invention, the collision effect realization device provided by the embodiment of the present invention can determine the second target edge point of the first target edge point on the model surface of the collision model based on the distance between the first target edge point and a plurality of second edge points by interspersing the first target edge point inside the collision model, and then move the first target edge point interspersed inside the collision model to the position of the second target edge point, thereby forming a collision effect between the collision model and the collision model. By obtaining the interspersed point of the collision model and moving the interspersed point to the position of the second target edge point on the surface of the collision model, the collision effect of the collision model is calculated in real time, and the simulation of polygon collision deformation in Maya is conveniently realized.
[0103] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0104] An embodiment of the present invention further provides an electronic device, including:
[0105] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned collision effect implementation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0106] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned collision effect implementation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0107] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0108] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0109] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0110] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0111] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0112] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0113] Finally, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0114] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0115] The above is a detailed introduction to a method for realizing a collision effect, a device for realizing a collision effect, a corresponding electronic device and a corresponding computer-readable storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for realizing a collision effect, characterized in that: The invention relates to a collision model and a collision model, wherein the model surface of the collision model has a plurality of first edge points, and the model surface of the collision model has a plurality of second edge points. The method comprises: Acquire a first target edge point interspersed within the collision model; Determine, based on the distance between the first target edge point and the plurality of second edge points, a second target edge point where the first target edge point is located on the model surface of the collision model; The first target edge point is moved to the position of the second target edge point to form a collision effect between the collided model and the collision model.
2. The method according to claim 1, characterized in that The obtaining of the first target edge point interspersed within the collision model includes: Based on a plurality of first edge points of the collided model, rays are emitted in the direction of the collision model to detect and obtain first target edge points interspersed inside the collision model.
3. The method according to claim 2, characterized in that The collision model has animation information; the emitting of rays in the direction of the collision model based on a plurality of first edge points of the collided model to detect and obtain first target edge points interspersed inside the collision model includes: Each frame of animation is traversed based on the animation information. When the collision model in the current frame of animation collides with the collided model, rays are emitted in the direction of the collision model based on several first edge points of the collided model to detect and obtain the first target edge point interspersed inside the collision model.
4. The method according to claim 2 or 3, characterized in that: The step of emitting rays in the direction of the collision model based on a plurality of first edge points of the collided model to detect and obtain first target edge points interspersed inside the collision model includes: Based on a plurality of first edge points of the collided model, rays are emitted in a preset normal direction to detect and obtain first target edge points interspersed inside the collision model; The preset normal direction is the normal direction on the facet formed by the plurality of first edge points and facing the collision model.
5. The method according to claim 2 or 3, characterized in that: The collision model is a closed model; the rays are emitted in the direction of the collision model based on a plurality of first edge points of the collided model to detect and obtain first target edge points interspersed inside the collision model, including: Obtaining the number of collisions between the ray emitted by each first edge point and the collision model; The first edge point where the emitted ray collides with the collision model an odd number of times is determined as a first target edge point interspersed inside the collision model.
6. The method according to claim 1, characterized in that The determining, based on the distance between the first target edge point and the plurality of second edge points, a second target edge point of the first target edge point on the model surface of the collision model comprises: Calculating the distance between the first target edge point and each second edge point to obtain a plurality of distance values; Arrange the multiple distance values in a preset order to obtain a second target edge point corresponding to the target distance value in the preset order.
7. The method according to claim 1, characterized in that The method further comprises: Acquire a plurality of third target edge points adjacent to the first target edge point on the model surface of the collided model, and acquire the normal direction of each third target edge point; Each third target edge point is moved along its normal direction by a different preset distance to form a collision effect between the collided model and the collision model.
8. A device for realizing a collision effect, characterized in that: The invention relates to a collision model and a collision model, wherein the model surface of the collision model has a plurality of first edge points, and the model surface of the collision model has a plurality of second edge points. The device comprises: An interlaced point acquisition module, used to acquire a first target edge point interlaced inside the collision model; a target edge point determination module, configured to determine a second target edge point of the first target edge point on a model surface of the collision model based on a distance between the first target edge point and the plurality of second edge points; The collision effect generating module is used to move the first target edge point to the position of the second target edge point to form a collision effect between the collided model and the collision model.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the method for realizing the collision effect as claimed in any one of claims 1 to 7 is realized.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for realizing the collision effect as claimed in any one of claims 1 to 7 is implemented.
