Virtual model force simulation method and related device
By extracting vertex physical properties and collision information from the virtual model, the total force and displacement direction of the vertex are determined, solving the problem that the virtual model cannot realize mixed physical behavior and achieving precise and controllable deformation recovery.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
- Filing Date
- 2026-03-06
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, virtual models cannot achieve hybrid physical behavior on the same model, and the deformation recovery process is relatively coarse, making it impossible to finely adjust the speed and extent of recovery.
By extracting the physical attribute information of each vertex in the virtual model, collision information is obtained during the collision detection process. Based on the physical attributes and collision information of the vertex, the total force and displacement direction of the vertex are determined, and collision recovery is performed according to the target position and the position of maximum deformation to construct a hybrid physical model.
It enables the setting of different physical properties in different areas of the same virtual model, allowing complex local deformation behavior and providing a precise and controllable deformation recovery mechanism.
Smart Images

Figure CN122156548A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method and related equipment for simulating the force of a virtual model. Background Technology
[0002] Currently, force interactions in the Virtual Reality (VR) world are relatively simple, typically involving pre-created animations or engine settings that define the physical properties of a single object as either rigid or flexible. Because the entire virtual model is uniformly categorized as a rigid body, elastic body, or plastic body, it's impossible to achieve mixed physical behaviors on the same virtual model. Furthermore, the control over the deformation recovery process of the virtual model is rather coarse, making it impossible to finely adjust the speed and extent of recovery. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a virtual model force simulation method and related equipment to solve the problem in the prior art that the speed and extent of recovery cannot be finely adjusted.
[0004] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0005] The first aspect illustrates a method for simulating the force on a virtual model, the method comprising:
[0006] Extract the physical attribute information of each vertex in the pre-built target virtual model;
[0007] During the collision detection process of the target virtual model, the collision information corresponding to the target virtual model is acquired;
[0008] Based on the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model, the total force on each vertex is determined.
[0009] The displacement direction of each vertex is determined based on the physical attribute information of each vertex in the target virtual model, the collision information, the preset maximum flexibility coefficient, and the preset safety coefficient.
[0010] For each vertex, the target position and the position of maximum deformation of each vertex are determined by processing based on the physical property information, the total force on the vertex and the displacement direction of the vertex.
[0011] Collision recovery is performed on the target virtual model based on the target position, maximum deformation position, and physical attribute information of each vertex.
[0012] Optionally, the process of pre-building a target virtual model includes:
[0013] Obtain an initial virtual model, which is a model for setting multi-dimensional model data;
[0014] Based on the stress performance data of different regions in the initial virtual model, set the material value and deformation direction blending factor of each vertex, and map the material value and deformation direction blending factor to the RGBA map according to the initial coordinates of the vertex. The RGBA map is constructed based on the initial coordinates of each vertex, and the initial coordinates of the vertex are the two-dimensional texture mapping coordinates of the vertex.
[0015] The corresponding recovery rate factor and diffusion factor are determined based on the material value of each vertex, and the recovery rate factor and diffusion factor are mapped to the RGBA texture according to the initial coordinates of the vertex.
[0016] The RGBA texture is pasted onto the 3D model to obtain the pre-constructed target virtual model.
[0017] Optionally, the physical attribute information includes at least initial coordinates and a diffusion factor; based on the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model, the total force on each vertex is determined, including:
[0018] For each vertex in the target virtual model, the first distance between the vertex and the collision point is calculated based on the collision information and the initial coordinates of each vertex;
[0019] The influence radius of the vertex is calculated based on the preset maximum influence radius, the preset force influence coefficient, the magnitude of the collision force in the collision information, and the diffusion factor of the vertex.
[0020] If the vertex is determined to be within the influence range of the collision detection based on the first distance and the influence radius, the direct force acting on the vertex is determined based on the first distance, the influence radius, and the collision force in the collision information;
[0021] The transmitted force received by the vertex is calculated based on the direct force of each other vertex adjacent to the vertex, the diffusion factor of each other vertex, and a preset adjacency attenuation function.
[0022] The total force acting on the vertex is determined based on the direct force acting on the vertex and the transmitted force received by the vertex.
[0023] Optionally, determining the direct force on the vertex based on the first distance, the radius of influence, and the collision force in the collision information includes:
[0024] The sum of the influence radius of the vertex and the preset zero constant is calculated to obtain the first value;
[0025] Based on the first distance and the first value, the distance decay factor of the vertex is determined.
[0026] The collision force is attenuated based on the distance attenuation factor of the vertex to determine the direct force acting on the vertex.
[0027] Optionally, the physical property information includes at least a deformation direction mixing factor and material values; determining the displacement direction of each vertex based on the physical property information of each vertex of the target virtual model, the collision information, the preset maximum compliance coefficient, and the preset safety factor includes:
[0028] The maximum displacement of each vertex is determined based on the physical attribute information of each vertex of the target virtual model, the preset maximum flexibility coefficient, and the preset safety coefficient.
[0029] The mixing direction vector of the vertex is determined based on the first distance of the vertex, the coordinates of the collision point and the unit vector of the collision force direction in the collision information, and the deformation direction mixing factor of the physical property information.
[0030] The displacement direction of the vertex is determined based on the hybrid direction vector of the vertex.
[0031] Optionally, the maximum displacement of each vertex is determined based on the physical attribute information of each vertex of the target virtual model, a preset maximum compliance coefficient, and a preset safety coefficient, including:
[0032] For each vertex, the vertex flexibility is calculated based on the preset maximum flexibility coefficient and the material value of the vertex;
[0033] The maximum displacement of a vertex is determined by adjusting the vertex flexibility based on a preset safety factor.
[0034] Optionally, the mixing direction vector of the vertex is determined based on the first distance of the vertex, the collision point coordinates and the collision force direction unit vector in the collision information, and the deformation direction mixing factor of the physical property information, including:
[0035] Determine whether the first distance is greater than 0;
[0036] If it is greater than the first distance, the unit radial vector of the vertex is determined based on the first distance and the first vector, wherein the first vector is determined by the initial coordinates of the vertex and the coordinates of the collision point in the collision information;
[0037] If equal, the unit vector of the collision force direction in the collision information is taken as the unit radial vector of the vertex;
[0038] The unit vector of the collision force direction, the unit radial vector, and the deformation direction mixing factor are linearly interpolated to obtain the mixing direction vector of the vertex.
[0039] Optionally, the physical property information includes at least initial coordinates and material values. Based on the physical property information, the total force acting on the vertex, and the displacement direction of the vertex, the target position and maximum deformation position of each vertex are determined, including:
[0040] For each vertex, the actual displacement of the vertex is determined based on the vertex compliance and the total force acting on the vertex. The vertex compliance is determined based on a preset maximum compliance coefficient and the material value of the vertex.
[0041] The maximum deformation position of the vertex is calculated based on the initial coordinates of the vertex, the actual displacement of the vertex, and the displacement direction of the vertex.
[0042] The degree of restoration of a vertex is determined based on its material value.
[0043] The target displacement vector is determined based on the actual displacement of the vertex, the displacement direction of the vertex, and the degree of recovery corresponding to the vertex.
[0044] The target position is obtained by processing the initial coordinates of the vertex and the target displacement vector.
[0045] The second aspect illustrates a virtual model force simulation device, the device comprising:
[0046] The extraction unit is used to extract the physical attribute information of each vertex in the pre-built target virtual model;
[0047] The acquisition unit is used to acquire collision information corresponding to the target virtual model during the collision detection process of the target virtual model;
[0048] The processing unit is configured to process the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model to determine the total force on each vertex; determine the displacement direction of each vertex based on the physical attribute information of each vertex of the target virtual model, the collision information, a preset maximum compliance coefficient, and a preset safety coefficient; and, for each vertex, process the physical attribute information, the total force on the vertex, and the displacement direction of the vertex to determine the target position and the maximum deformation position of each vertex.
[0049] The recovery unit is used to perform collision recovery on the target virtual model based on the target position, maximum deformation position and physical attribute information of each vertex.
[0050] The third aspect discloses an electronic device including a processor and a memory, the memory being used to store program code and data for data generation, and the processor being used to invoke program instructions in the memory to execute a virtual model force simulation method as described in any of the first aspects.
[0051] Based on the above embodiments of the present invention, a virtual model force simulation method and related equipment are provided. The method includes: extracting physical attribute information of each vertex in a pre-constructed target virtual model; acquiring collision information corresponding to the target virtual model during collision detection; processing the collision information and physical attribute information of each vertex in the target virtual model to determine the total force on each vertex; determining the displacement direction of each vertex based on the physical attribute information, the collision information, a preset maximum compliance coefficient, and a preset safety coefficient; for each vertex, processing the physical attribute information, the total force on the vertex, and the displacement direction to determine the target position and maximum deformation position of each vertex; and performing collision recovery on the target virtual model based on the target position, maximum deformation position, and physical attribute information of each vertex. In the embodiments of the present invention, all physical attributes of each vertex in the target virtual model are controlled so that different physical attributes are set in different areas of the same model to create a highly customizable, high-level hybrid physical model based on vertex physical attributes. Compared to the traditional paradigm of strictly separating rigid and soft bodies in physics engines, this approach allows for complex local deformation behaviors on the same model. During collision detection of the target virtual model, collision information corresponding to the target virtual model is acquired. The target position and maximum deformation position of each vertex are determined using the collision information and the physical properties of each vertex. Collision recovery is then performed based on the target position and maximum deformation position of each vertex, thus providing a precise and controllable deformation recovery mechanism. Attached Figure Description
[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0053] Figure 1 This is a flowchart illustrating a virtual model force simulation method according to an embodiment of the present invention;
[0054] Figure 2 This is a flowchart illustrating a hand model according to an embodiment of the present invention;
[0055] Figure 3 This is a schematic diagram of the structure of a virtual model force simulation device according to an embodiment of the present invention. Detailed Implementation
[0056] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0057] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0058] It should be noted that the descriptions involving "first," "second," etc., in this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0059] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0060] See Figure 1This is a flowchart illustrating a virtual model force simulation method according to an embodiment of the present invention. The method includes:
[0061] Step S101: Extract the physical attribute information of each vertex in the pre-built target virtual model.
[0062] The physical property information includes at least the initial coordinates, material values, deformation direction mixing factor, recovery rate factor, and diffusion factor;
[0063] It should be noted that the process of pre-constructing the target virtual model includes the following steps:
[0064] Step S11: Obtain the initial virtual model, which is a model for setting multidimensional model data;
[0065] In the specific implementation of step S11, firstly, a basic VR scene is established, and a preset template is used to import a standard virtual model;
[0066] It should be noted that the applicant found that the virtual model, which is a grid composed of points, lines, and surfaces, is mostly just an empty shell (such as game characters, animated characters, and building exteriors); it only defines the surface of the object that comes into contact with the outside world, just like an inflated balloon, which has a complete shape on the outside but is completely empty inside.
[0067] In the virtual world, forces acting on virtual models can be triggered by interactions between objects or by the interaction between external forces and the virtual model. To simulate the physical properties of materials in force interactions, different attributes can be defined for different areas of the virtual model. The attributes defined for the virtual model in this paper are based on visual effects. For example: material type (rigid body, plastic body, elastic body), material recovery speed after deformation, deformation direction factor, and force diffusion factor.
[0068] This approach facilitates the display of artistic effects. For example, in reality, human skin covers muscles and bones; pressing the cheek with the same force versus pressing the forehead will result in different deformations of the skin. Since the initial virtual model is merely a hollow shell, all attributes must be created on the virtual model's surface and vertices, thereby constructing a hybrid model composed of rigid, elastic, or plastic bodies, which is the target virtual model shown in this application.
[0069] Next, multi-dimensional model data is set for the standard virtual model, which will serve as the initial virtual model;
[0070] It should be noted that the multi-dimensional model data includes model data used for interaction, such as the set colliders, recognition data, and force field data;
[0071] Specifically, it includes the following steps.
[0072] Step S21: Configure at least one collider in the standard virtual model;
[0073] In the specific implementation step S21, a collider is configured for the standard virtual model itself, or a collider is set for a certain region or various regions under the standard virtual model. Specifically, a mesh collider based on the model itself is configured for the standard virtual model (to accurately match the model itself), or colliders such as spheres and capsules can be configured for the sub-regions of the standard virtual model; that is, a collider that meets the requirements is configured for the standard virtual model according to the actual situation.
[0074] For example, a standard virtual model is a hand model. The fingertips can be spheres with a radius of 5mm, the knuckles can be capsules with a radius of 8mm, and the palm can be a shape composed of multiple spheres. In this case, colliders can be placed on the back of the hand in the hand model, such as... Figure 2 As shown.
[0075] Among them, the collider is a component used to detect the interaction and collision between virtual models. Adding a collider to a model can prevent the models from intersecting and is a prerequisite for detecting the force on the model.
[0076] Step S22: Call the preset processing model to process the standard virtual model based on the model's basic information to determine the corresponding identification data and force field data, etc., for interaction.
[0077] Specifically, a preset processing model is invoked to process the standard virtual model based on the model's basic information (such as model objects) to obtain corresponding identification data and force field data, etc., for interactive model data.
[0078] It should be noted that the processing model is pre-trained based on the basic information of the historical virtual model, as well as the corresponding model data for interaction, such as identification data and force field data of different dimensions.
[0079] The model object can be a hand, a tree branch, etc.
[0080] Pose recognition data includes joint positions, joint angles, target patterns, etc.
[0081] Collision identification data includes collision location, collision detection data, contact force data, etc.
[0082] Force field data includes force field type, point of application, force field shape, intensity, force field range, and / or direction;
[0083] For example, if the standard virtual model is a hand model, the force field data corresponding to different dimensions include pinching force field data, pressing force field data, stretching force field data, and rotational force field data.
[0084] The pinching force field data includes: the force field type is an attraction field generated at the fingertips, the point of application is the tips of the thumb and index finger, the force field shape is a conical force field, the intensity increases with the pinching force, and the force field range is 2-3 cm around the fingertips.
[0085] The pressure field data includes: the force field type is a pressure field generated in the palm, the point of application is the center of the palm, the force field shape is hemispherical, the intensity is based on the palm contact area, and the direction is the palm normal direction;
[0086] The tensile force field data includes: the force field type is a bidirectional tensile force field, the point of application is the palms of both hands, the force field shape is cylindrical, the intensity is based on the distance between the hands, and the direction is the direction of the line connecting the hands;
[0087] The rotational force field data includes: the force field type is a torque field, the point of application is the center of the object, the force field shape is spherical, the intensity is based on the relative rotation angle of the two hands, and the direction is the direction of the rotation axis;
[0088] Optional, also includes:
[0089] Based on the recognition data and force field data corresponding to different dimensions of the standard virtual model, set the collaborative operation data and tactile feedback data of each region in the standard virtual model;
[0090] For example, collaborative operation data includes data on dominant finger recognition, secondary finger compensation, and gesture transition processing;
[0091] Dominant finger recognition includes the finger with the longest contact time, the finger with the greatest force, and the finger with the most stable position; secondary finger compensation includes secondary fingers providing auxiliary force, force field superposition calculation, and avoiding force field conflicts; gesture transition processing includes smooth transition from pinching to stretching, recognition and switching of operation modes, and recording and utilization of operation history.
[0092] This application needs to take into account the coordination of multiple fingers when multiple fingers interact with an object at the same time, avoid operational conflicts, and realize complex compound operations, so as to provide customers with a natural operating experience.
[0093] Step S23: Use the standard virtual model with multi-dimensional model data as the initial virtual model.
[0094] Optionally, various textures can be drawn on the initial virtual model after UV creation. This step is mainly to draw various weighted textures needed later, providing users with a more intuitive way to operate.
[0095] Step S12: Set the material value and deformation direction mixing factor of each vertex according to the stress performance data of different regions in the initial virtual model, and map the material value and deformation direction mixing factor to the RGBA texture according to the initial coordinates of the vertex.
[0096] The RGBA texture is constructed based on the initial coordinates of each vertex, where the initial coordinates of the vertex are the two-dimensional texture mapping coordinates of the vertex.
[0097] RGBA sticker Figure 1 This type of RGB color mode texture map carries three channels. Its main function is to map different parameters to the pixels of the RGBA texture map through the initial coordinates, so that the RGBA texture map can be directly applied to the 3D model of the target virtual model later.
[0098] It should be noted that the two-dimensional texture mapping coordinates of the vertex are created based on the initial virtual model. That is, the two-dimensional texture mapping coordinates of each vertex are created based on the initial virtual model and used as the initial coordinates.
[0099] Specifically, the initial virtual model is positioned with its own pixels on the U (horizontal) and V (vertical) axes, and mapped onto the surface of the preset 3D model to obtain the two-dimensional texture mapping coordinates of each pixel, that is, each vertex, and these coordinates are used as the initial coordinates.
[0100] Since the initial virtual model does not have internal muscles, skeletons, or other tissues, physical attributes are added to the vertices of each region according to key elements such as material type, stress recovery, stress deformation, and force transmission and diffusion. These key physical attributes are then mapped to RGBA channels to establish an intuitive visual correspondence, thereby forming the target virtual model.
[0101] The stress performance data includes information such as physical properties, recovery properties, surrounding deformation properties, and force transmission;
[0102] Among them, the physical properties can be hard, soft, or relatively soft, etc.
[0103] Recovery characteristics can be described as fast, moderate, or no recovery.
[0104] The surrounding deformation characteristics can be biased towards concavity or expansion;
[0105] Force transmission can be either high diffusion or low diffusion;
[0106] In the specific implementation step S12, the material value and deformation direction mixing factor of each vertex are set according to the force performance data of different regions in the updated initial virtual model, and the color value corresponding to the material value is displayed in the first channel of the RGBA map according to the initial coordinates of the vertex, and the color value corresponding to the deformation direction mixing factor is displayed in the second channel of the RGBA map.
[0107] When implementing the above implementation scheme, the stress performance data can be compared with the material values respectively. Mixing factor of deformation direction The correspondence between these values is used to determine the stress performance data in different regions and to determine the material values of each vertex within that region. Mixing factor of deformation direction ; Set material values The material values are represented by drawing. The weighted texture is represented by the first channel of the RGBA texture, namely the R channel.
[0108] Deformation direction mixing factor The method of drawing is used to represent the deformation direction blending factor. The weighted texture is represented by the second channel of the RGBA texture, namely the B channel.
[0109] It should be noted that material types include rigid, plastic, and elastic types;
[0110] Material values The grayscale value has a range of [0,1].
[0111] Among them, if the material value A value of 0 indicates that the material type is rigid, so deformation recovery calculation is forcibly ignored, it does not participate in spring force calculation, it only performs rigid body motion, and the G-channel recovery speed is forcibly disabled.
[0112] If the material value A value greater than 0 and less than or equal to 0.5 indicates that the material type is plastic, and the degree of recovery is 2. (Linear growth), participates in the complete physical calculation but does not fully recover;
[0113] If the material value A value greater than 0.5 and less than or equal to 0.5 indicates that the material type is an elastomer, and the degree of recovery is 1.0 (full recovery), with an elastic weight of [value missing]. (Linear growth);
[0114] If the material value A value of 1 indicates that the material type is a fully elastic material, with a recovery degree of 1.0 and an elasticity weight of 1.0, representing its ideal elastic behavior of rapid and complete recovery.
[0115] Deformation direction mixing factor The grayscale value has a range of [0,1].
[0116] Deformation direction mixing factor When the value is 0, the deformation direction of the vertex is entirely along the collision normal direction (concave effect); deformation direction mixing factor A value of 1 indicates that the deformation direction of this vertex is entirely along the radial direction (expansion effect); the deformation direction mixing factor... If the value is greater than 0 and less than 1, the vertex represents a mixture of two directions.
[0117] Optionally, the deformation direction mixing factor of each vertex in different regions can be determined by simulating the indentation and expansion effects after being subjected to different stress data. .
[0118] Step S13: Determine the corresponding recovery rate factor and diffusion factor based on the material value of each vertex, and map the recovery rate factor and diffusion factor to the RGBA texture according to the initial coordinates of the vertex.
[0119] In the specific implementation step S13, the corresponding recovery rate factor and diffusion factor are determined according to the material value of each vertex, and the recovery rate factor is set according to the initial coordinates of the vertex. The corresponding color value is displayed in the third channel of the RGBA map, and the color value corresponding to the diffusion factor is displayed in the fourth channel of the RGBA map to update the RGBA map;
[0120] When implementing the above implementation scheme, the material values can be compared with the recovery rate factor. and diffusion factor The correspondence is used to determine the recovery rate factor for each vertex. and diffusion factor ;Restore speed factor The method of rendering is used to represent the rendering recovery speed factor. The weighted texture is represented using the third channel of RGBA, namely the G channel; the diffusion factor is... The diffusion factor is represented by a plotting method. The weighted texture is represented by the fourth channel in RGBA, namely the A channel.
[0121] Among them, the recovery rate factor The value range is [0,1] for grayscale values. A value of 0.0 (pure black) indicates no recovery, simulating a viscous fluid or a fully plastic material. A value of 1.0 (pure white) indicates the maximum recovery rate, simulating an ideal elastic body.
[0122] Diffusion factor The grayscale value range is [0,1]. A value of 0.0 (pure black) indicates no diffusion (force is completely absorbed) to simulate porous and soft materials, while a value of 1.0 (pure white) indicates complete diffusion (force is completely conducted) to simulate dense and rigid materials.
[0123] Step S14: Paste the RGBA texture onto the 3D model to obtain the pre-constructed target virtual model.
[0124] In the specific implementation step S14, the above-processed RGBA texture is pasted onto the consistent three-dimensional model of the initial virtual model to obtain the pre-constructed target virtual model. At this time, each vertex of the target virtual model has physical property information consisting of initial coordinates, material values, deformation direction mixing factor, recovery speed, and diffusion factor.
[0125] Step S102: During the collision detection process of the target virtual model, obtain the collision information corresponding to the target virtual model;
[0126] It should be noted that the collision information includes the coordinates of the collision point, i.e., the collision point coordinates P, the unit vector N of the collision force direction, the magnitude of the collision force F, and / or, the relative velocity v. rel ;
[0127] Step S103: Based on the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model, process the data to determine the total force on each vertex;
[0128] It should be noted that the physical property information includes at least the initial coordinates and the diffusion factor; the specific implementation of step S103 includes the following steps.
[0129] Step S31: For each vertex i in the target virtual model, calculate the first distance between the vertex and the collision point based on the collision information and the initial coordinates of each vertex;
[0130] In the specific implementation of step S11, firstly, the initial coordinates of the vertex are... Substituting the collision point coordinates P from the collision information into formula (1), calculate the first vector corresponding to the vertex. ;
[0131] Wherein, the first vector It refers to the vector pointing from the point of collision to vertex i, which is the direction of force transmission.
[0132] Next, the first vector Substituting into formula (2) for calculation, the distance between the vertex and the collision point is obtained, which is the first distance. .
[0133] Formula (1):
[0134]
[0135] Formula (2):
[0136]
[0137] in, The first distance, i.e., the Euclidean distance from the vertex to the point of collision, is the basis for force attenuation.
[0138] Step S32: Based on the preset maximum influence radius Preset force influence coefficient The collision information includes the magnitude of the collision force F and the diffusion factor of vertex i. Calculate the influence radius of vertex i. ;
[0139] Specifically, firstly, the maximum influence radius is preset. Preset force influence coefficient Substituting the magnitude of the collision force F from the collision information into formula (3), calculate the global basic influence radius. ;
[0140]
[0141] in, This refers to the global basic influence radius, the maximum range of force energy influence without considering material differences. It cannot exceed R_max, nor can it increase indefinitely with F.
[0142] Next, the diffusion factor of vertex i will be obtained in advance. and global basic influence radius Substituting into formula (4), the local influence radius of vertex i is calculated. ;
[0143] Formula (4):
[0144]
[0145] in, The local influence radius of vertex i is the actual range of influence felt by the vertex after considering the material's conduction properties.
[0146] Finally, the radius of local influence and global basic influence radius Determine the radius of influence of vertex i As shown in formula (5).
[0147] Formula (5):
[0148]
[0149] The diffusion factor of vertex i is obtained in advance. It is obtained by applying the corresponding texture to the A channel of RGBA, and its value is a grayscale value of [0, 1].
[0150] In this embodiment of the invention, the magnitude F of the force is converted into a spatial range, i.e., the global basic influence radius; and then the influence radius of each vertex is determined. And as can be seen from the above... The diffusion factor of vertex i itself Control is achieved by adjusting the radius of influence of each vertex based on its own diffusion factor. The larger the value, the stronger the force transmission capability and the wider the range of influence.
[0151] Step S33: Determine whether the vertex is within the influence range of the collision detection based on the first distance and the influence radius. If not, proceed to step S34; if so, proceed to step S35.
[0152] In the specific implementation step S33, the distance between the vertex and the collision point is compared. That is, the first distance and the radius of influence of vertex i. The size of the distance between the vertex and the collision point. The radius of influence of vertex i is greater than the radius of influence of vertex i. If the vertex is unaffected, proceed to step S34; otherwise, proceed to step S35.
[0153] Step S34: Determine that the coordinates of vertex i remain unchanged;
[0154] In the specific implementation of step S34, it is explained that the vertex was not affected by the collision, and the process returns to step S31 to process the next vertex.
[0155] Step S35: Determine the direct force acting on the vertex based on the first distance, the radius of influence, and the collision force in the collision information;
[0156] It should be noted that the specific implementation of step S35 includes the following steps.
[0157] Step S41: Calculate the influence radius of vertex i. and preset zero constant The sum of these values yields the first value.
[0158] Step S42: Based on the first distance and the first value, process the data to determine the distance decay factor of the vertex. ;
[0159] In the specific implementation of steps S41 and S42, the influence radius of vertex i is first calculated. and prevention of zero constant The sum is used to obtain the first value; then the distance between its vertex and the collision point is calculated. Substituting into formula (6), the distance decay factor of the vertex is obtained. ;
[0160]
[0161] in, The value of 2 indicates squared decay, simulating the natural decay of a physical field, with a preset division constant of zero. It is preset.
[0162] This application can simulate the phenomenon of force attenuation with distance, with the effect being greater the closer the distance.
[0163] Step S43: Based on the distance decay factor of the vertex The collision force F is attenuated to determine the direct force acting on the vertex. .
[0164] Specifically, the distance decay factor of the vertex Substituting the magnitude of the collision force F into formula (7) for calculation, the direct force at the vertex is obtained. ;
[0165] Formula (7):
[0166]
[0167] In this application, the distance between the vertex and the collision point... If the value is 0, then the direct force at the vertex is... The distance between the vertex and the point of impact is equal to the magnitude of the collision force F, indicating that the vertex is fully subjected to the force; when the distance between the vertex and the point of impact is equal to the magnitude of the collision force F, it means that the vertex is fully subjected to the force; The radius of influence of vertex i is equal to that of vertex i. Then the direct force of the vertex A value of 0 indicates that the vertex is not subject to any force.
[0168] Step S36: Based on the direct forces of each of the other vertices adjacent to the vertex, the diffusion factor of each of the other vertices. Preset adjacency decay function Calculate the transmitted force received by vertex i;
[0169] Specifically, the direct force applied to each vertex j adjacent to vertex i. 1. Obtain the diffusion factor of vertex j in advance. Preset adjacency decay function Substituting into formula (8) for calculation, the transmitted force received by vertex i is obtained. .
[0170] Formula (8):
[0171]
[0172] in, N(i) refers to all adjacent vertices of vertex i, with a pre-defined adjacency decay function. It is preset and refers to the attenuation of force when it is transmitted between adjacent vertices.
[0173] In this embodiment of the invention, the diffusion factor of each adjacent vertex j The larger the value, the more force is transmitted from vertex j, that is, the more force is received by vertex i. The larger it gets, the bigger it becomes.
[0174] Step S37: Determine the total force on the vertex based on the direct force acting on the vertex and the transmitted force received by the vertex i.
[0175] Specifically, the transmitted force received by vertex i The direct force of the vertex and the preset conduction coefficient Substituting into formula (9) for calculation, the total force on vertex i is obtained. ;
[0176] Formula (9):
[0177]
[0178] Preset conductivity coefficient It was pre-set based on multiple experiments.
[0179] Step S104: Determine the displacement direction of each vertex based on the physical attribute information of each vertex of the target virtual model, the collision information, the preset maximum compliance coefficient, and the preset safety coefficient;
[0180] The physical property information includes at least the deformation direction mixing factor and material value; the specific implementation of step S104 includes the following steps.
[0181] Step S51: Based on the physical attribute information of each vertex of the target virtual model and the preset maximum flexibility coefficient... The maximum displacement of each vertex is determined by a preset safety factor. ;
[0182] It should be noted that the specific implementation of step S51 includes the following steps.
[0183] Step S61: For each vertex, according to the preset maximum compliance coefficient The vertex flexibility of vertex i is calculated using the material values of vertex i.
[0184] Specifically, for each vertex, firstly, based on the preset maximum flexibility coefficient... Material values in physical property information Calculate the vertex flexibility of the vertex. As shown in formula (10).
[0185] Formula (10):
[0186]
[0187] Among them, vertex flexibility It represents the displacement of vertex i under a unit force;
[0188] For example: It is 0.8. The value is 0.1. Substituting this value into formula (10), we obtain the vertex flexibility of the vertex. It is 0.08, meaning the vertex flexibility is... This means that every 1N of force produces 0.08 units of displacement.
[0189] Preset maximum compliance coefficient Its function is to transfer units without units Converted into physically meaningful flexibility.
[0190] Step S62: Adjust the vertex flexibility of the vertex based on a preset safety factor. Determine the maximum displacement of the vertex.
[0191] Specifically, the vertex flexibility of the vertex... Substituting the preset safety factor C into formula (11) determines the maximum displacement of the vertex. ;
[0192] Formula (11):
[0193]
[0194] Wherein, the maximum displacement of the vertex This indicates the maximum displacement limit of the vertices, preventing excessive deformation from causing the mesh to break.
[0195] The preset safety factor C can be 1.0-2.0, and is set in advance.
[0196] Step S52: Based on the first distance of the vertex The collision information includes the collision point coordinates P and the collision force direction unit vector N, as well as the deformation direction mixing factor of the physical attribute information. Determine the blending direction vector of the vertex;
[0197] It should be noted that the specific implementation of step S52 includes the following steps:
[0198] Step S71: Determine the first distance Is it greater than 0? If so, determine the first distance. If the distance is greater than 0, then proceed to step S72. If the first distance is determined... If the value is 0, then proceed to step S73.
[0199] Step S72: Based on the first distance and the first vector Determine the unit radial vector of the vertex. .
[0200] Wherein, the first vector is the initial coordinate of the vertex. The initial coordinates of the vertex are determined by the collision point coordinates P in the collision information. Substituting the collision point coordinates P from the collision information into formula (1), calculate the first vector corresponding to the vertex.
[0201] In the specific implementation step S72, the first vector corresponding to the vertex is calculated. Distance from the first The ratio, and take it as the unit radial vector. As shown in formula (12);
[0202] Formula (12):
[0203]
[0204] Step S73: Use the unit vector N of the collision force direction as the unit radial vector of the vertex. .
[0205] Step S74: Convert the collision force direction unit vector N and the unit radial vector... The deformation direction mixing factor Perform linear interpolation to obtain the blending direction vector of the vertex. ;
[0206] In the specific implementation step S74, the unit radial vector is first calculated. Preset deformation direction mixing factor The product; then, the product and the deformation direction mixing factor. And by substituting the collision force direction unit vector N into formula (13) to calculate the mixed direction vector of the vertex. .
[0207] Formula (13):
[0208]
[0209] Among them, the deformation direction mixing factor This is used to simulate the indentation and expansion effects of different regions after being subjected to force; the texture of this vertex is applied to the B channel of RGBA.
[0210] It should be noted that, When the value is 0, the direction of vertex deformation is entirely along the direction of the collision normal (concave effect).
[0211] When the value is 1, the direction of vertex deformation is entirely along the radial direction (expansion effect).
[0212] A value greater than 0 and less than 1 indicates that the vertex is in a mixture of two directions;
[0213] Step S53: Based on the blending direction vector of the vertex Determine the displacement direction of the vertex. .
[0214] Specifically, the blending direction vector of the vertex Substituting into formula (14) for calculation, the displacement direction of the vertex is obtained. .
[0215] Formula (14):
[0216]
[0217] For example: the collision point P is at the origin, and N points downwards (-Z);
[0218] The vertex is at (1,0,0). Move right (+X);
[0219] When = 0.0, substitute into formulas (13) and (14) to determine the direction of the vertex displacement. The actual effect of moving from (1,0,0) to (0,0,-1) is that the vertex is concave downwards.
[0220] When = 0.5, substitute into formulas (13) and (14) to determine the direction of the vertex displacement. Moving the vertex from (1,0,0) to (0.707,0,-0.707) will actually move the vertex 45 degrees to the lower right.
[0221] When = 1.0, substitute into formulas (13) and (14) to determine the direction of the vertex displacement. The actual effect of moving from (1,0,0) to (1,0,0) is that the vertex expands to the right.
[0222] Step S105: For each vertex, based on the physical property information, the total force on the vertex and the displacement direction of the vertex, process to determine the target position and the maximum deformation position of each vertex;
[0223] It should be noted that the specific implementation of step S105 includes the following steps.
[0224] Step S81: For each vertex, based on the vertex flexibility of the vertex... and the total force on the vertex. Determine the actual displacement of the vertex;
[0225] Wherein, the vertex flexibility It is determined based on the preset maximum compliance coefficient and the material value of vertex i;
[0226] It should be noted that the vertex compliance is determined based on the preset maximum compliance coefficient and the material value of vertex i. The process is shown in step S61.
[0227] Specifically, firstly, the vertex flexibility of the vertex is... and the total force on the vertex. Substituting into formula (15) for calculation, the initial displacement of the vertex is obtained. ;
[0228] Formula (15):
[0229]
[0230] Next, the initial displacement of the vertex is... and the maximum displacement of the vertex The minimum value is taken as the actual displacement of the vertex. As described in formula (16).
[0231] Formula (16):
[0232]
[0233] Step S82: Based on the initial coordinates of the vertex The actual displacement of the vertex and the displacement direction of the vertex Calculate the position of maximum deformation of the vertex;
[0234] Specifically, the actual displacement of the vertex and the displacement direction of the vertex Substituting into formula (17), the displacement vector of the vertex is obtained. ;
[0235] Formula (17):
[0236]
[0237] Next, based on the initial coordinates of the vertex and the displacement vector of the vertex Determine the location of maximum deformation immediately after the collision. As shown in formula (18).
[0238] Formula (18):
[0239]
[0240] Step S83: Determine the degree of restoration of the vertex based on its material value;
[0241] Specifically, if the material value of the vertex It is a rigid material, and its degree of recovery is... 0; if the material value of the vertex is 0; For elastic vertices, the degree of recovery If the material value of the vertex is... The plastic vertex represents the degree of recovery. and Proportional;
[0242] In other words, If the material type of the vertex is rigid, the value is 0, indicating no deformation occurs and the degree of restoration is [value missing]. Set to 0; If the value is greater than 0.5, and the material type of the vertex is elastic, it indicates that it should be fully restored; therefore, the degree of restoration is... Set to 1; Recovery occurs when the value is greater than 0 and less than or equal to 0.5; the degree of recovery... and Proportional.
[0243] Among them, when When =0.25, =0.5 means that half has been restored.
[0244] For example: Suppose the vertices are made of two materials, clay (plastic) and rubber band (elastic), the material value of the clay... =0.3, degree of recovery =0.6 indicates that it can recover 60% of the deformation and retain 40% of the permanent deformation; the material value of the rubber band. =0.8, degree of recovery =1 indicates complete recovery; material value =0, recovery level =0 indicates no deformation.
[0245] Step S83: Based on the actual displacement of the vertex, the displacement direction of the vertex, and the degree of recovery corresponding to the vertex. Determine the target displacement vector. ;
[0246] Specifically, firstly, the actual displacement of the vertex... and the displacement direction of the vertex Substituting into formula (17), the displacement vector of the vertex is obtained. ;
[0247] Next, the degree of recovery will be... and the displacement vector of the vertex Substituting into formula (19) for calculation, the target displacement vector is obtained. That is, the permanent displacement vector.
[0248] Formula (19):
[0249]
[0250] Step S84: Based on the initial coordinates of the vertex and target displacement vector Processing is performed to obtain the target location. .
[0251] Specifically, if the target position of vertex i is the final position... It is equal to its initial position, i.e., coordinates , coordinate Add the accumulated permanent deformation displacement vector, i.e., the target displacement vector. Target location obtained As shown in formula (20).
[0252] Formula (20):
[0253]
[0254] For example: Vertex i is a rigid vertex. = This indicates that the vertex has no displacement;
[0255] Vertex i is an elastic vertex. = This indicates that the vertex has been fully restored;
[0256] Vertex i is a plastic vertex. = This indicates that the vertex portion has been restored.
[0257] Step S106: Based on the target position of each vertex Location of maximum deformation The physical attribute information is used to perform collision recovery on the target virtual model.
[0258] In the specific implementation of step S106, when it is determined that the current target virtual model has lost external force, the target virtual model will recover. At this time, each vertex that has deformed will move from its maximum deformation position. Restore to target location The recovery speed is determined by the recovery speed factor of the physical property information. Control is used to interpolate and calculate the coordinates of each vertex as it changes over time t in real time, i.e., to restore its position, until the coordinates of the vertex as it changes over time t are determined, i.e., the restored position at the current time t. Equal to the target position .
[0259] Specifically, firstly, the recovery rate factor is calculated. and preset maximum recovery speed The product of these two factors yields the corresponding recovery speed. As shown in formula (21);
[0260] Formula (21):
[0261]
[0262] Next, the current time t and recovery speed are... Target location Location of maximum deformation Substitute into formula (22) to calculate the recovery position at the current time t. .
[0263] Formula (22):
[0264]
[0265] Where t is the real-time time calculated from the start of the collision;
[0266] In this embodiment of the invention, all physical properties of each vertex in the target virtual model are uniformly controlled through the four RGBA channels, allowing different physical properties to be set for different regions on the same model. This creates a highly customizable, advanced hybrid physics model based on vertex physical properties. Compared to the strict separation of rigid and soft bodies in traditional physics engines, this allows for complex local deformation behavior on the same model. During collision detection of the target virtual model, collision information corresponding to the target virtual model is acquired. The target position and maximum deformation position of each vertex are determined based on the collision information and the physical properties of each vertex. Collision recovery is then performed based on the target position and maximum deformation position of each vertex, thus providing a precise and controllable deformation recovery mechanism.
[0267] Based on the virtual model force simulation method shown in the above embodiments of the present invention, correspondingly, the present invention provides a structural schematic diagram of a virtual model force simulation device, as shown below. Figure 3 As shown, the device includes:
[0268] Extraction unit 301 is used to extract the physical attribute information of each vertex in the pre-built target virtual model;
[0269] The acquisition unit 302 is used to acquire collision information corresponding to the target virtual model during the collision detection process of the target virtual model;
[0270] The processing unit 303 is configured to process the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model to determine the total force on each vertex; determine the displacement direction of each vertex based on the physical attribute information of each vertex of the target virtual model, the collision information, a preset maximum flexibility coefficient, and a preset safety coefficient; and for each vertex, process the physical attribute information, the total force on the vertex, and the displacement direction of the vertex to determine the target position and the maximum deformation position of each vertex.
[0271] The recovery unit 304 is used to perform collision recovery on the target virtual model based on the target position, maximum deformation position and physical attribute information of each vertex.
[0272] The specific principles and execution processes of each unit in the virtual model force simulation device disclosed in the above embodiments of the present invention are the same as the corresponding contents in the virtual model force simulation method provided in the above embodiments of the present invention. Please refer to the corresponding parts in the virtual model force simulation method disclosed in the above embodiments of the present invention, and they will not be repeated here.
[0273] Optionally, based on the virtual model force simulation device shown in the embodiments of the present invention, the pre-constructed target virtual model determination unit 301 is specifically used for:
[0274] Obtain an initial virtual model, which is a model for setting multi-dimensional model data;
[0275] Based on the stress performance data of different regions in the initial virtual model, set the material value and deformation direction blending factor of each vertex, and map the material value and deformation direction blending factor to the RGBA map according to the initial coordinates of the vertex. The RGBA map is constructed based on the initial coordinates of each vertex, and the initial coordinates of the vertex are the two-dimensional texture mapping coordinates of the vertex.
[0276] The corresponding recovery rate factor and diffusion factor are determined based on the material value of each vertex, and the recovery rate factor and diffusion factor are mapped to the RGBA texture according to the initial coordinates of the vertex.
[0277] The RGBA texture is pasted onto the 3D model to obtain the pre-constructed target virtual model.
[0278] Optionally, in the virtual model force simulation device shown in the embodiments of the present invention, the physical attribute information includes at least initial coordinates and diffusion factor; the processing unit 303, which processes the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model to determine the total force on each vertex, is specifically used for:
[0279] For each vertex i in the target virtual model, calculate the first distance between the vertex and the collision point based on the collision information and the initial coordinates of each vertex;
[0280] Based on the preset maximum influence radius Preset force influence coefficient The collision information includes the magnitude of the collision force F and the diffusion factor of vertex i. Calculate the influence radius of vertex i. ;
[0281] If the vertex is determined to be within the influence range of the collision detection based on the first distance and the influence radius, the direct force acting on the vertex is determined based on the first distance, the influence radius, and the collision force in the collision information;
[0282] Based on the direct forces between the vertex and each of the other adjacent vertices, the diffusion factor of each of the other vertices. Preset adjacency decay function Calculate the transmitted force received by vertex i;
[0283] The total force acting on the vertex is determined based on the direct force acting on the vertex and the transmitted force received by the vertex i.
[0284] Optionally, based on the virtual model force simulation device shown in the embodiments of the present invention, the processing unit 303 for determining the direct force of the vertex based on the first distance, the radius of influence, and the collision force in the collision information is specifically used for:
[0285] Calculate the influence radius of vertex i. and preset zero constant The sum of these values yields the first value.
[0286] Based on the first distance and the first numerical value, the distance decay factor of the vertex is determined. ;
[0287] The collision force is attenuated based on the distance attenuation factor of the vertex to determine the direct force acting on the vertex.
[0288] Optionally, in the virtual model stress simulation device shown in the embodiments of the present invention, the physical property information includes at least a deformation direction mixing factor and a material value; the processing unit 303, which determines the displacement direction of each vertex based on the physical property information of each vertex of the target virtual model, the collision information, the preset maximum compliance coefficient, and the preset safety factor, is specifically used for:
[0289] The maximum displacement of each vertex is determined based on the physical attribute information of each vertex of the target virtual model, the preset maximum flexibility coefficient, and the preset safety coefficient.
[0290] The mixing direction vector of the vertex is determined based on the first distance of the vertex, the coordinates of the collision point and the unit vector of the collision force direction in the collision information, and the deformation direction mixing factor of the physical property information.
[0291] Based on the hybrid direction vector of the vertex Determine the displacement direction of the vertex. .
[0292] Optionally, based on the virtual model force simulation device shown in this embodiment of the invention, the processing unit 303, which determines the maximum displacement of each vertex according to the physical attribute information of each vertex of the target virtual model, the preset maximum compliance coefficient, and the preset safety factor, is specifically used for:
[0293] For each vertex, the vertex flexibility is calculated based on the preset maximum flexibility coefficient and the material value of the vertex;
[0294] The vertex flexibility of the vertex is adjusted based on a preset safety factor. Determine the maximum displacement of the vertex.
[0295] Optionally, based on the virtual model force simulation device shown in this embodiment of the invention, the processing unit 303 that determines the mixed direction vector of the vertex based on the first distance of the vertex, the collision point coordinates and the collision force direction unit vector in the collision information, and the deformation direction mixing factor of the physical attribute information, is specifically used for:
[0296] Determine whether the first distance is greater than 0;
[0297] If the distance is greater than the first distance, the unit radial vector of the vertex is determined based on the first distance and the first vector, where the first vector is the initial coordinate of the vertex. The collision point coordinates P are determined from the collision information.
[0298] If equal, the unit vector N of the collision force direction in the collision information is taken as the unit radial vector of the vertex;
[0299] The unit vector of the collision force direction, the unit radial vector, and the deformation direction mixing factor are linearly interpolated to obtain the mixing direction vector of the vertex.
[0300] Optionally, in the virtual model force simulation device shown in the embodiments of the present invention, the physical attribute information includes at least initial coordinates and material values. A processing unit 303, which processes the physical attribute information, the total force acting on the vertex, and the displacement direction of the vertex to determine the target position and maximum deformation position of each vertex, is specifically used for:
[0301] For each vertex, the actual displacement of the vertex is determined based on the vertex compliance and the total force acting on the vertex. The vertex compliance is determined based on a preset maximum compliance coefficient and the material value of the vertex.
[0302] The maximum deformation position of the vertex is calculated based on the initial coordinates of the vertex, the actual displacement of the vertex, and the displacement direction of the vertex.
[0303] The degree of restoration of a vertex is determined based on its material value.
[0304] The target displacement vector is determined based on the actual displacement of the vertex, the displacement direction of the vertex, and the degree of recovery corresponding to the vertex.
[0305] The target position is obtained by processing the initial coordinates of the vertex and the target displacement vector.
[0306] This application provides an electronic device, which includes a processor and a memory. The memory is used to store program code and data for simulating the force of a virtual model, and the processor is used to call the program instructions in the memory to execute the steps shown in the virtual model force simulation method in the above embodiments.
[0307] This invention provides a storage medium, namely a computer-readable storage medium, which includes the electronic device provided in the above-described embodiments of this application. The electronic device is used to execute the virtual model force simulation method disclosed in the embodiments of this application.
[0308] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0309] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0310] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for simulating the force on a virtual model, characterized in that, The method includes: Extract the physical attribute information of each vertex in the pre-built target virtual model; During the collision detection process of the target virtual model, the collision information corresponding to the target virtual model is acquired; Based on the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model, the total force on each vertex is determined. The displacement direction of each vertex is determined based on the physical attribute information of each vertex in the target virtual model, the collision information, the preset maximum flexibility coefficient, and the preset safety coefficient. For each vertex, the target position and the position of maximum deformation of each vertex are determined by processing based on the physical property information, the total force on the vertex and the displacement direction of the vertex. Collision recovery is performed on the target virtual model based on the target position, maximum deformation position, and physical attribute information of each vertex.
2. The method according to claim 1, characterized in that, The process of pre-constructing a target virtual model includes: Obtain an initial virtual model, which is a model for setting multi-dimensional model data; Based on the stress performance data of different regions in the initial virtual model, set the material value and deformation direction blending factor of each vertex, and map the material value and deformation direction blending factor to the RGBA map according to the initial coordinates of the vertex. The RGBA map is constructed based on the initial coordinates of each vertex, and the initial coordinates of the vertex are the two-dimensional texture mapping coordinates of the vertex. The corresponding recovery rate factor and diffusion factor are determined based on the material value of each vertex, and the recovery rate factor and diffusion factor are mapped to the RGBA texture according to the initial coordinates of the vertex. The RGBA texture is pasted onto the 3D model to obtain the pre-constructed target virtual model.
3. The method according to claim 1, characterized in that, The physical attribute information includes at least initial coordinates and a diffusion factor; based on the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model, the total force on each vertex is determined, including: For each vertex in the target virtual model, the first distance between the vertex and the collision point is calculated based on the collision information and the initial coordinates of each vertex; The influence radius of the vertex is calculated based on the preset maximum influence radius, the preset force influence coefficient, the magnitude of the collision force in the collision information, and the diffusion factor of the vertex. If the vertex is determined to be within the influence range of the collision detection based on the first distance and the influence radius, the direct force acting on the vertex is determined based on the first distance, the influence radius, and the collision force in the collision information; The transmitted force received by the vertex is calculated based on the direct force of each other vertex adjacent to the vertex, the diffusion factor of each other vertex, and a preset adjacency attenuation function. The total force acting on the vertex is determined based on the direct force acting on the vertex and the transmitted force received by the vertex.
4. The method according to claim 3, characterized in that, The direct force acting on the vertex is determined based on the first distance, the radius of influence, and the collision force in the collision information, including: The sum of the influence radius of the vertex and the preset zero constant is calculated to obtain the first value; Based on the first distance and the first value, the distance decay factor of the vertex is determined. The collision force is attenuated based on the distance attenuation factor of the vertex to determine the direct force acting on the vertex.
5. The method according to claim 1, characterized in that, The physical property information includes at least a deformation direction mixing factor and material values; the displacement direction of each vertex is determined based on the physical property information of each vertex of the target virtual model, the collision information, the preset maximum compliance coefficient, and the preset safety factor, including: The maximum displacement of each vertex is determined based on the physical attribute information of each vertex of the target virtual model, the preset maximum flexibility coefficient, and the preset safety coefficient. The mixing direction vector of the vertex is determined based on the first distance of the vertex, the coordinates of the collision point and the unit vector of the collision force direction in the collision information, and the deformation direction mixing factor of the physical property information. The displacement direction of the vertex is determined based on the hybrid direction vector of the vertex.
6. The method according to claim 5, characterized in that, The maximum displacement of each vertex is determined based on the physical attribute information of each vertex of the target virtual model, the preset maximum compliance coefficient, and the preset safety coefficient, including: For each vertex, the vertex flexibility is calculated based on the preset maximum flexibility coefficient and the material value of the vertex; The maximum displacement of a vertex is determined by adjusting the vertex flexibility based on a preset safety factor.
7. The method according to claim 5, characterized in that, The mixing direction vector of the vertex is determined based on the first distance of the vertex, the collision point coordinates and the unit vector of the collision force direction in the collision information, and the deformation direction mixing factor of the physical property information, including: Determine whether the first distance is greater than 0; If it is greater than the first distance and the first vector, the unit radial vector of the vertex is determined based on the first distance and the first vector, wherein the first vector is determined by the initial coordinates of the vertex and the coordinates of the collision point in the collision information; If equal, the unit vector of the collision force direction in the collision information is taken as the unit radial vector of the vertex; The unit vector of the collision force direction, the unit radial vector, and the deformation direction mixing factor are linearly interpolated to obtain the mixing direction vector of the vertex.
8. The method according to claim 1, characterized in that, The physical property information includes at least initial coordinates and material values. Based on the physical property information, the total force acting on the vertex, and the displacement direction of the vertex, the target position and maximum deformation position of each vertex are determined, including: For each vertex, the actual displacement of the vertex is determined based on the vertex compliance and the total force acting on the vertex. The vertex compliance is determined based on a preset maximum compliance coefficient and the material value of the vertex. The maximum deformation position of the vertex is calculated based on the initial coordinates of the vertex, the actual displacement of the vertex, and the displacement direction of the vertex. The degree of restoration of a vertex is determined based on its material value. The target displacement vector is determined based on the actual displacement of the vertex, the displacement direction of the vertex, and the degree of recovery corresponding to the vertex. The target position is obtained by processing the initial coordinates of the vertex and the target displacement vector.
9. A virtual model force simulation device, characterized in that, The device includes: The extraction unit is used to extract the physical attribute information of each vertex in the pre-built target virtual model; The acquisition unit is used to acquire collision information corresponding to the target virtual model during the collision detection process of the target virtual model; The processing unit is configured to process the collision information corresponding to the target virtual model and the physical attribute information of each vertex of the target virtual model to determine the total force on each vertex; determine the displacement direction of each vertex based on the physical attribute information of each vertex of the target virtual model, the collision information, a preset maximum compliance coefficient, and a preset safety coefficient; and, for each vertex, process the physical attribute information, the total force on the vertex, and the displacement direction of the vertex to determine the target position and the maximum deformation position of each vertex. The recovery unit is used to perform collision recovery on the target virtual model based on the target position, maximum deformation position and physical attribute information of each vertex.
10. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory being used to store program code and data for data generation, and the processor being used to call program instructions in the memory to execute the virtual model force simulation method as described in any one of claims 1-8.