CN116510295A - Data processing method, device, equipment and storage medium - Google Patents

Data processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN116510295A
CN116510295A CN202310798206.2A CN202310798206A CN116510295A CN 116510295 A CN116510295 A CN 116510295A CN 202310798206 A CN202310798206 A CN 202310798206A CN 116510295 A CN116510295 A CN 116510295A
Authority
CN
China
Prior art keywords
collision
virtual
virtual element
current moment
particle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310798206.2A
Other languages
Chinese (zh)
Other versions
CN116510295B (en
Inventor
李垚
杨双才
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202310798206.2A priority Critical patent/CN116510295B/en
Publication of CN116510295A publication Critical patent/CN116510295A/en
Application granted granted Critical
Publication of CN116510295B publication Critical patent/CN116510295B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/57Simulating properties, behaviour or motion of objects in the game world, e.g. computing tyre load in a car race game
    • A63F13/577Simulating properties, behaviour or motion of objects in the game world, e.g. computing tyre load in a car race game using determination of contact between game characters or objects, e.g. to avoid collision between virtual racing cars
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/60Methods for processing data by generating or executing the game program
    • A63F2300/66Methods for processing data by generating or executing the game program for rendering three dimensional images
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T90/00Enabling technologies or technologies with a potential or indirect contribution to GHG emissions mitigation

Abstract

The application discloses a data processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: in the process of running the virtual scene, obtaining an element model of a virtual element in the virtual scene, wherein the virtual element is an element supporting deformation in the motion process, and the element model comprises: the method comprises the steps that when the form of a virtual element at the current moment is subjected to physical simulation, information is needed; according to the information in the element model, performing physical simulation on the form of the virtual element at the current moment to obtain simulated form data; based on the simulated morphological data, detecting the collision condition of the virtual element at the current moment in the virtual scene to obtain a collision detection result; calibrating the simulated form data according to the collision detection result to obtain target form data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment. Through the application, the display effect of the virtual element can be improved.

Description

Data processing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a data processing method, apparatus, device, and storage medium.
Background
With the development of computer technology, more and more technical support adds some special virtual elements into a virtual scene so as to enrich the scene content of the virtual scene; these special virtual elements refer to elements that support deformation during movement, such as clothing, hair of a virtual character in a game scene, or curtains, canvas, etc. in a virtual scene. At present, how to render and display these special virtual elements to improve the display effect of the virtual elements becomes a research hot spot.
Disclosure of Invention
The embodiment of the application provides a data processing method, a device, equipment and a storage medium, which can improve the display effect of virtual elements.
In one aspect, an embodiment of the present application provides a data processing method, where the method includes:
in the process of running a virtual scene, obtaining an element model of a virtual element in the virtual scene, wherein the virtual element is an element supporting deformation in the motion process, and the element model comprises: the information required when the form of the virtual element at the current moment is subjected to physical simulation;
according to the information in the element model, performing physical simulation on the form of the virtual element at the current moment to obtain simulated form data;
Based on the simulated morphological data, detecting the collision condition of the virtual element at the current moment in the virtual scene to obtain a collision detection result;
calibrating the simulated morphological data according to the collision detection result to obtain target morphological data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment.
In another aspect, an embodiment of the present application provides a data processing apparatus, including:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring an element model of a virtual element in a virtual scene in the process of running the virtual scene, the virtual element is an element supporting deformation in the motion process, and the element model comprises: the information required when the form of the virtual element at the current moment is subjected to physical simulation;
the processing unit is used for carrying out physical simulation on the form of the virtual element at the current moment according to the information in the element model to obtain simulated form data;
the processing unit is further used for detecting the collision condition of the virtual element at the current moment in the virtual scene based on the simulated morphological data to obtain a collision detection result;
The processing unit is further used for calibrating the simulated form data according to the collision detection result to obtain target form data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment.
In yet another aspect, embodiments of the present application provide a computer device including an input interface and an output interface, the computer device further including: a processor and a computer storage medium;
wherein the processor is adapted to implement one or more instructions and the computer storage medium stores one or more instructions adapted to be loaded by the processor and to perform the data processing method mentioned above.
In yet another aspect, embodiments of the present application provide a computer storage medium storing one or more instructions adapted to be loaded by a processor and to perform the above-mentioned data processing method.
In yet another aspect, embodiments of the present application provide a computer program product comprising a computer program; the computer program, when being executed by a processor, implements the data processing method mentioned above.
According to the embodiment of the application, the physical characteristics of the virtual element in the virtual scene can be simulated by performing physical simulation on the form of the virtual element at the current moment based on the comprehensive information required by the physical simulation included by the element model in the process of running the virtual scene, so that more accurate form data is obtained, the form of the virtual element which is exhibited when moving in the virtual scene is beneficial to approaching to the real world, the virtual element has more realistic simulation effect, and the display effect of the virtual element is further improved. Furthermore, the simulated form data is used as a detection basis for collision detection, the obtained collision detection result can reflect various collision conditions of the virtual element more comprehensively and accurately, and the simulated form data can be calibrated more accurately according to the collision detection result, so that more real and accurate target form data can be obtained. Compared with the simulated morphological data, the target morphological data can be more accurate morphological data, the virtual element is rendered and displayed by adopting the target morphological data at the current moment, and when no collision exists or a collision condition which does not influence the collision effect exists, the virtual element which is more true and close to the real world can be rendered and displayed based on the target morphological data with higher accuracy, so that the virtual element has a better display effect; when the collision condition affecting the collision effect exists, the repair of the collision condition can be realized based on the calibration of the simulated morphological data, so that the better collision effect can be ensured, the collision effect is controllable, and the display effect of the virtual element is further improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a block diagram of a data processing system according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a data processing method according to an embodiment of the present application;
fig. 3a is a schematic diagram of an effect of cloth simulation according to an embodiment of the present application;
FIG. 3b is a schematic diagram illustrating the effect of another cloth simulation according to an embodiment of the present disclosure;
FIG. 3c is a schematic diagram illustrating the effect of yet another cloth simulation provided by embodiments of the present application;
FIG. 4 is a flow chart of a data processing method according to another embodiment of the present application;
FIG. 5a is a schematic illustration of the effect of a remote attachment constraint provided by an embodiment of the present application;
FIG. 5b is a schematic diagram of a connection mode under a textile algorithm according to an embodiment of the present application;
fig. 6a is a schematic diagram of collision between a virtual character and a cloth according to an embodiment of the present application;
FIG. 6b is a schematic diagram showing an enlarged view of the impact effect provided by the embodiment of the present application;
FIG. 7a is a schematic view of a cloth impinging on a sphere of the ground according to an embodiment of the present application;
fig. 7b is a schematic view of an interaction effect between a cloth and a collision body according to an embodiment of the present disclosure;
fig. 7c is a schematic view illustrating an effect of a fabric colliding with a collision body according to an embodiment of the present disclosure;
FIG. 7d is a schematic view illustrating an effect of another cloth colliding with a colliding body according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a data processing apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
The embodiment of the application provides a data processing method. The data processing method can simulate the form of the virtual element at the current moment through the element model of the virtual element in the process of running the virtual scene, calibrate the simulated form data through detecting the collision condition of the virtual element at the current moment, and further render and display the virtual element so as to present the form of the virtual element in the virtual scene at the current moment.
In the embodiment of the present application, a virtual scene may be understood as a scene displayed in a device screen. The virtual scene can be a visual and interactive virtual environment constructed by adopting tools such as computer technology, modeling software and the like. Specifically, the virtual scene may be a scene obtained by simulating a scene in the real world, for example, a scene obtained by simulating an autopilot scene or a scenic spot play scene in the real world; alternatively, the virtual scene may be a semi-simulated semi-fictional scene, for example, a scene in which fictional characters are superimposed in a simulated world corresponding to the real world; still alternatively, the virtual scene may also be a purely fictional scene, such as a game scene, a scene in a movie or movie, and so on.
The virtual scene may include at least one virtual element, which in the embodiment of the present application refers to an element that supports deformation in a motion process. For example: cloth, sponge, rubber, rope, etc. in the virtual scene are easily deformed elements. The morphology of the virtual element may change as it moves within the virtual scene or may be deformed by collisions between other objects and it. For example: the clothing of the virtual game character in the game scene may change in position and shape as the virtual game character moves, for example: the flags in the game scene fly under the action of wind power. Elements of the virtual scene other than the virtual element may be referred to as reference elements, which are objects that support collisions with the virtual element, and may also be referred to as collimators. Any reference element may be a static object element in the virtual scene, such as a virtual lawn, a virtual building, or a movable object in the virtual scene, such as a virtual character in the game scene, a virtual animal in the game scene, etc. It should be appreciated that a virtual element may collide with at least one collision volume at a time, for example: when the virtual character moves in the game scene, clothes worn by the virtual character collide not only with the virtual character but also with the virtual plant in the game scene. The virtual element may collide with different reference elements at different times, for example: clothes worn by the virtual character collide with only the virtual character at the present moment, but collide with not only the virtual character but also the ground in the game scene at the next moment.
In running the virtual scene, simulation of the virtual element may be achieved by means of an element model of the virtual element. The element model is a model describing the physical characteristics of a virtual element. Among these, physical properties include mechanical properties such as elasticity, rigidity, friction, and the like. Motion and behavior of virtual elements in a virtual scene may be simulated based on an element model, for example: the deformation and the position change of the cloth in the virtual scene along with the movement of the virtual character can be simulated based on the cloth model. The current time refers to a time when physical simulation is performed, and may be a time corresponding to any one of the scene images of the virtual scene, or may be any time between any two of the scene images.
Based on the above definition, the principle of the data processing method according to the embodiments of the present application will be described, and specifically, the general principle of the method is as follows: in the process of running the virtual scene, firstly, an element model of the virtual element can be obtained, and the physical simulation of the form of the virtual element at the current moment is carried out according to information required by the physical simulation of the form of the virtual element in the element model. Because the information contained in the element model in the simulation process is more comprehensive information, the form of the virtual element can be well controlled based on the information, so that the stability and the reliability of physical simulation are improved, the precision of the physical simulation is improved, the better simulation effect is achieved, and the display effect can be improved. Then, based on the simulated form data obtained by physical simulation, the collision condition of the virtual element at the current moment can be detected rapidly, and the collision detection efficiency is high. Whether the virtual element collides with other objects or collides with the virtual element at the current moment can be known through the collision detection result, and then target form data at the current moment is generated according to the collision detection result and the simulated form data and is used for rendering and displaying the virtual element. Compared with the simulated morphological data, the target morphological data is more accurate morphological data, and the morphology of the virtual element at the current moment can be more accurately depicted, so that the display effect of the virtual element is improved. Moreover, based on the target form data, the collision effect can be controlled, the collision effect is improved, and the display effect of the virtual element can be further improved.
In a specific implementation, the above mentioned method may be performed by a computer device, which may be a terminal or a server. For example, the terminal may be responsible for starting the operation of the virtual scene, and then, during the operation of the virtual scene, the terminal acquires an element model of the virtual element from the server. Simulating the form of the virtual element at the current moment according to the information in the element model, detecting the collision condition of the virtual element at the current moment, rendering and displaying the virtual element, and finally presenting the form of the virtual element at the current moment in the terminal. As shown in fig. 1. Alternatively, the above-mentioned method may be performed by a terminal and a server together; for example, the server may obtain an element model of the virtual element. Simulating the form of the virtual element at the current moment according to the information in the element model, detecting the collision condition of the virtual element at the current moment, and then sending the obtained target form data to the terminal so as to enable the terminal to render and present the virtual element.
Among them, the above-mentioned terminals may include, but are not limited to: smart phones, computers (such as tablet computers, notebook computers, desktop computers, etc.), smart wearable devices (such as smart watches, smart glasses, etc.), smart voice interaction devices, smart home appliances (such as smart televisions), vehicle terminals or aircrafts, etc.; the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network ), basic cloud computing services such as big data and artificial intelligent platform, and the like.
It should be understood that when the virtual element is a virtual cloth, the cloth physical simulation can be realized by adopting the data processing method. The virtual cloth refers to cloth in a virtual scene, and may also be simply referred to as cloth, for example, clothing, flags, canvas, etc. in a game scene. Cloth physical simulation is a computer simulation technology based on physical principles, and is used for simulating physical behaviors and movements of cloth in the real world. Through the physical simulation of the cloth, the physical characteristics of elasticity, friction, air resistance and the like of the cloth can be simulated, so that a more real cloth simulation effect is realized. In a game scene, cloth physical simulation can be used to simulate the movement and deformation of clothing, hair, canvas, etc. of a character to increase the realism and visual effect of the scene. By adopting the data processing method provided by the application, the cloth simulation precision can be improved, and meanwhile, a better cloth collision effect can be obtained, so that the cloth finally rendered and displayed is more real.
The data processing method provided by the application can be applied to various fields, including but not limited to: the fields of game development, movie production, apparel design, animation production, movie production, etc., are not limited herein. The virtual scene in the fields can be manufactured by using the data processing method of the embodiment of the application to manufacture the cloth, and the cloth with characteristics of multiple layers, large area, complex gowns, multiple folds, multiple points, strong details and the like can be manufactured by using the game development as an example, so that the simulation effect can be remarkably improved in the aspects of collision and simulation, finer cloth can be manufactured, the cloth effect in the game scene can be improved, better visual experience can be brought to users based on the improvement of the cloth effect, the user experience can be improved, and benefits are brought to game development.
Based on the above description, the embodiments of the present application provide a data processing method. The data processing method may be executed by the above-mentioned computer device (terminal or server), or may be executed by both the terminal and the server; for ease of explanation, the following description will take a computer device to execute the data processing method as an example. Referring to fig. 2, the data processing method may include the following steps S201 to S204.
S201, in the process of running the virtual scene, obtaining an element model of a virtual element in the virtual scene.
When the computer device runs the virtual scene, the virtual scene can be run in an editor (such as a cloth editor) or an application program (such as a game application program or other application programs). The process of running the virtual scene can be understood as a process of rendering and displaying each frame of scene pictures in the virtual scene.
In a specific implementation, as can be seen from the foregoing, the virtual scene includes virtual elements, and the number of virtual elements in the virtual scene is not limited in this application. For ease of understanding, a virtual element emulated in an embodiment of the present application refers to any one of at least one virtual element in a virtual scene. The virtual element includes a plurality of particles, the particles can be regarded as basic units of the virtual element, and various subsequent treatments on the virtual element specifically target the particles. Each particle may exhibit a morphology of the virtual element at a time instant based on a position in the virtual scene at that time instant. Each virtual element may correspond to an element model comprising: and the information required when the form of the virtual element at the current moment is subjected to physical simulation.
Since the process of running the virtual scene can be understood as a process of rendering each frame of scene picture of the virtual scene, each frame of scene picture in the virtual scene can correspond to one time. The current time mentioned in the application is a time for determining to perform physical simulation, and may be a time corresponding to each frame scene picture of the virtual scene, specifically may be a first time or a non-first time, where the first time refers to a time corresponding to the first frame scene picture, and the non-first time refers to a time corresponding to any frame scene picture except the first frame scene picture. In some implementations, the display interval duration between two frames of scene frames may be split for finer physical simulation, so the current time may be any time that is split between two frames of scene frames. An element model is understood to be a data carrier, which element model can be generated in advance and stored in a computer device, or can be generated in real time based on instructions for running a virtual scene. Based on the information in the element model, physical simulation, collision detection, rendering display and the like of the corresponding virtual element can be performed, so that simulation of the virtual element in the virtual scene is realized, wherein the simulation comprises simulation of deformation of the virtual element under corresponding acting force, which occurs under the action of the corresponding acting force, for example: one flag is swung by wind force, and one cloth is swung by gravity. Through the simulation, the motion of the virtual element in the virtual scene is more vivid and lifelike, and a better visual effect can be brought.
In a specific implementation, when executing step S201, the computer device may directly load the constructed element model into the element editor, and then respond to the simulation instruction in the element editor, so as to run the virtual scene, and acquire the information in the element model to perform physical simulation. The computer device may also: the virtual element is loaded into an element editor (such as a cloth editor) first, and the loaded virtual element contains pre-configured form data configured after the virtual element is gridded, including but not limited to: the initial position and initial velocity at which each particle in the virtual element is located in the virtual scene, etc. Parameters may then be configured in the element editor for each particle in the virtual element, for example in terms of cloth simulation, providing various control parameters, such as tensile stiffness in the Stretch (Stretch) dimension (stratchstiffness) and Bending stiffness in the Bending (Bending) dimension (bendtstiffness), which are used to control the Stretch elasticity of the cloth, and the bendtstiffness which is used to control the Bending elasticity of the cloth. Of course, other control parameters, such as damping parameters, quality parameters, etc., may be included in addition to these parameters, which facilitate control of the morphology and dynamic effects of the cloth. After configuring corresponding parameters for each particle in the virtual element, an element model can be obtained.
S202, performing physical simulation on the form of the virtual element at the current moment according to the information in the element model, and obtaining simulated form data.
In a specific implementation of step S202, the computer device may invoke a physical simulation engine to perform physical simulation on the form of the virtual element at the current moment according to the information in the element model. The physical simulation engine can be a physical-based cloth simulation engine (such as Flex), and can realize cloth physical simulation through the cloth simulation engine, particularly simulate the physical characteristics of elasticity, friction, air resistance and the like of cloth, support various constraint types and acceleration of a Graphic Processing Unit (GPU) (Graphics Processing Unit) so as to realize a high-quality cloth simulation effect.
In one specific implementation, from a data function perspective, the element model includes the following information: morphological data, physical attribute information of each particle in the virtual element, motion constraint information of each particle in the virtual element, and the like. It is understood that the morphological data at different times based on the virtual element may be different and the information in the element model at different times may be different. From the perspective of data variability, the element model includes: fixed information and variable information. Fixed information refers to information that does not change over time, such as: physical attribute information and motion constraint information of the particles. Variable information refers to information that can change over time, for example: morphological data of the virtual element at different moments in the motion process. The above-mentioned physical attribute information refers to the physical characteristics of the particles, including but not limited to: mass, shape, density, elasticity, coefficient of friction, rotational inertia, etc. When a particle has a certain mass, the particle may also be referred to as a particle point. The physical property information of the different particles may be different or the same, for example, the friction coefficient of the particles at the cuff portion of the garment and the friction coefficient of the particles at the collar portion may be different, and for example, the mass of each particle may be the same. The motion constraint information is information for constraining the motion of the particles, and includes distance constraint, which is the distance the particles need to maintain when they move.
Based on this, the computer device, when executing step S202, may include the following two ways: if the current time is the time corresponding to the first frame scene picture of the virtual scene (i.e. the current time is the first time), the form data in the element model can be preconfigured form data, and then the computer equipment can directly take the form data in the element model as simulated form data; if the current time is the time corresponding to any frame of scene picture except the first frame (i.e. the current time is not the first time), the form data in the element model may be the target form data at the time before the current time, and then the computer device may perform physical simulation according to the target form data, the physical attribute information of each particle and the motion constraint information of each particle, which are included in the element model and are at the time before the current time, so as to obtain simulated form data. The simulated form data obtained by performing the physical simulation in the above manner refers to initial form data of the virtual element at the current time, and may specifically be preconfigured form data or form data obtained by resolving. The collision condition at the current moment is further considered, and whether the collision condition is used as the target form data for rendering and displaying the virtual element or the target form data is obtained after the collision condition is calibrated is determined.
It can be seen that the information in the element model at different moments can determine not only the initial form of the virtual element, but also the form change of the virtual element in the motion process, and the form data in the element model can change along with the motion of the particles in the virtual scene so as to simulate the motion behavior of the virtual element in the virtual scene at different moments.
S203, based on the simulated form data, detecting the collision condition of the virtual element at the current moment in the virtual scene, and obtaining a collision detection result.
In a virtual scene, there is a problem in that different types of objects collide with each other. For example: collision of clothes and rigid bodies, collision between clothes and collision of clothes and liquid. Therefore, it is necessary to detect the collision situation of the virtual element at the current time, and the collision situation of the virtual element (such as cloth) between the current time and other objects in the virtual scene and the collision situation with itself can be comprehensively detected through the collision detection. A more real simulation effect can be realized through collision detection, so that the reality and the accuracy of simulation are ensured.
In one specific implementation, the simulated morphology data includes: the general principle of collision detection at the simulated position of the particle at the current moment is as follows: based on the relation between the simulated positions of each particle in the virtual element and the positions of other objects in the virtual scene, detecting the collision situation between the particles in the virtual element and the other objects in the virtual scene operation process or the collision situation between different particles in the virtual element, and if collision exists, performing corresponding collision response such as rebound, friction or scattering, so that the movement of the virtual element after collision accords with the normal collision response as much as possible. In another specific implementation, the simulated form data includes acceleration, and the collision detection can calculate the impulse of the virtual element at the current moment according to the acceleration of the virtual element at the current moment and the time step (i.e. the time interval between adjacent moments), and then determine that the possibility of collision of the virtual element at the current moment is high or the possibility of abnormal collision is high when the impulse exceeds a preset impulse threshold, so that the simulated form data can be calibrated to avoid the abnormal collision at the current moment and the subsequent abnormal collision.
An object (or object) that supports collisions with virtual elements in a virtual scene may be referred to as a collision volume. Collisions with virtual elements in a virtual scene may be simulated by the collision volumes. The collision body may be an object simplified by a corresponding geometry, for example, an object obtained by simplifying the limbs, trunk, and the like of the virtual character by the capsule body. From a geometric perspective, the collision volume includes, but is not limited to: capsule, sphere, cube, and collision body constructed based on triangles. From the perspective of motion properties, collision volumes include, but are not limited to: a movable object, for example: a virtual character walking in the virtual scene; static objects, for example: seating/tables/sofas in virtual scenes, etc. Collisions of the virtual element with static objects in the virtual scene may be referred to as scene collisions, collisions of the virtual element with movable objects in the virtual scene may be referred to as character collisions, collisions of the virtual element with itself may be referred to as self-collisions, such as cloth crumpling and piling up with itself. It is worth emphasizing that the collision of a virtual element with itself can be understood as: collisions between different particles in the virtual element occur.
The collision detection result obtained by detecting the collision condition at the current moment can be used for indicating whether the virtual element has the collision condition at the current moment, and specifically may include: whether a self-collision occurs, whether a collision with a collision body in a virtual scene occurs, whether an abnormal collision occurs, and the like. If the collision detection result indicates that the virtual element does not self-collide (or does not collide with a collision volume in the virtual scene) at the current time, it is indicated that different particles in the virtual element are not in contact (or are not in contact with the collision volume in the virtual scene); if the collision detection result indicates that the virtual element has a self-collision (or a collision with a collision body in the virtual scene), it is indicated that different particles in the virtual element have been contacted (have been contacted with the collision body). Further, if the existing collision situation has collision abnormality, such as collision penetration, excessive collision rebound, abnormal collision motion track, etc., in order to avoid rendering the displayed collision picture to be inconsistent with the normal collision reaction, the simulated morphological data can be calibrated, so as to promote the sense of reality of the collision picture.
S204, calibrating the simulated form data according to the collision detection result to obtain target form data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment.
To simulate a collision reaction in an actual environment, a virtual element in a virtual scene may be subjected to a corresponding force to collide with an object in the virtual scene, or may be self-collided, but an unrealistic collision penetration phenomenon may occur or the collision reaction may not be in line with the actual situation when the collision is simulated, for example: the cloth collides with the collision body and is sprung. Therefore, in order to better achieve the collision effect, besides performing collision detection, the virtual element needs to respond to the collision according to the collision detection result so as to enable the virtual element to be displayed in the correct and reasonable position in the collision and subsequent movement, and the problem of abnormal collision such as collision penetration is avoided.
Based on this, in one specific implementation, the computer device may determine whether to calibrate the simulated morphology data according to the indication of the collision detection result, so as to obtain the target morphology data of the virtual element at the current moment. Thus, the target morphology data may be simulated morphology data or simulated morphology data after calibration. The computer equipment can render the virtual element by adopting the target form data, so that the form of the virtual element at the current moment is displayed.
The above collision detection and calibration process can be understood as a process of collision detection and response, specifically, not only self-collision detection but also other collisions including collisions with scenes and collisions with characters can be performed in terms of collisions. The collision condition of the virtual element at the current moment can be detected more accurately under the condition of more comprehensive collision detection. The following method responds to the corresponding collision condition, and can obtain better collision effect after collision response. For example, each particle in the cloth can be unfastened from the penetrating state through collision response, so that the problem that multiple layers of cloth are penetrated when the cloth at the current moment is rendered and displayed is avoided, and the collision effect is improved.
It can be understood that in the process of running the virtual scene, the computer device can perform physical simulation on the forms of the virtual elements in the virtual scene at different moments under the corresponding physical characteristics, so that the images of the forms of the virtual elements in the virtual scene, such as flags, which change with time under the corresponding stress conditions, are rendered and displayed, and the flags are subjected to wind wave. The process of physical simulation, collision detection and rendering display of the virtual elements in the process of running the virtual scene can also be understood as the process of manufacturing the virtual elements. Taking a virtual element as a virtual cloth as an example, the scheme provided by the application can be used for manufacturing the cloth, and the cloth is manufactured in a repeated process, namely after each frame of scene picture of the virtual scene is rendered and displayed, the information required by physical simulation in the element model can be adjusted according to the cloth display effect so as to obtain a better display effect. For example: if the cloth displayed by rendering still has the problem of penetration, the parameters can be adjusted repeatedly through iteration, and then the cloth simulation is performed according to the latest parameters, so that the cloth simulation is more stable and reliable, the cloth simulation effect can be improved, and the display effect is further improved. After repeated rendering and display, form data of each particle in the virtual element at each moment can be obtained, and the data is exported as an Asset (Asset) to obtain an Asset file. In one implementation, the asset file may be imported into an actual game running environment, and then animations related to virtual elements may be rendered and presented in real time based on data in the asset file during game running, enhancing the visual experience of the game.
The virtual element is a virtual fabric, and then the data processing method provided by the application can be understood as processing logic supported by a fabric framework based on a physical simulation engine Flex. The physical simulation engine can be used for physical simulation, the cloth frame is packaged, and the Flex Solver (namely a Solver based on Flex) is expanded in the cloth frame, compared with a conventional Solver, the expanded Solver is a more controllable Solver, and the expansion is good, so that the calculation and simulation are more stable. Local space simulation (local space simulation) is also promoted in the cloth frame, and the local space simulation refers to physical simulation performed under a non-world coordinate system, for example, a virtual character is used as a reference coordinate system to determine the position of particles of a virtual element. In addition, root motion is added in the cloth frame, and the root motion can be used for simulating inertia of an object under corresponding acting force, so that the inertia effect of cloth simulation can be improved by adding the root motion, the cloth can be more naturally and vividly represented in a virtual environment, and the display effect of the cloth is improved. These improvements are beneficial to better cope with complex cloth simulation requirements, including multi-layer, large-area, complex gown, multi-fold, multi-point and strong detail cloth, and support more cloth layers and richer folding effects. In the aspect of simulation, the method can well cope with the condition that the animation is faster and more complex, for example, when the virtual character moves, jumps, and the like, the clothes and the hair of the virtual character can move along with the virtual character, and the problems of penetration, abnormal movement and the like are avoided. The cloth physical simulation realized based on Flex can simulate the movement and deformation of clothes, hair, canvas and other articles of the virtual character more efficiently, the sense of reality and visual effect of the scene are increased, and the real-time performance of the simulation can be improved. The Flex-based cloth physical simulation exhibits better performance and effect in terms of collision and simulation than the cloth simulation realized by the cloth solver nvclose (cloth simulation technology based on physical simulation). Flex is able to detect collisions between the cloth and other objects using mesh-based collision detection and response techniques, and responds to collisions, and also supports self-collision detection and response, thereby avoiding interpenetration of the cloth itself. Aiming at the simulation of the multi-layer complex cloth, the scheme provided by the application can solve the problems that the penetration is serious, the collision detection and response cost is high, the collision cannot be carried out with a scene and the like in the aspect of collision, and solve the problems that the simulation of the large-area complex cloth is poor in effect, the cloth is defective and the like in the aspect of simulation, so that the application range in practical application is wider, the effect is better, and the simulation effect and the simulation performance of the multi-layer complex cloth are improved. And compared with the effect of the nvCloth under the light work action of the cloth, the scheme has better performance under the same action. The action of the character and the effect of the cloth can be better displayed in the game scene, so that the visual effect and the user experience of the game are improved.
The cloth is obtained by performing the effect optimization test by adopting the scheme provided by the embodiment of the application, the cloth is gradually simulated from a single layer to multiple layers, the precision is higher, the simulation effect is better, and the cloth as shown in fig. 3b has the characteristics of complex pattern, multiple layers and the like, and the precision is also higher. Therefore, the cloth simulation with high precision, multiple layers and complex patterns can be realized by applying the data processing scheme, so that a more optimized simulation effect is obtained. As shown in fig. 3c, the schematic diagram of using actual art resources and animation verification effects is shown, wherein the clothes in the scene picture of the virtual scene presented presents a corresponding form under the corresponding action of the virtual character, and no penetration occurs, so that the virtual scene has a better display effect.
The data processing method provided by the application is also verified in the actual game scene: aiming at the high-quality requirement of simulation in a large-scale 3D (Three Dimensional, three-dimensional) game, the scheme has better effect in collision and simulation, and meanwhile, the method has the advantages of strong calculation performance, high precision and the like of the GPU (Graphics Processing Unit, graphics processor) by means of the use of the cloth simulation engine Flex, and can become a technical trend of future cloth simulation. The cloth frame (frame) can also be used for manufacturing cloth in various fields, so that a higher-efficiency and more accurate solution is provided, the manufacturing cost of the cloth is reduced, and the manufacturing efficiency is improved.
According to the embodiment of the application, the physical characteristics of the virtual element in the virtual scene can be simulated by performing physical simulation on the form of the virtual element at the current moment based on the comprehensive information required by the physical simulation included by the element model in the process of running the virtual scene, so that more accurate form data is obtained, the form of the virtual element which is exhibited when moving in the virtual scene is beneficial to approaching to the real world, the virtual element has more realistic simulation effect, and the display effect of the virtual element is further improved. Furthermore, the simulated form data is used as a detection basis for collision detection, the obtained collision detection result can reflect various collision conditions of the virtual element more comprehensively and accurately, and the simulated form data can be calibrated more accurately according to the collision detection result, so that more real and accurate target form data can be obtained. Compared with the simulated morphological data, the target morphological data can be more accurate morphological data, the virtual element is rendered and displayed by adopting the target morphological data at the current moment, and when no collision exists or a collision condition which does not influence the collision effect exists, the virtual element which is more true and close to the real world can be rendered and displayed based on the target morphological data with higher accuracy, so that the virtual element has a better display effect; when the collision condition affecting the collision effect exists, the repair of the collision condition can be realized based on the calibration of the simulated morphological data, so that the better collision effect can be ensured, the collision effect is controllable, and the display effect of the virtual element is further improved.
Based on the method embodiment shown in fig. 2, the embodiment of the application further proposes a more specific data processing method. In the embodiment of the application, the data processing method is mainly described by taking the computer equipment as an example; referring to fig. 4, the data processing method may include the following steps S401 to S406.
S401, in the process of running the virtual scene, obtaining an element model of a virtual element in the virtual scene.
In one embodiment, the configuration of the corresponding parameters for each particle in the virtual element may be implemented by using an element brush, and specifically may include the following steps (1) - (4).
(1) The virtual element and the element brush are displayed in the element editor, and control operations for the element brush are continuously detected in the element editor.
The element editor may provide an element brush, for example, the cloth editor may provide a cloth brush. The element brush may be provided to a user for control, and the computer device may be configured visually in the element editor for information about the physical simulation in the virtual element by controlling the element brush in response to the control operation. Thus, the computer device may continuously detect control operations for the element brush in the element editor, and may then uniformly configure parameters of particles of the target area in the virtual element with the element brush.
(2) And when one control operation is detected, calling an element brush in the element editor to select a target area from the displayed virtual elements according to the currently detected control operation.
Every time the computer device detects a control operation, it is indicated that the user needs to use the element brush to perform parameter configuration on the corresponding particles in the virtual element. The region where the element brush acts in the virtual element can be regarded as a target region selected from the virtual element, where the effect can be a delineation of the region in the virtual element with a corresponding geometry by the element brush. The selected target area may be a portion of a virtual element simulated by the element model, such as a sleeve portion of a garment simulated by the cloth model. One or more particles may be included in the target area, and each particle in the target area may be acted upon as an elemental brush, i.e., a target particle.
(3) And uniformly carrying out parameter configuration on each particle in the target area according to the parameter configuration operation aiming at the target area to obtain the parameter information of each particle.
In a specific implementation, the parameter configuration operation for the target area can be used for realizing unified configuration of parameters for each particle in the target area, so that configuration efficiency is improved. The set values for the different regions in the virtual element may be the same or different. The parameter configuration operation includes an operation of configuring a physical attribute parameter and an operation of configuring a distance constraint parameter. For example: a selection operation for a certain physical property parameter, or a value setting operation for a certain parameter. Schematically, the virtual element is cloth, and in the aspect of cloth simulation, the cloth is brushed by a cloth brush provided by a cloth editor, and relevant parameters of each particle in the cloth are configured, so that different cloth forms and dynamic effects can be better adapted.
The parameter information of any particle includes a distance constraint parameter and a physical attribute parameter. Wherein the distance constraint parameter is used to constrain the distance between the respective particle and the other particle. The distance constraint parameter may be configured in one or more of the following, including but not limited to: stretch (Bending) constraints, bending (Bending) constraints, and remote attachment constraints. Wherein the bending constraint is used for constraining bending elasticity of particles in the virtual element, the stretching constraint is used for constraining stretching elasticity of particles in the virtual element, and the remote accessory constraint is used for constraining distance between particles bound to the virtual character and particles not bound to the virtual character in the virtual element.
For remote attachments (Long Range Attachments, LRA) constraints. Since the computer device may gridde the virtual element, a simulated grid is obtained, which is made up of a plurality of particles, including a plurality of grids, and each grid may be a triangle formed by three particles connected. For LRA constraints, specifically, points included in the simulation grid with corresponding inverse masses of 0 may be implemented as tethering particles (tether parts) to achieve the attachment effect. Such as binding cloth to the virtual game character, to move with the virtual game character walking. Other points with the inverse mass of 0 are cloth particles (pallet particles), and the update of the position and the speed is calculated by a resolver. A tensile constraint may be established for each edge in the simulated mesh, and a bending constraint may be established between adjacent triangles. As shown in fig. 5a, here a stretch constraint between 5 edges is established, and a distance constraint between p3-p4 is also established to simulate bending. For the tearing effect, the distance constraint is used instead of the dihedral constraint to simulate the bending constraint, where the bending elasticity of the cloth can be controlled by the stretch stiffness (stratchstiffness) which controls the stretch elasticity of the cloth. For each tether particle (tether part), some tether constraints (tether constraints) may be established, with each cloth particle (clone part) corresponding to the nearest tether (tether) point. The unilateral constraint or the inequality constraint is set by the distance, and then the LRA constraint is established. At distances exceeding tether rest distance +tether Give, the LRA constraint will only work. Wherein tether rest distance allows for a moderate distance of particles in the fabric and tether Give allows for a moderate elasticity of the fabric, the sum of which can form an elastic range beyond which LRA constraint is used to prevent the fabric from being stretched too far (especially when the number of iterations is small), which can simulate the weak stretchability of the fabric. Tether stiffness (tetherm stiffness) is allowed to be negative, representing a unilateral constraint, that is to say allowing contraction, only if the distance between particle and tetherm particle exceeds the LRA constraint range, then constrained projection is required. The constrained projection can enable each particle to meet the LRA constraint, and further restrict the motion of each particle. In a specific implementation, the position of the particle can be obtained, and if the distance obtained by calculating the position of the particle does not meet the LRA constraint, the position of the particle can be updated to be corrected to the position meeting the constraint condition.
Physical attribute parameters are used to control the physical attributes of the particles, and the computer device may configure one or more physical attribute parameters, including but not limited to: tensile stiffness (stratchstiffness), flexural stiffness (bendtstiffness), damping (damping), thickness (thickness), tension, friction, density, tear coefficient, parameters indicative of whether world gravity is used, parameters indicative of self collision (self collision), parameters of random external force (random acceleratation), and the like, without limitation herein. These parameters facilitate better control of the morphology and dynamic effect of the cloth.
(4) Parameter information of each particle in the target region is added to the element model of the virtual element.
The computer device may add one or more physical attribute parameters configured for each particle to the physical attribute information of the corresponding particle and add distance constraint parameters to the motion constraint information of the target particle. After the parameters of all the particles in the virtual element are configured in the manner as shown in the above (1) to (4), the parameter information of all the particles may be added to the element model of the virtual element as information included in the element model. It should be understood that if parameters of the remaining particles in the virtual element are not configured, control operation for the element brush may be continuously detected, and then the element brush in the element editor is invoked according to the detected control operation to continuously select a new target area from the virtual element, where none of the particles in the new target area are configured with parameters, and the new target area is a different area from the previous target area, so that the particles in the virtual element, in which the parameters are not configured, may be configured with corresponding parameters.
According to the method, the parameters of the particles in the virtual element by taking the target area as a unit can be uniformly set through the element brush provided in the element editor, and compared with the setting of single particles, the parameters can be set more efficiently and conveniently. And the target area can be customized by controlling the element brush, so that personalized parameter configuration in the virtual element is realized.
In one possible embodiment, the parameter configuration operation for the target area includes: operation of a textile algorithm to configure the target area. Thus, the parameter information of each particle in the target region further includes: and the connection mode of the corresponding particles is determined according to a textile algorithm configured for the target area. Various textile algorithms (alternatively referred to as braiding algorithms, or fabric algorithms) may be provided in embodiments of the present application. Under different textile algorithms, the constraints on the connection mode between particles are different. The method specifically comprises the following steps: (1) when the configured weaving algorithm is a first weaving algorithm (1-ring), the connection mode of the ith particle in the target area is used for indicating: and connecting the ith particle with the particles adjacent to the ith particle in the preset direction. (2) When the configured weaving algorithm is a second weaving algorithm (2-ring), the connection mode of the ith particle in the target area is used for indicating: and connecting the ith particle with the particles indirectly adjacent to the ith particle in the preset direction. (3) When the configured weaving algorithm is a third weaving algorithm (3-ring), the connection mode of the ith particle in the target area is used for indicating: the ith particle and the particles spaced from the ith particle by H particles in the predetermined direction are connected.
Wherein I e [1, I ], I is the number of particles in the target area, and H is an integer greater than 1. The preset direction includes one or more of the following: horizontal, vertical, diagonal, etc. The preset directions supported by different textile algorithms may be the same. For example, the first, second and third textile algorithms all support three directions, horizontal, vertical and diagonal. Different textile algorithms may also support different preset directions, for example: the first textile algorithm and the second textile algorithm are horizontal, vertical and oblique, and the third textile algorithm supports the horizontal and vertical directions. In a second textile algorithm, the interval adjacency refers to the interval of one particle, for example: the 1 st particle and the 3 rd particle are connected in the horizontal direction. Spacing H particles refers to spacing at least two particles, for example: the 1 st particle and the 4 th particle are connected in the horizontal direction. Specifically, if the particles in the target area adopt a 1-ring algorithm, any particle in the target area may be connected to an adjacent particle along a preset direction, for example, the particle a is connected to an adjacent particle in a horizontal, vertical, or oblique direction. If the particles in the target area adopt a 2-ring algorithm, any one particle in the target area can be connected with the indirectly adjacent particle along the preset direction. For example, particle a is connected to a particle that is horizontally and vertically spaced apart from one another, i.e., to a neighbor of a neighbor. If the particles in the target area adopt a 3-ring algorithm, any particle in the target area can be connected with a particle which is spaced from any particle by H particles in a preset direction. For example: the particles a are connected to the particles b spaced apart from the particles a by 3 particles in the horizontal direction. Thus, in terms of the complexity of the ligation, 3-ring > 2-ring > 1-ring. The spinning algorithm can be applied to the cloth simulation process, and the customization of the spinning mode is realized by optimizing the cloth fabric algorithm, for example, the 3-ring algorithm can provide more complex connection between particles with longer distance. Through the optimization, the cloth simulation effect can be improved, and the display effect is further improved. And the experimental result shows that the textile mode is adjusted to be an optimization mode which enables the performance and the effect to be well balanced.
It can be understood that for any particle in the virtual cloth, one or more textile algorithms can be configured so that the particle can have various connection modes, so that connection can be established with more particles in the virtual element, the problems of cloth tearing and the like can be effectively prevented, and the display effect can be improved. For the connection schematic under the above-mentioned textile algorithm, it can be shown in fig. 5 b.
In one possible implementation, if the textile algorithms set by the particles in different target areas in the virtual element are different, the connection manner adopted by different parts in the virtual element in the physical simulation process will also be different. If the particles in two adjacent regions are connected differently, the particles will fracture relatively when displayed finally, and this problem can be solved here by a smoothing process. The information in the element model also includes morphological data; the computer device may further perform the following steps prior to performing the physical simulation: if the current time is the starting running time of the virtual scene, the information in the element model further comprises: form data of the preconfigured virtual element at the current moment; the morphological data includes where each particle in the virtual element is located in the virtual scene. The computer device may also perform the steps of: first, each particle located at the region edge of the target region is traversed, and the currently traversed particle is determined as the current particle. Where the region edge refers to the particle of the outermost layer of the target region, e.g. the target region is a regular square, then each particle located at the region edge comprises particles arranged in four boundaries, left, right, upper and lower. Then, particles which are located outside the target area and adjacent to the current particles in the virtual element may be used as target particles; if the connection mode of the current particle is different from that of the target particle, smoothing the position corresponding to the current particle and the position corresponding to the target particle in the morphological data included in the element model to update the morphological data included in the element model.
Specifically, if particles adjacent to the current particles exist outside the target area, and the connection mode of the particles is different from that of the current particles, in order to make the simulated virtual element softer and smoother, the position of the current particles in the virtual scene and the position of the target particles in the virtual scene can be subjected to smoothing processing, so that the updating of the morphological data in the element model is realized.
Wherein the location of the particle in the virtual scene may be determined based on a world coordinate system or a local coordinate system. In a specific implementation, if the current time is the time corresponding to the first frame scene picture, the position of the particle in the virtual scene is the initial position in the pre-configured morphological data, and if the current time is the time corresponding to the non-first frame scene picture, the position of the particle in the virtual scene is the position included in the target morphological data of the previous time. Before the physical simulation is performed on the form of the virtual element at the current moment, the position corresponding to the current particle and the position corresponding to the target particle can be subjected to smoothing processing in the above manner, so that the smoothed position is obtained to update the position in the form data, and the form of the virtual element at the current moment is smooth and not hard after subsequent rendering.
For particles which are in different target areas and are adjacent to each other in the virtual element, the computer equipment can carry out smoothing processing on the positions of the particles in the virtual scene, so that the positions of the particles required for physical simulation in the element model are adjusted, and the connection of the particles between two adjacent target areas is smoother. For example, the sleeves in the cloth adopt a 1-ring connection mode, the shoulders of the clothes adopt a 3-ring connection mode, the sleeves are woven sparsely in visual representation, the shoulders of the clothes are woven compactly, and the connection of the two parts can be naturally transited through smoothing treatment. The above-mentioned mode has better effect in simulating complex cloth, such as multi-layer clothing, trousers and the like, which can adopt different connection modes.
Based on the textile algorithm provided by the application, the constraint of the connection mode of the virtual element particles can be realized, so that not only is adjacent particles connected, but also particles adjacent at intervals are connected, or particles far away from each other are connected. In the simulation dimension, the problem of tearing and edge breaking in the simulation process, particularly in the cloth simulation process, can be avoided through the connection mode corresponding to the optimized textile algorithm, so that the cloth in the virtual environment is displayed more smoothly, and the effect of virtual element display can be improved. The method is characterized in that the particles in the virtual elements can be more tightly connected by optimizing the connection mode, so that the problems of poor simulation effect of large-area and complex cloth and edge breakage and tearing of high-precision cloth can be solved, and the simulation effect of the cloth is improved. And, to the adjacent region that adopts different weaving algorithm, can make the linking of different positions smooth through smoothing treatment, also be favorable to promoting the cloth simulation effect, and then promote the cloth display effect.
In summary, it can be understood that the computer device may repeatedly run the virtual scene multiple times, and in each process of running the virtual scene, the data processing method provided in the embodiment of the present application may be executed to implement a round of simulation of the virtual element. Before each virtual scene operation, the virtual elements can be brushed by an element brush to adjust information in the element model, so that the simulation of the virtual elements is more stable and reliable, and the simulation effect can be improved. That is, in order to obtain a more stable and accurate simulation effect, the virtual element fabrication may be repeated multiple times until the expected simulation effect is achieved, and in the repeated virtual element fabrication process, iteration of the simulation effect may be achieved, and the simulation effect may be continuously optimized, and finally, a more realistic virtual element may be presented, so that the display effect of the virtual element may be effectively improved.
S402, performing physical simulation on the form of the virtual element at the current moment according to the information in the element model, and obtaining simulated form data.
In one specific implementation, if the current time is the time of the start operation of the virtual scene, the frame corresponding to the current time is the first frame scene of the virtual scene, that is, the current time is the first time corresponding to each frame scene. The element model includes preconfigured form data, the preconfigured form data includes an initial position, an initial speed and an initial acceleration of each particle at the current moment, and the computer equipment can directly use the preconfigured form data as the initial form data of the virtual element at the current moment in physical simulation, namely, the simulated form data obtained in physical simulation.
In another specific implementation, if the current time is not the time of the start operation of the virtual scene, for example, the frame corresponding to the current time is the non-first frame scene of the virtual scene, that is, the current time is the non-first time corresponding to each frame scene. At this time, the information in the element model includes: target morphology data of the virtual element at a previous time, distance constraint parameters and physical attribute parameters of each particle in the virtual element. Based on this, the computer device may specifically execute the following steps (1) - (3) when executing step S202, to obtain simulated morphological data.
And (1) calling a physical model engine, and performing stress calculation according to physical attribute parameters of each particle included in the element model and the acting force influence factors configured for the virtual elements to obtain acting forces born by the corresponding particles at the previous moment.
The previous time is a time adjacent to and before the current time, and the picture frame corresponding to the previous time is adjacent to the picture frame corresponding to the current time and is rendered and displayed. For example, assuming that 30 frames of scene pictures of a virtual scene are rendered and displayed, the picture frame corresponding to the previous moment is the first frame of scene picture, and then the picture frame corresponding to the current moment is the second frame of scene picture. The force influence factor refers to an influence factor of a force to be applied to the virtual element, and according to different forces, the force influence factor can comprise an external force influence factor and an internal force influence factor. External force influence factors refer to influence factors required to apply stress to a virtual element, such as: gravity is applied to the cloth, then the external force influence factor includes gravitational acceleration, wind force is applied to the cloth, then the external force influence factor includes wind speed and the like. The internal force influence factor refers to an influence factor of internal stress of the virtual element, for example, a coefficient required by tension applied to the inside of the cloth.
The computer equipment can call a physical simulation engine to calculate the stress of each particle in the virtual element, and can calculate the acting force of the particle according to physical attribute parameters and acting force influence factors by applying physical principles such as Newton mechanics, elastic mechanics and the like in the stress calculation. For example: gravity is calculated according to the mass (physical attribute parameter) and gravity acceleration (acting force influence factor) of the particles, friction is calculated according to the friction coefficient (physical attribute parameter) and positive pressure (acting force influence factor) of the particles, air resistance to which the particles are subjected is calculated according to the windward area and movement speed (physical attribute parameter) of the particles, air density and air resistance coefficient (acting force influence factor), wind force to which the particles are subjected is calculated according to wind speed, windward area of the particles and the like, and the application is not limited again.
And (2) calling a physical simulation engine to respectively calculate the form indication information of the virtual element according to the acting force of each particle at the previous moment and the distance constraint parameter of the corresponding particle.
In one embodiment, the physical simulation engine may include a resolver, and in the process of calling the physical simulation engine to perform physical simulation, the resolver in the physical simulation engine may be specifically called, according to the acting force of the particle received at the previous moment, the update indication information of the particle is obtained by solving at each time step through a numerical calculation method, and then the update indication information of each particle may be used as the form indication information of the virtual element, where the form indication information includes but is not limited to: position offset, velocity, acceleration, etc. The form indication information is used for indicating that the form data (such as physical state quantity including position, speed and acceleration) at the previous moment is updated, so that the simulation of the virtual element is advanced. Illustratively, the acting force applied by each particle at the previous moment may be a resultant force, and the acceleration of the particle may be obtained by resolving based on newton's law f=ma, and then the velocity may be obtained according to the acceleration and the time steps corresponding to the two moments, so as to obtain the position offset. The morphology indication information may then verify, via the distance constraint parameters of the particles, whether the updated data can be made to conform to the constrained distance. Schematically, for updating the position, the position at the previous moment can be updated according to the position offset to obtain a new position, then, whether the new position meets the distance constraint parameter needs to be detected, and if the new position does not meet the distance constraint parameter, corresponding adjustment needs to be performed, so that the new position meets the distance constraint parameter to maintain the stability of the virtual element.
And (3) updating the target form data of the virtual element at the previous moment by adopting the form indication information of the virtual element to obtain the simulated form data.
The target form data at the previous time includes the position at the previous time, the speed at the previous time, and the acceleration at the previous time. The morphological indication information includes: the position offset, the calculated speed and the acceleration, the position at the previous moment can be updated according to the position offset, the position at the current moment can be obtained, the speed at the previous moment can be updated according to the calculated speed, namely, the calculated speed is taken as the speed at the current moment, namely, the calculated speed. The acceleration at the previous moment can be updated according to the calculated acceleration, i.e. the calculated acceleration is taken as the acceleration at the current moment.
In one implementation, the solver may further calculate, according to the acting force applied by the particle at the current time and the motion constraint information of the particle, form indication information of the virtual element, and further may apply the form indication information to the next time, that is, update, at the next time, the target form data at the current time based on the form indication information of the virtual element, to obtain initial form data at the next time as simulated form data obtained by performing physical simulation on the form of the virtual element at the next time.
It can be seen that from a macroscopic point of view, the virtual element is influenced by the inclusion of at least one force to change its own morphology, including changes in position and shape in the virtual scene, e.g. the cloth is in a stacked state at a certain point of time. Wherein the at least one force comprises: gravity, collision force, wind force, tension of the fabric and the like, and the acting forces can be continuously changed in the simulation process, so that the positions of virtual elements in a virtual scene and the presented geometric shapes are changed. The applied force applied to the virtual element is specifically applied to each particle, and the position of each particle is changed due to the applied force, and the change of the deformation and the overall position of the virtual element in the virtual scene is macroscopic. Thus, the morphology of the virtual element is physically simulated, essentially by physically simulating the movement of the particles in the virtual element. In the physical simulation process, the stress condition of the virtual element can be analyzed first, then the form indication information of the virtual element can be obtained based on the applied force, the form data of the previous moment is updated based on the form indication information, for example, the position, the speed and the like of the previous moment are updated, the reference motion data of each particle at the current moment is obtained, and then the simulated form data obtained by performing physical simulation on the virtual element is formed by applying the reference motion data. In the cloth simulation, by means of the expansion of a resolver in a cloth frame, the improvement of local space simulation and the addition of inertia effects can cope with more complex cloth in the aspect of simulation, so that more cloth layers and more complex wrinkling effects are supported.
S403, based on the simulated form data, detecting the collision condition of the virtual element at the current moment in the virtual scene, and obtaining a collision detection result.
To achieve more efficient collision detection and better collision effect, embodiments of the present application optimize collision detection by, on the one hand, supporting continuous collision detection (Continuous Collision Detection, CCD). Since the computer simulation is based on a discretized form, when the object moves too fast, the energy of a single integration is too large, which may cause the object to traverse another object that should collide, for example: the virtual character moves in the game scene at too high speed, so that the clothes worn by the virtual character and the corresponding part of the skeleton penetrate in a certain frame without normal collision, the collision penetration problem between objects can be solved by continuous collision detection, and the continuous collision detection is mainly used for detecting the collision between high-speed moving objects. On the other hand, the collision bodies used in collision detection are enriched by supporting different types of collision bodies, and the accuracy and the efficiency of collision detection are improved.
The virtual scene comprises P frame scene pictures, wherein P is an integer greater than 1; in the process of running the virtual scene, the computer device can realize continuous collision detection according to the following steps (1) - (3).
And (1) when the p-th frame scene picture of the virtual scene is displayed, acquiring attribute information of collision objects in the virtual scene in the p-th frame scene picture.
The collision object includes: particles supporting self-collisions in the virtual element or collision volumes in the virtual scene, p e 1, p-1. The attribute information mainly includes at least one of: volume and speed of movement. Wherein the movement speed includes a moving speed and a rotating speed.
And (2) if the acquired attribute information meets the preset condition, segmenting the display interval duration between the p-th frame scene picture and the p+1st frame scene picture to obtain a plurality of time points.
Because the performance cost of the CCD is large, whether the CCD is adopted for collision detection or not is considered by integrating corresponding factors. In implementing a CCD, a computer device considers whether the shape of an object is appropriate, whether the volume is small enough, and whether the speed of movement (including either or both of rotational speed and movement speed) is high enough. For this, it may be determined whether the attribute information satisfies a preset condition, which may include at least one of the following based on the content included in the attribute information: the volume need be less than or equal to a preset volume threshold and the speed of movement need be greater than or equal to a preset speed threshold. If the preset condition is met, the CCD is adopted to ensure the performance and the detection efficiency, further, the display interval duration between two adjacent frames of scene pictures can be segmented, the segmentation can be equal interval segmentation or random unequal interval segmentation, a plurality of time points can be obtained through segmentation, and the last time point in the time points is the display moment corresponding to the p+1st frame of scene picture. For example, if the moving speed of the collision body in the 1 st frame scene is greater than the preset speed threshold, the display interval between the 1 st frame and the 2 nd frame may be equally divided into 10 time points with the time length of each time point being 0.1 second.
And (3) sequentially detecting a plurality of time points, and triggering and executing the step of acquiring the element model of the virtual element in the virtual scene when one time point is detected.
Thus, any time point obtained by segmentation can be used as the current time. The step of acquiring the element model of the virtual element in the virtual scene can be triggered and executed through each detected time point, so that the subsequent contents such as physical simulation, collision detection and the like are further carried out. Therefore, the collision detection can be completed in each segmented time period, and the accuracy and precision of the collision detection can be improved by splitting the time period into time periods with smaller time granularity for the collision detection. It should be understood that when an object is detected to collide at a certain moment, the result of the collision can be responded, and on the concrete implementation of the response, the motion track and the stress condition of the collided object can be adjusted, so that the response after the collision is more in line with the real condition.
And when the current time is the last time point in the plurality of time points, executing the step of rendering and displaying the virtual element by adopting the target form data of the virtual element at the current time. That is, when the current time reaches the display time corresponding to one frame of scene picture, the virtual elements in the virtual scene are rendered and displayed. It should be understood that, in the case that the current time is not the last time point of the plurality of time points, the computer apparatus may perform only the steps of acquiring the element model, the physical simulation, and the collision detection (which may correspond to S201 to S203 described above), and not the step of rendering the display virtual element using the target form data of the virtual element at the current time point. It can be seen that the time point of rendering and displaying the virtual element and the time point of physical simulation can be independent, and physical simulation and collision detection can be performed at the current moment, but rendering and displaying are not necessarily performed. And the CCD is adopted for collision detection, so that collision penetration can be avoided. For example, when rendering the scene of the virtual element at the 0 th second and the scene of the virtual element at the 1 st second, if the CCD is not used for collision detection, the scene of the 1 st second will have a problem of collision penetration, but the CCD is used to divide the time point of collision detection between two frames into smaller parts for collision detection, and the collision point is found at 0.5 second, and the response is made at the collision point, so that the virtual element in the scene of the 1 st second finally rendered and displayed will not have collision penetration.
Therefore, in the scheme, whether the attribute information of the collision object in each frame meets the preset condition can be judged in real time, and then under the condition that the preset condition is met, the motion time of the collision object is segmented through continuous collision detection, so that physical simulation and collision detection at finer granularity time are realized. And the collision can be detected more accurately under the condition of high-speed movement, so that the problem of inaccurate collision data caused by penetration phenomenon of an object moving at high speed during discrete movement is avoided, and the collision effect is improved.
In addition, in practical tests, experiments show that the CCD is adopted for collision detection and response, so that the collision effect can be improved, and 80% of collision failures are solved. In addition, when the CCD is adopted, the algorithm of collision detection adopted in the collision detection process can be considered, and optimization and the like are needed to ensure that the collision detection efficiency is better. Algorithms for collision detection as used in this application include, but are not limited to: separation Axis Theorem (SAT) based collision detection, grid based collision detection, distance field based collision detection. Meanwhile, the balance between the performance and the stability of the CCD can be considered, so that the usability and the reliability of the CCD in practical application can be ensured.
In terms of the type of collision body, the collision body referred to in this application includes: a collision body of a first type or a collision body of a second type; wherein the collision volume of the first type comprises at least one of: capsule, sphere and cube; the collision body of the second type comprises: a collision volume constructed based on a triangular mesh. The first type of collision volume is a comparatively basic collision volume, while the collision volumes based on triangular meshes are expanded collision volumes. In addition to the above type of collision body, the collision body may also include irregular collision bodies such as convex bodies, non-convex bodies, and the like, so that a more accurate simulation of an object that collides with a virtual element can be performed.
Compared with collision bodies based on capsules, spheres and the like, the collision body constructed based on triangular meshes (triangularly) can more accurately describe the shape of the collided object, so that the collision detection precision can be improved; compared with the actual object (such as a virtual character with high-precision simulation), the triangle mesh is a relatively rough depiction, so that the performance cost required in the collision detection process is smaller, and the collision detection efficiency can be improved. In conclusion, the collision body constructed based on the triangular network can cope with more complex clothes suits and other resources, and the precision and efficiency of collision detection are improved, so that the collision effect is improved.
Based on this, the present embodiments may provide a triangle mesh based collision detection technique (TriangleMesh Collision) in which a collision volume is an object built based on a triangle mesh, for example: virtual roles built based on triangle meshes. As shown in fig. 6a, a virtual character constructed based on a triangle mesh is in a running posture, and clothing worn by the virtual character collides with the virtual character. Specifically, the collision content thereof specifically includes: when the leg is lifted, the cloth is in contact with the leg but no penetration occurs, and an enlarged schematic view of the impact effect is shown in fig. 6 b. Compared with a capsule body (such as a virtual character constructed by the capsule body), the collision detection technology can more accurately detect the collision between objects, and particularly can better cope with resources such as complex clothes suits. In addition, in the process of realizing TriangleMesh Collision, in order to further improve the efficiency, various factors, such as how the triangular mesh is constructed, the balance of performance overhead and detection precision can be ensured, and what collision detection algorithm is adopted can further improve the detection efficiency, etc. can also be considered.
In one specific implementation, since the virtual element includes a plurality of particles, the simulated morphological data includes: each particle in the virtual element simulates the position at the current time. The specific principle of collision detection based on the analog position at the present moment can be seen in the following two aspects (one) and (two).
And (one) collision detection between the virtual element and the collision body.
The computer device, when executing step S403, may specifically execute the following steps: first, a relative positional relationship between the virtual element and the collision volume may be determined based on the simulated position of each particle in the virtual element at the current time and the position of the collision volume at the current time. Specifically, based on the simulated position of each particle at the current time and the position of the collision volume at the current time, the distance between the respective particle and the collision volume may be calculated. The distance may represent a relative positional relationship and is used to describe the contact between the virtual element and the collision body. Then, collision detection can be performed according to the relative positional relationship, and a corresponding collision detection result is generated. The method comprises the following two modes (1) and (2).
(1) If the relative position relationship indicates that the particles in the virtual element are located in the three-dimensional space where the collision body is located in the virtual scene, a collision detection result for indicating that the virtual element has a collision condition at the current moment is generated, and the collision condition indicates that the particles in the virtual element have abnormal collision with the collision body in the virtual scene.
If the particle containing the virtual element in the three-dimensional space where the collision body is located in the virtual scene is known based on the relative position relation, the fact that collision penetration occurs between the virtual element and the collision body is described, and then the generated collision detection result can indicate that the virtual element has a collision condition at the current moment, and the collision condition indicates that the virtual element and the collision body have abnormal collision, wherein the abnormal collision is specifically the collision penetration.
It can be understood that if the relative positional relationship indicates that each particle in the virtual element is located outside the three-dimensional space where the collision body is located in the virtual scene, a collision detection result for indicating that the virtual element has no collision condition at the current moment is generated, that is, the virtual element has no collision with the collision body. If the relative positional relationship indicates that each particle in the virtual element is located outside the stereoscopic space in which the collision body is located in the virtual scene and the distance between the existence particle in the virtual element and the collision body is smaller than the first preset collision threshold value, the virtual element and the collision body can be regarded as normal collision.
(2) If the relative position relationship indicates that particles in the virtual element are in a collision detection area of the collision body, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, wherein the collision condition indicates that the particles in the virtual element and the collision body in the virtual scene collide normally; the collision detection region is a two-dimensional region defined by a first collision detection radius with the collision body as the center.
If the relative positional relationship indicates that particles of the virtual element exist in the collision detection region of the collision body, the virtual element and the collision body may be considered to collide, and a collision detection result may be generated, and the collision detection result indicates that the virtual element has a collision condition at the present time, which indicates that a normal collision occurs between the virtual element and the collision body.
It can be understood that if the relative positional relationship indicates that each particle in the virtual element is outside the collision detection region of the collision body, a collision detection result indicating that the virtual element does not have a collision condition at the current time is generated, and the virtual element does not collide with the collision body. If the relative position relationship indicates that each particle in the virtual element is in the collision detection area of the collision body and in the three-dimensional space where the collision body is located, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, and the collision condition indicates that the virtual element and the collision body have abnormal collision.
In the collision detection method described in the above (one), whether or not the virtual element collides with the collision body in the virtual scene can be detected based on the simulated position of the particle at the current time and the position of the collision body at the current time. Further, whether collision occurs between the virtual element and the collision body can be detected based on whether particles of the virtual element are in the three-dimensional space where the collision body is located or enter the collision detection area, so that collision detection can be accurately performed, and the accuracy and efficiency of collision detection are ensured.
And (II) self-collision detection of the virtual element.
The computer device, when executing step S403, may specifically execute the following steps: firstly, respectively determining a self-collision detection area of each particle according to a simulation position of each particle in a virtual element at the current moment and a second collision detection radius; then, intersecting detection is carried out on the self-collision detection areas of the particles in the virtual element, so as to obtain a detection result; then, if the detection result indicates that the self-collision detection areas of at least two particles in the virtual element intersect, a collision detection result for indicating that the virtual element has a collision condition at the current moment is generated, and the existing collision condition indicates that the at least two particles in the virtual element have abnormal collision.
Specifically, the self-collision detection region is a two-dimensional region defined by the second collision detection radius with the simulated position of the particle at the current time as the center. Each particle in the virtual element corresponds to a self-collision detection region. If particles in the virtual element self-collide, there will be self-collision detection regions in the virtual element intersected by different particles, i.e. indicating that collisions between particles occur and that collisions have penetrated. The generated collision detection result may then indicate that the virtual element has a collision situation indicating that an abnormal collision occurs between at least two particles of the virtual element.
It can be understood that if the detection result indicates that no particles overlapped from the collision detection region exist in the virtual element, it indicates that no collision occurs between the particles, and thus a collision detection result for indicating that no collision condition exists in the virtual element at the current time can be generated. Further, if the distance between the particles is smaller than the second preset collision threshold value, the self-collision detection area just contacts, which indicates that the collision between the particles happens just.
The collision detection method described in the above (ii) may specifically perform self-collision detection based on the simulated position of the particle at the current moment, and further may determine whether the self-collision occurring in the virtual element is abnormal based on whether there is overlap in the self-collision detection area, so as to improve the collision detection efficiency.
And S404, if the collision detection result indicates that the virtual element has no collision condition at the current moment, taking the simulated form data as target form data of the virtual element at the current moment.
In one specific implementation, the virtual element having no collision at the current time includes: the virtual element does not collide with itself at the present time, and the virtual element does not collide with the collision body at the present time. If the collision detection result indicates that no self-collision occurs and no collision occurs with the collision body, the virtual element is not contacted with the collision body, and the virtual element is not stacked, at this time, the simulated morphological data does not need to be calibrated, but can be directly used as the target morphological data of the virtual element at the current moment.
S405, if the collision detection result indicates that the virtual element has a collision condition at the current moment, determining a target response strategy for responding to the existing collision condition, and calibrating the simulated form data according to the target response strategy to obtain target form data of the virtual element at the current moment.
In one specific implementation, the existence of a collision condition by the virtual element at the current time includes: the virtual element collides with the collision body at the current moment, and collides with the collision body abnormally. The abnormal collision here may include: collision penetration or abnormal impact. Collision penetration refers to the phenomenon that objects overlap during collision, and is generated by excessive contact of the objects due to collision; for example, cloths in a virtual scene fall onto one cone to be penetrated, and for example, cloths are stacked together and penetrated each other. The abnormal impact refers to a phenomenon that an object is excessively rebounded or abnormally moved at the time of collision, and specifically includes at least one of the following: the rebound distance of rebound due to collision is greater than or equal to a preset distance, the motion track of motion due to collision is abnormal, and the motion direction of motion due to collision is abnormal. For example: the cloth in the virtual scene falls onto the sphere to rebound without covering the sphere, and the motion trail is abnormal. The above-mentioned abnormal collision may cause unrealistic collision effects. In order to avoid this, if the collision detection result indicates that the virtual element collides with the collision body at the current moment and collides with the collision body at the current moment, or indicates that the virtual element collides with the collision body at the current moment and collides with the collision body abnormally, the computer device may determine the target response policy first, and then respond to the abnormal collision by adopting the target response policy, and specifically may calibrate the simulated form data based on the target response policy, so as to obtain the target form data of the virtual element at the current moment, thereby avoiding or reducing the abnormal phenomena such as unnecessary overlapping, abnormal movement or excessive rebound of the object during the collision.
It can be seen that in the above manner, by the content indicated by the collision detection result, it can be determined whether to calibrate the simulated morphology data, and when calibrating the simulated morphology data, a corresponding target response strategy can be adopted to achieve more flexible and accurate calibration.
Further, the presence of a collision condition may also indicate that a normal collision occurs between particles of the virtual element, or that the virtual element collides with a collision volume, and further the target response policy may indicate that simulated morphology data of the virtual element is not adjusted, and attribute data of the collision volume is not adjusted.
In one implementation, the virtual element includes a plurality of particles, and the simulated morphological data includes: the simulated motion data for each particle in the virtual element at the current time. The simulated motion data is initial motion state data representing the particle, such as an initial position, an initial velocity, and an initial acceleration, included in the preconfigured form data, if the current time is the first time, and includes data representing the motion state of the particle, such as a position, a velocity, and an acceleration, obtained by a physical simulation. In determining a target response strategy for responding to an existing collision situation, the computer device may specifically determine the target response strategy according to an indication of the existing collision situation, including the following (one) and (two) aspects.
If the existing collision situation indicates that at least two particles in the virtual element have abnormal collision, taking the first response strategy as a target response strategy for responding to the existing collision situation; the first response policy is for indicating: and adjusting the simulated motion data of each particle which is abnormally collided in the virtual element at the current moment.
Whether or not a virtual element is self-colliding may be determined by the relative positions between particles contained by the virtual element. If at least two particles in the virtual element collide abnormally, the virtual element is self-collided and does not accord with normal collision reaction. For example: the stacking of virtual elements themselves is a breakthrough phenomenon. At this time, the first response strategy may be used as a target response strategy to adjust simulated motion data of each particle having abnormal collision in the virtual element at the current moment. Because of the existence of the motion constraint information, when the simulated motion data of each particle with abnormal collision at the current moment is adjusted, in order to meet the motion constraint information, for example, the distance between the particles needs to meet the corresponding distance constraint condition, other particles without abnormal collision can be adjusted accordingly, so that the adjustment of the simulated morphological data of the virtual element is realized. The adjustment of the simulated morphological data can be realized specifically as follows: illustratively, after the collision penetration is detected, a collision force that causes the virtual element to collide with and penetrate itself may be calculated first, where the collision force is used to separate two particles that collide with themselves, specifically, a velocity and a position may be solved according to the collision force, and then a current position and a current velocity of the virtual element at a current moment may be updated according to the velocity and the position. In another implementation, the motion constraint information may include a collision constraint, and the computer device may modify the current position of the virtual element at the current time directly based on the collision constraint, and update the current speed. It will be appreciated that the collision penetration between the virtual element and the collision volume can also be adjusted in a similar manner.
And (II) if the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene have abnormal collision, acquiring motion information of the corresponding particles moving due to the abnormal collision, and determining a target response strategy for responding to the existing collision condition according to the motion information.
Microscopic, collisions between the virtual elements and the collision volumes, in particular collision interactions between particles in the virtual elements and the collision volumes. If abnormal collision of particles and collision bodies exists in the virtual element is detected, in visual representation, namely collision between the virtual element and the collision bodies does not accord with normal collision reaction, such as collision penetration, the computer equipment can respond to the abnormal collision between the virtual element and the collision bodies by adopting a target response strategy, and the virtual element and the collision bodies are unlocked from the abnormal collision state. And the determination of the target response strategy can be realized according to the motion information that the collided particles move due to abnormal collision. In this case, the determined target corresponding policy may be used to indicate: and adjusting the relative position relation between the particles which are abnormally collided in the virtual element and the collision body. One or both of simulated motion data of particles in the virtual element that have an abnormal collision and attribute information of the collision volume may be specifically adjusted.
In the collision dimension, the target response strategy can be determined according to the indication of the collision condition existing at the current moment, so that the selection of the target response strategy is adapted to the collision condition existing at the current moment. And the selection of the target response strategy is rich, so that the target response strategy can be flexibly adopted to respond to the existing collision situation. In addition, considering performance cost of collision detection and response, the selected target response strategy is a strategy with relatively low performance cost and can also respond to collision timely, so that more efficient collision processing can be realized, response resources can be saved, the efficiency of collision response is improved while a better collision effect is realized, and the collision effect is controllable.
In one implementation, the motion information includes a motion distance, where the motion distance may include any one of a penetration distance penetrated by the collision and a rebound distance rebounded by the collision. The computer device, when determining a target response strategy for responding to an existing collision situation according to the motion information, may specifically execute the following (1) and (2):
(1) and if the movement distance is smaller than the distance threshold value, the second response strategy is used as a target response strategy for responding to the existing collision condition. The second response strategy is used for indicating: and adjusting the simulated motion data of the particles with abnormal collision in the virtual element at the current moment, or adjusting the attribute information of the collision body at the current moment.
If the movement distance is smaller than the distance threshold value, the abnormal collision between the virtual element and the collision body is slight, and the normal collision can be corrected through small-amplitude adjustment, so that the problem of the abnormal collision between the virtual element and the collision body can be solved by adjusting the related data of one of the collision body and the virtual element, and a better collision effect can be ensured. To this end, the second response policy may be determined as a target response policy, i.e. only relevant data of any one of the collision volume and the virtual element is adjusted.
Further, in one possible implementation, the simulated motion data of any particle at the current time includes: the current acceleration of the corresponding particle at the current moment. The collision body that collides with the virtual element abnormally also has a current acceleration, and the current acceleration of the collision body means: acceleration that the collision body adopts before an abnormal collision occurs. In case it is determined that the second response strategy is employed, the data about the collision volume or the virtual element is specifically adapted, which may be determined based on a comparison between the current acceleration of the particle and the collision volume. The method specifically comprises the following steps: if the current acceleration of the particle which is abnormally collided with the collision body in the virtual element is larger than the current acceleration of the collision body, the second response strategy is used for indicating: and adjusting the simulated motion data of the particles which are abnormally collided in the virtual element at the current moment. If the current acceleration of the particle which is abnormally collided with the collider in the virtual element is smaller than the current acceleration of the collider, the second response strategy is used for indicating: and adjusting attribute information of the collision body at the current moment.
Specifically, if the current acceleration of the particle is greater than the current acceleration of the collision body, which means that the speed change of the virtual element when moving in the virtual scene is faster than the speed change of the collision body, when the virtual element collides with the collision body, the virtual element brings a larger energy impact to cause abnormal collision, so the determined second response strategy can instruct to adjust the simulated motion data of the particle with abnormal collision in the virtual element at the current moment, and particularly can adjust the current acceleration, the current speed and other data of the particle at the current moment. If the current acceleration of the particle is smaller than the current acceleration of the collision body, the speed change of the collision body when moving in the virtual scene is faster than the speed change of the virtual element, the virtual element may bring larger energy impact to the virtual element due to the higher acceleration of the collision body when colliding with the collision body, so that abnormal collision between the virtual element and the collision body is caused, at the moment, the attribute information of the collision body at the current moment can be adjusted, and the data of the current acceleration, the current speed and the like of the collision body can be specifically adjusted, so that collision abnormality is avoided. It can be seen that the content indicated by the second response strategy in the above manner can be determined by the physical quantity of the current acceleration, so that the response strategy can be better matched with the motion state of the virtual element or the collision body, so that the subsequent response can be more accurately performed.
It should be appreciated that in addition to the information of the current acceleration described above, other factors may be referenced to determine attribute information for adjusting the collision volume at the current time or simulated morphological data of the virtual element, including but not limited to: speed, energy, etc.
(2) If the movement distance is greater than or equal to the distance threshold, the third response strategy is used as a target response strategy for responding to the existing collision condition; wherein the third response policy is for indicating: and adjusting the simulated motion data of the particles with abnormal collision in the virtual element at the current moment and adjusting the attribute information of the collision body at the current moment.
If the movement distance is greater than the distance threshold value, the abnormal collision between the virtual element and the collision body is serious, and if the collision body or the related data of the virtual element is adjusted only, the problem of abnormal collision can not be solved, so that the collision between the collision body and the virtual element does not conform to the normal collision reaction, and the final collision effect is poor. For example: if the penetration distance is too large, if the volume of the collision body is only reduced, the collision body and the virtual element are not sufficiently separated, but the collision effect of the collision body and the virtual element in the virtual scene is affected. By simultaneously intervening the virtual element and the collision body, abnormal collision can be corrected relatively quickly, response efficiency is improved, and collision effect can be ensured.
The above determination of the target response policy may specifically compare the motion distance with the distance threshold, so as to select a corresponding target response policy under the condition that the motion distance is in a corresponding condition, and implement adjustment of one or both of the simulated morphological data of the virtual element and the attribute information of the collision body at the current moment.
In one possible implementation. The attribute information of the collision body at the current time includes: the shape data of the collider at the current moment and the physical attribute of the collider at the current moment. When the types of abnormal collision are different, the adjustment content of the attribute information of the collision body at the current moment is different, so that the corresponding collision condition can be matched, and more accurate collision response is realized. Specifically included are the following descriptions of (1) and (2).
(1) If the abnormal collision is collision penetration, adjusting the attribute information of the collision body at the current moment comprises: and adjusting the form data of the collision body at the current moment. More specifically, the morphology data of the collision volume at the present moment includes at least one of: the pose of the collision body at the current moment and the motion state of the collision body at the current moment. Based on this, adjusting the pose of the collision body at the current moment includes at least one of: in the virtual scene, the collision body is controlled to move in a direction away from the virtual element so as to adjust the position of the collision body at the current moment, reduce the volume of the collision body at the current moment and change the shape of the collision body at the current moment. The collision body can move in a direction away from the virtual element in a translation or curve manner, the volume of the collision body is reduced, the space occupied by the collision body in the virtual scene is changed, the penetration state between the original collision body and the virtual element is further released, the shape of the collision body is changed, for example, the collision body is changed from a capsule body to a triangle, and the expansion of the collision body is realized so as to separate originally overlapped objects. Adjusting the motion state of the collision body includes at least one of: the moving speed of the collision body is controlled within a preset speed range, and the acceleration of the collision body is adjusted.
Therefore, aiming at the phenomenon that collision penetration possibly occurs in the collision process of the objects, namely the objects are overlapped during collision, collision penetration optimization can be performed through a target response strategy, and the morphological data of the collision body can be adjusted through the collision penetration optimization, so that the objects can collide normally without penetration. Based on this, techniques such as collider expansion, collider contraction, collider translation, and the like may be employed. The collision body expansion refers to expanding the type of the collision body during collision detection, for example, expanding the collision body from a capsule body to a triangular mesh collision body, so as to avoid the situation that objects overlap during collision. The collision body shrinkage refers to that the volume of the collision body is reduced during collision detection so as to avoid the situation that objects excessively overlap during collision. The collision body translation refers to translating the collision body along a direction away from the virtual element during collision detection so as to avoid unnecessary overlapping of objects during collision. In the implementation of the above collision penetration optimization, the collision volume expansion, the collision volume contraction, or the collision volume translation can be understood as the content of the target response strategy, and what target response strategy is adopted for the collision response can be based on the collision detection result. The processing mode is efficient in response, and the overall simulation efficiency can be improved.
(2) If the abnormal collision is abnormal collision, adjusting attribute information of the collision body at the current moment comprises at least one of the following: and adjusting the form data of the collision body at the current moment and adjusting the physical attribute of the collision body at the current moment. Based on the content included in the morphology data, adjusting the morphology data of the collision body at the current time includes one or more of: controlling the movement speed of the collision body within a preset speed range, and adjusting the acceleration of the collision body; the physical attributes include at least one of: the elastic coefficient and the friction coefficient, and the physical properties of the collision body at the current moment are adjusted by one or more of the following: the elastic coefficient of the collision body is adjusted, and the friction coefficient of the collision body is adjusted. The present application is not limited in this regard.
It can be seen that abnormal impact phenomena may occur for objects in a collision, such as excessive bouncing or abnormal movements (e.g. movements that do not follow a regular trajectory of movement). Such problems can be addressed by employing techniques such as collider creep and optimization of collider elasticity. The collision body is slowly moved, namely, the collision body is slowly moved at a speed lower than a preset speed threshold value during collision detection, or the speed is controlled to move within a preset speed range, so that excessive rebound or abnormal movement of an object during collision is avoided. By controlling the collision body to move at a slower speed, the problem of collision penetration can also be avoided. In addition, the acceleration of the collision body may be adjusted to slow down the collision body. Optimizing the collision body elasticity refers to adjusting the elasticity of the collision body during collision detection so as to avoid abnormal movement of an object during collision. For example: when the rebound distance of the motion due to collision is larger than a preset threshold value, the elasticity of the collision body can be adjusted to be small, so that the collision rebound accords with normal reaction. The friction coefficient of the collision body and the like can also be adjusted to solve the abnormal impact phenomenon.
It will be appreciated that if a virtual element self-collides and the abnormal collision described above occurs, the above-described adjustments to the morphological data and physical properties of the collision volume are equally applicable to individual particles of the virtual element. For example, the elastic coefficient, friction coefficient, etc. of the particles are adjusted to control the acceleration, speed, etc. of the particles.
In another specific implementation, the motion information includes acceleration, and the computer device, when determining a target response strategy for responding to an existing collision condition according to the motion information, may specifically perform the following: if the acceleration is smaller than the acceleration threshold value, the second response strategy is used as a target response strategy for responding to the existing collision condition; and if the acceleration is greater than or equal to the acceleration threshold value, the third response strategy is used as a target response strategy for responding to the existing collision condition. Specifically, if the acceleration is less than the acceleration threshold, the acceleration is relatively small, and the second response strategy may be taken as the target response strategy, and the data about one of the collision volume or the virtual element may be adjusted. If the acceleration of the particles is too large, the situation that the collision between the virtual element and the collision body possibly occurs is indicated, and the response to the collision abnormality between the virtual element and the collision body can be realized by adjusting the simulated motion data of the particles with abnormal collision in the virtual element at the current moment and the attribute information of the collision body at the current moment. Since the current acceleration of the particles, which are virtual elements, at the current time is large, the attribute information of the collision body can be adjusted in addition to the simulated form data of the virtual elements. In yet another specific implementation, the motion information includes a velocity, and the computer device, when determining a target response strategy for responding to an existing crash situation based on the motion information, may implement selection of the target response strategy in a manner similar to acceleration.
In summary, in the aspect of collision, the scheme can solve the problems of CCD, collision penetration optimization, abnormal collision and impact, try different types of collision bodies and the like, correct the simulated form data of the physical simulation according to the collision condition, further solve the problem of poor collision effect after the cloth precision is improved, and realize the optimization of the collision effect. Experiments prove that the accuracy and stability of cloth simulation are successfully improved, so that the action and cloth effect of the roles in the game are more real and natural.
S406, rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment.
In specific scene picture representation, the virtual element is rendered and displayed based on the target form data, so that a better display effect can be obtained. For example, in a game scene, even more complex layers of clothing may naturally lay flat on the ground while the avatar sits, rather than penetrating the ground.
In one embodiment, since the virtual scene includes an object supporting collision with the virtual element, namely a collision body, in addition to the virtual element, the virtual element can be rendered and displayed, and the collision body can be rendered and displayed at the same time, so that the virtual element in the virtual scene and the collision body can display corresponding collision effect when transmitting collision. Specifically, the computer device may acquire attribute information of the collision body at the current time, and then calibrate the attribute information of the collision body at the current time according to the collision detection result, so as to generate calibrated attribute information; when the virtual element is rendered and displayed by adopting the target form data, the collision body is rendered and displayed according to the calibrated attribute information.
If the collision volume is a static object in the virtual scene that supports a collision with the virtual element, the attribute information of the collision volume at different times may remain unchanged before the collision with the virtual element, and if the collision volume is a movable object in the virtual scene, the morphological data included in the attribute information of the collision volume at different times may be different. Since the virtual element may affect not only its own form but also its form when colliding with the collision body, it is determined whether to calibrate the attribute information of the collision body at the current time according to the collision detection result, and thus the attribute information required for final rendering display is obtained.
In one implementation manner, when the computer device calibrates the attribute information of the collision body at the current moment according to the collision detection result and generates the calibrated attribute information, the computer device specifically may execute the following: if the collision detection result indicates that the virtual element has no collision condition at the current moment, the attribute information of the collision body at the current moment is used as calibrated attribute information; if the collision detection result indicates that the virtual element has a collision condition at the current moment, the attribute information of the collision body at the current moment is calibrated according to the target response strategy, and the calibrated attribute information is obtained.
The attribute information of the collision body at the current time includes: the shape data of the collider at the current moment and the physical attribute of the collider at the current moment. If the virtual element and the collision body do not collide at the current moment, the attribute information of the collision body at the current moment can be directly adopted to render and display the collision body without calibrating the attribute information of the collision body at the current moment. If the virtual element collides with the collision body abnormally at the current moment, such as collision penetration occurs, the attribute information of the collision body at the current moment can be calibrated according to the determined target response strategy. If the target response strategy indicates that the attribute information of the collision body at the current moment is not adjusted, the collision body can be rendered and displayed according to the attribute information of the collision body at the current moment, and if the target response strategy indicates that the attribute information of the collision body at the current moment is adjusted, the collision body can be rendered and displayed according to the adjusted attribute information at the current moment.
It can be understood that taking the virtual element as the virtual cloth as an example, different types of cloths can be simulated according to the above scheme, for example: mantles, coats, pants, skirts, and the like. For cloth simulated in the above manner, see, e.g., fig. 7 a-7 d. Fig. 7a shows the effect of a collision between a cloth and a sphere on the ground, wherein the cloth covers the sphere without collision penetration, natural wrinkles appear when the cloth is laid on the ground, and the cloth does not collide penetration. The interaction between cloth and collision body in fig. 7 b. The collision body is a capsule body, part of cloth naturally drops under the action of gravity, and part of cloth is positioned at a corresponding position under the supporting force of the collision body. Fig. 7c is a simulation of the impact effect between the garment and the impact body during the leg lifting operation, wherein the impact body between the garment and the leg is deformed as the leg is lifted without penetration. Fig. 7d is a schematic view showing an enlarged view of the impact effect shown in fig. 7c, in which the clothing cloth is composed of particles, and no impact penetration occurs between the particles.
The scene of physical simulation and collision detection for each type of cloth can be understood as one functional scene in the present application. One type of cloth may be understood as a resource (or art resource). In order to obtain more comprehensive and reliable effect expression, the fabric can be tested from multiple dimensions after being simulated, so that the expression of the simulated fabric in the scheme can be more intuitively illustrated. In one specific implementation, a multi-dimensional test scenario may be built, including a functional dimension, a resource dimension, and a solution (solver) dimension. When the cloth in a certain dimension is required to be tested, the other two dimensions can be fixed, and then the evaluation is carried out according to the effect of the cloth displayed by rendering.
The resources prepared for each dimension are described below. In terms of functional dimensions, multiple sets of resources may be prepared for each scene, one set of resources representing each functional characteristic independently. For functional characteristics, from a large direction, both simulation and collision aspects may be included, where the collision aspects may include: a character collision function (collision of clothing with a virtual character) and a scene collision function (collision between clothing and environment). Different functional characteristics are emphasized in different functional scenes, for example, some functional scenes may be emphasized in simulated texture, and some functional scenes are emphasized in the effect of collision (for example, whether penetration occurs, whether abnormal motion occurs), whether collision response is timely, and the like. For example, the functional characteristic represented by the mantel a1 is a physical simulation function in a simulation scene, and the functional characteristic represented by the mantel a2 is a collision detection function in a simulation scene. In terms of resource dimension, a simple to complex simulated cloth is prepared. For example: single layer to multi layer skirt. In the aspect of the dimension of solution (solver), various types of solvers including nvclose, flex and self-grinding solver are adopted, and the comparison among a plurality of solvers can be realized by adopting different solvers to carry out simulation solution on the same resource in the physical simulation process, so that the performances of different solvers under corresponding scenes are evaluated, and the most suitable solver is selected to realize efficient and accurate solution. It can be understood that the resolving speed of each resolver and the effect (such as softness, reality, etc.) of the cloth simulated based on the resolved data can be compared in resolving dimension to select the resolver, and the resolver can be used in the cloth simulation under the actual scene, such as real-time cloth simulation under the game scene, to improve the stability and accuracy of the cloth simulation. For example, an evaluation table as shown in table 1 below may be constructed. Thereby better assessing the performance of the overall scheme:
Table 1 evaluation data sheet
The resolving speed shown in table 1 is data for evaluating resolving performance of a solver, and the simulation effect can be evaluated by data such as softness and reality of cloth, wherein single-layer and multi-layer represent complexity of art resources. As shown in Table 1 above, flex in the solver dimension was fixed, and the resource dimension was single-layered, and further the simulation effect and the impact effect (whether normal impact) of single-layered pants under the Flex solver were tested, the simulation effect and the impact effect of single-layered clothes, etc.
Based on the description of the embodiment, in the aspect of collision, the Flex solver is adopted, more efficient collision detection and response technology is adopted, more complex collision effect is supported, and the problems that multiple layers of complex cloth are seriously inserted, self-collision expenditure is high, collision cannot be carried out with a scene and the like can be effectively solved. Meanwhile, better collision effect can be achieved through optimization of collision detection and response technology, the multi-layer collision effect is controllable, the self-collision effect is good, collision interaction can be carried out with a scene, and the cloth simulation effect and performance are further improved. In the aspect of simulation, through optimizing a fabric algorithm and trying a self-grinding fabric algorithm (such as a 3-ring textile algorithm), connection modes of different parts in the fabric are different based on different set control parameter values, so that the connection modes in the fabric are matched with physical characteristics of corresponding parts, the problems of tearing, edge breaking and the like in fabric simulation are solved better, and the smoothness and perfection of fabric effects are improved. Through the promotion of simulation performance and simulation effect, also can reach better effect to complicated cloth, and then can extend the application range and the effect of this scheme in practical application.
In practical applications, the data processing method shown in fig. 2 and fig. 4 can be applied to various virtual scenes, such as a game scene, a scene in a movie, and the like. By taking a virtual scene as a game scene, virtual elements as cloth, an element model as a cloth model, and manufacturing the cloth in a cloth editor as an example, the application process of the data processing method can comprise the following two aspects:
the user operation content is as follows: the computer equipment can respond to the cloth loading instruction to load the cloth model into the cloth editor, then the physical attribute information and the motion constraint information of the cloth are configured in the cloth editor, and whether collision is performed is configured. Then, simulation can be started to perform physical simulation and collision detection of the cloth in the cloth editor, then, the cloth simulation effect can be evaluated by rendering and displaying the cloth, then whether to adjust physical attribute information, motion constraint information and the like in the cloth model is selected, and further, the physical simulation of the cloth is performed again. After repeated simulation and rendering display, the form data of each particle in the cloth at each moment, including position, speed, acceleration and the like, can be finally obtained. And can be exported as an asset for use in an actual gaming environment.
The cloth manufacturing content is as follows: the computer equipment can run the virtual scene, acquire information in the cloth model to perform physical simulation on the form at the current moment, and further acquire simulated form data. In the physical simulation process, a corresponding connection mode can be adopted according to the configured parameters so as to better cope with the simulation of various complex fabrics. And performing collision detection based on the simulated form data, so as to calibrate the simulated form data according to the collision condition of the cloth indicated by the collision detection result at the current moment. In the calibration process, a target response strategy with lower performance cost and capability of ensuring collision effect can be adopted, and the simulated morphological data can be quickly adjusted so as to obtain target morphological data which is used for rendering and displaying virtual elements. In addition, according to the collision detection result, the attribute information of the collision body at the current moment can be calibrated, if the collision occurs at the current moment and the collision is abnormal, the virtual element and the collision body are rendered and displayed based on the corresponding data by calibrating the related data of any one of the collision body and the virtual element, so that a better collision effect can be realized.
Therefore, the scheme can bring better simulation effect while saving time cost in various scenes, can achieve better balance in simulation performance and simulation effect, and has the characteristics of multiple layers, large-area complex gowns, multiple folds, multiple points, strong details and the like in the martial arts writing type game scene. The application of the scheme can meet the following requirements: a) The high-precision cloth simulation effect can obviously improve the display effect of the cloth and show the details of the cloth. b) Complex actions of virtual characters in the game, such as challenges of light work to cloth performance, can be dealt with. c) The cloth with the characteristics of multiple layers, large-area complex gowns, multiple folds, multiple points, strong details and the like can be processed. d) The problem of penetration of the multi-layer cloth can be avoided. e) The real-time simulation can show the actions of the virtual characters and the cloth effect in real time in the game. f) The cost is acceptable and feasible, and can be widely applied to practical application. Therefore, the scheme provided by the application has wide application scenes and commercial value, and can provide a more efficient and more accurate solution for cloth manufacturing in the fields of games, videos and the like, reduce manufacturing cost and improve manufacturing efficiency.
Based on the description of the data processing method embodiment, the embodiment of the application also discloses a data processing device; the data processing apparatus may be a computer program (comprising program code) running in a computer device and which may perform the steps of the method flow shown in fig. 2 or fig. 4. Referring to fig. 8, the data processing apparatus may operate as follows:
an obtaining unit 801, configured to obtain, during a process of running a virtual scene, an element model of a virtual element in the virtual scene, where the virtual element is an element supporting deformation during a motion process, and the element model includes: the method comprises the steps that when the form of a virtual element at the current moment is subjected to physical simulation, information is needed;
a processing unit 802, configured to perform physical simulation on a form of the virtual element at a current moment according to information in the element model, so as to obtain simulated form data;
the processing unit 802 is further configured to detect a collision condition of the virtual element at the current moment in the virtual scene based on the simulated morphological data, so as to obtain a collision detection result;
the processing unit 802 is further configured to calibrate the simulated morphological data according to the collision detection result, so as to obtain target morphological data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment.
In one embodiment, the processing unit 802, when used to calibrate the simulated morphology data according to the collision detection result, may be specifically used to:
if the collision detection result indicates that the virtual element has no collision condition at the current moment, taking the simulated form data as target form data of the virtual element at the current moment;
if the collision detection result indicates that the virtual element has a collision condition at the current moment, determining a target response strategy for responding to the existing collision condition, and calibrating the simulated form data according to the target response strategy to obtain target form data of the virtual element at the current moment.
In another embodiment, the virtual element comprises a plurality of particles, and the simulated morphological data comprises: simulation motion data of each particle in the virtual element at the current moment; the processing unit 802, when used to determine a target response strategy for responding to an existing collision situation, may be specifically configured to:
if the existing collision situation indicates that at least two particles in the virtual element have abnormal collision, the first response strategy is used as a target response strategy for responding to the existing collision situation; the first response policy is for indicating: adjusting simulation motion data of each particle with abnormal collision in the virtual element at the current moment;
If the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene have abnormal collision, motion information of the corresponding particles moving due to the abnormal collision is obtained, and a target response strategy for responding to the existing collision condition is determined according to the motion information; a collision volume refers to an object in a virtual scene that supports collisions with virtual elements.
In another embodiment, the motion information includes a motion distance; the processing unit 802, when configured to determine a target response strategy for responding to an existing collision situation based on the motion information, is specifically configured to:
if the movement distance is smaller than the distance threshold value, the second response strategy is used as a target response strategy for responding to the existing collision condition; wherein the second response policy is for indicating: adjusting simulated motion data of particles with abnormal collision in the virtual element at the current moment, or adjusting attribute information of a collision body at the current moment;
if the movement distance is greater than or equal to the distance threshold, the third response strategy is used as a target response strategy for responding to the existing collision condition; wherein the third response policy is for indicating: and adjusting the simulated motion data of the particles with abnormal collision in the virtual element at the current moment and adjusting the attribute information of the collision body at the current moment.
In another embodiment, the simulated motion data for any particle at the current time comprises: the current acceleration of the corresponding particle at the current moment; if the current acceleration of the particle which is abnormally collided with the collision body in the virtual element is larger than the current acceleration of the collision body, the second response strategy is used for indicating: adjusting simulation motion data of particles with abnormal collision in the virtual element at the current moment; if the current acceleration of the particle which is abnormally collided with the collider in the virtual element is smaller than the current acceleration of the collider, the second response strategy is used for indicating: adjusting attribute information of a collision body at the current moment; wherein, the current acceleration of the collision body means: acceleration applied by the collision body before an abnormal collision occurs.
In another embodiment, the attribute information of the collision body at the current time includes: form data of the collision body at the current moment and physical properties of the collision body at the current moment; wherein the physical attributes include at least one of: coefficient of elasticity and coefficient of friction;
the abnormal collision includes: collision penetration or abnormal impact; the abnormal impact includes at least one of: the rebound distance of rebound due to collision is larger than or equal to the rebound distance threshold value, the motion track of motion due to collision is abnormal, and the motion direction of motion due to collision is abnormal;
Accordingly, if the abnormal collision is a collision penetration, the processing unit 802 is specifically configured to: adjusting the form data of the collision body at the current moment; if the abnormal collision is an abnormal impact, the processing unit 802 is specifically configured to at least one of the following when configured to adjust the simulation information of the collision body at the current time: and adjusting the form data of the collision body at the current moment and adjusting the physical attribute of the collision body at the current moment.
In another embodiment, the morphology data of the collision volume at the current time includes at least one of: pose of collision body at current moment and motion state of collision body at current moment; accordingly, the processing unit 802 is specifically configured to at least one of the following when configured to adjust the pose of the collision body at the current moment: controlling the collision body to move towards a direction far away from the virtual element in the virtual scene so as to adjust the position of the collision body at the current moment, reduce the volume of the collision body at the current moment and change the shape of the collision body at the current moment; the processing unit 802 is specifically configured to at least one of the following when configured to adjust the motion state of the collision body: the moving speed of the collision body is controlled within a preset speed range, and the acceleration of the collision body is adjusted.
In another embodiment, a collision body includes: a collision body of a first type or a collision body of a second type; wherein the collision volume of the first type comprises at least one of: capsule, sphere and cube; the collision body of the second type comprises: a collision volume constructed based on a triangular mesh.
In another embodiment, the virtual scene further comprises a collision body, wherein the collision body refers to an object supporting collision with the virtual element in the virtual scene; the processing unit 802 is further configured to:
acquiring attribute information of a collision body in a virtual scene at the current moment;
calibrating attribute information of the collision body at the current moment according to the collision detection result to obtain calibrated attribute information;
and when the virtual element is rendered and displayed by adopting the target form data, rendering and displaying the collision body according to the calibrated attribute information.
In another embodiment, the processing unit 802, when configured to calibrate the attribute information of the collision body at the current moment according to the collision detection result, may be specifically configured to:
if the collision detection result indicates that the virtual element has no collision condition at the current moment, the attribute information of the collision body at the current moment is used as calibrated attribute information;
If the collision detection result indicates that the virtual element has a collision condition at the current moment, the attribute information of the collision body at the current moment is calibrated according to the target response strategy, and the calibrated attribute information is obtained.
In another embodiment, the virtual element includes a plurality of particles; the processing unit 802 is further configured to:
displaying virtual elements and element brushes in an element editor, and continuously detecting control operations for the element brushes in the element editor;
when one control operation is detected, calling an element brush to select a target area from the displayed virtual elements according to the currently detected control operation;
according to the parameter configuration operation aiming at the target area, uniformly configuring parameters of each particle in the target area to obtain the parameter information of each particle in the target area; the parameter information of any particle includes: distance constraint parameters and physical attribute parameters, the distance constraint parameters of any particle are used for constraining the distance between the corresponding particle and other particles;
parameter information of each particle in the target region is added to the element model of the virtual element.
In another embodiment, the parameter configuration operation for the target area includes: configuring a textile algorithm of a target area; the parameter information of each particle in the target region further includes: according to the connection mode of the corresponding particles determined by the textile algorithm configured for the target area;
When the configured weaving algorithm is the first weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with particles adjacent to the ith particle in a preset direction; when the configured weaving algorithm is the second weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with a particle indirectly adjacent to the ith particle in a preset direction; when the configured weaving algorithm is the third weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with the particles of the H particles spaced from the ith particle in the preset direction; wherein I e [1, I ], I is the number of particles in the target area, and H is an integer greater than 1.
In another embodiment, if the current time is the time of the initial operation of the virtual scene, the information in the element model further includes: form data of the preconfigured virtual element at the current moment; the morphological data includes a location in the virtual scene where each particle in the virtual element is located; the processing unit 802 is further configured to:
traversing each particle at the region edge of the target region, and determining the currently traversed particle as the current particle;
Taking particles which are positioned outside the target area and adjacent to the current particles in the virtual element as target particles;
if the connection mode of the current particle is different from that of the target particle, smoothing the position corresponding to the current particle and the position corresponding to the target particle in the morphological data included in the element model to update the morphological data included in the element model.
In another embodiment, the virtual element includes a plurality of particles, and if the current time is not a starting runtime of the virtual scene, the information in the element model includes: target form data of the virtual element at the previous moment, distance constraint parameters and physical attribute parameters of each particle in the virtual element; the processing unit 802 is configured to perform physical simulation on the form of the virtual element at the current moment according to the information in the element model, and when obtaining simulated form data, may be specifically configured to:
invoking a physical simulation engine, and calculating the acting force of each particle at the previous moment according to the physical attribute parameters of each particle included in the element model and the acting force influence factors configured for the virtual elements;
invoking a physical simulation engine to respectively calculate the form indication information of the virtual element according to the acting force received by each particle at the previous moment and the distance constraint parameter of the corresponding particle;
And updating the target form data of the virtual element at the previous moment by adopting the form indication information of the virtual element to obtain the simulated form data.
In another embodiment, the virtual element comprises a plurality of particles, and the simulated morphological data comprises: the simulated position of each particle in the virtual element at the current moment; the virtual scene also comprises a collision body, wherein the collision body refers to an object which supports collision with the virtual element in the virtual scene; the processing unit 802 is configured to detect, in the virtual scene, a collision condition of the virtual element at the current moment based on the simulated morphological data, and obtain a collision detection result, and may specifically be configured to:
determining a relative positional relationship between the virtual element and the collision body based on the simulated position of each particle in the virtual element at the current time and the position of the collision body at the current time;
if the relative position relationship indicates that the particles in the virtual element are positioned in the three-dimensional space where the collision body is positioned in the virtual scene, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, wherein the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene have abnormal collision;
If the relative position relationship indicates that particles in the virtual element are in a collision detection area of the collision body, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, wherein the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene collide normally; the collision detection region is a two-dimensional region defined by a first collision detection radius with the collision body as the center.
In another embodiment, the virtual element comprises a plurality of particles, and the simulated morphological data comprises a simulated position of each particle at the current time; the virtual scene comprises a collision body, wherein the collision body refers to an object which supports collision with the virtual element in the virtual scene; the processing unit 802 is configured to detect, in the virtual scene, a collision condition of the virtual element at the current moment based on the simulated morphological data, and obtain a collision detection result, and may specifically be configured to:
according to the simulation position of each particle in the virtual element at the current moment and the second collision detection radius, determining a self-collision detection area of each particle respectively;
intersecting detection is carried out on the self-collision detection areas of all particles in the virtual element, so that a detection result is obtained;
If the detection result indicates that the self-collision detection areas with at least two particles intersect, a collision detection result for indicating that the virtual element has a collision condition at the current moment is generated, and the existing collision condition indicates that the at least two particles in the virtual element have abnormal collision.
In another embodiment, the virtual scene comprises a P-frame scene picture, P being an integer greater than 1; in the course of running the virtual scene, the processing unit 802 is further configured to:
when a p-th frame scene picture of the virtual scene is displayed, acquiring attribute information of collision objects in the virtual scene in the p-th frame scene picture; the collision object includes: particles supporting self-collision in the virtual element or collision bodies in the virtual scene, p epsilon [1, P-1];
if the acquired attribute information meets the preset condition, segmenting the display interval duration between the p-th frame scene picture and the p+1-th frame scene picture to obtain a plurality of time points, wherein the last time point in the plurality of time points is the display time corresponding to the p+1-th frame scene picture;
sequentially detecting a plurality of time points, and triggering and executing the step of acquiring the element model of the virtual element in the virtual scene when one time point is detected;
Wherein, when the current time is the last time point of the plurality of time points, the step of rendering and displaying the virtual element by using the target form data of the virtual element at the current time point is executed.
In another embodiment, the attribute information is at least one of: volume and speed of movement; the preset conditions include at least one of the following: the volume need be less than or equal to a preset volume threshold and the speed of movement need be greater than or equal to a preset speed threshold.
The method comprises the steps of obtaining an element model of a virtual element in a virtual scene in the process of running the virtual scene, and carrying out physical simulation on the form of the virtual element at the current moment according to information which is included in the element model and is required for carrying out physical simulation on the form of the virtual element at the current moment, so as to obtain simulated form data. The information in the element model is comprehensive information required by physical simulation, physical characteristics of the virtual element in the virtual scene can be simulated based on the information, more accurate form data can be further obtained, the form of the virtual element displayed when moving in the virtual scene is facilitated to approach the real world, the virtual element has a more realistic simulation effect, and the display effect of the virtual element is further improved. Furthermore, based on the simulated form data, the collision condition of the virtual element at the current moment can be detected, and further the simulated form data can be calibrated according to the detected collision detection result, so that the target form data of the virtual element at the current moment can be obtained. In the process, the simulated form data is taken as the detection basis for collision detection, the obtained collision detection result can reflect various collision conditions of the virtual element more comprehensively and accurately, and further the simulated form data can be calibrated more accurately according to the collision detection result, so that more real and accurate target form data can be obtained. Compared with the simulated morphological data, the target morphological data can be more accurate morphological data, the virtual element is rendered and displayed by adopting the target morphological data at the current moment, and when no collision exists or a collision condition which does not influence the collision effect exists, the virtual element which is more true and close to the real world can be rendered and displayed based on the target morphological data with higher accuracy, so that the virtual element has a better display effect; when the collision condition affecting the collision effect exists, the repair of the collision condition can be realized based on the calibration of the simulated morphological data, so that the better collision effect can be ensured, the collision effect is controllable, and the display effect of the virtual element is further improved.
According to another embodiment of the present application, each unit in the data processing apparatus shown in fig. 8 may be separately or completely combined into one or several other units, or some unit(s) thereof may be further split into a plurality of units with smaller functions, which may achieve the same operation without affecting the implementation of the technical effects of the embodiments of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the data processing apparatus may also include other units, and in practical applications, these functions may also be implemented with assistance from other units, and may be implemented by cooperation of multiple units.
According to another embodiment of the present application, a data processing apparatus device as shown in fig. 8 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 2 or fig. 4 on a general-purpose computing device such as a computer including a processing element such as a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), and the like, and a storage element, and implementing the data processing method of the embodiments of the present application. The computer program may be recorded on, for example, a computer-readable recording medium, and loaded into and executed by the above-described computing device via the computer-readable recording medium.
Based on the description of the method embodiment and the apparatus embodiment, the embodiment of the application further provides a computer device. Referring to fig. 9, the computer device includes at least a processor 901, an input interface 902, an output interface 903, and a computer storage medium 904. Wherein the processor 901, input interface 902, output interface 903, and computer storage medium 904 within the computer device may be connected by bus or other means. The computer storage medium 904 may be stored in a memory of a computer device, the computer storage medium 904 being for storing a computer program, the computer program comprising program instructions, the processor 901 being for executing the program instructions stored by the computer storage medium 904. The processor 901 (or CPU (Central Processing Unit, central processing unit)) is a computing core and a control core of a computer device, which is adapted to implement one or more instructions, in particular to load and execute one or more instructions to implement a corresponding method flow or a corresponding function.
In one embodiment, the processor 901 described in the embodiments of the present application may be configured to perform a series of data processing, specifically including: in the process of running the virtual scene, obtaining an element model of a virtual element in the virtual scene, wherein the virtual element is an element supporting deformation in the motion process, and the element model comprises: the method comprises the steps that when the form of a virtual element at the current moment is subjected to physical simulation, information is needed; according to the information in the element model, performing physical simulation on the form of the virtual element at the current moment to obtain simulated form data; based on the simulated morphological data, detecting the collision condition of the virtual element at the current moment in the virtual scene to obtain a collision detection result; calibrating the simulated form data according to the collision detection result to obtain target form data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment, and the like.
The embodiment of the application also provides a computer storage medium (Memory), which is a Memory device in a computer device, and is used for storing programs and data. It is understood that the computer storage media herein may include both built-in storage media in a computer device and extended storage media supported by the computer device. The computer storage media provides storage space that stores an operating system of the computer device. Also stored in this memory space are one or more instructions, which may be one or more computer programs (including program code), adapted to be loaded and executed by the processor 901. The computer storage medium herein may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory; alternatively, it may be at least one computer storage medium located remotely from the aforementioned processor.
In one embodiment, one or more instructions stored in a computer storage medium may be loaded and executed by a processor to implement the corresponding steps in the method embodiments described above with respect to FIG. 2 or FIG. 4; in particular implementations, one or more instructions in a computer storage medium may be loaded by a processor and perform the steps of:
In the process of running the virtual scene, obtaining an element model of a virtual element in the virtual scene, wherein the virtual element is an element supporting deformation in the motion process, and the element model comprises:
the method comprises the steps that when the form of a virtual element at the current moment is subjected to physical simulation, information is needed; according to the information in the element model, performing physical simulation on the form of the virtual element at the current moment to obtain simulated form data;
based on the simulated morphological data, detecting the collision condition of the virtual element at the current moment in the virtual scene to obtain a collision detection result;
calibrating the simulated form data according to the collision detection result to obtain target form data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment.
In one embodiment, the one or more instructions may be loaded and executed in particular by the processor in calibrating the simulated morphology data based on the collision detection results:
if the collision detection result indicates that the virtual element has no collision condition at the current moment, taking the simulated form data as target form data of the virtual element at the current moment;
If the collision detection result indicates that the virtual element has a collision condition at the current moment, determining a target response strategy for responding to the existing collision condition, and calibrating the simulated form data according to the target response strategy to obtain target form data of the virtual element at the current moment.
In another embodiment, the virtual element comprises a plurality of particles, and the simulated morphological data comprises: simulation motion data of each particle in the virtual element at the current moment; accordingly, in determining a target response strategy for responding to an existing crash situation, the one or more instructions may be loaded and executed in particular by the processor to:
if the existing collision situation indicates that at least two particles in the virtual element have abnormal collision, the first response strategy is used as a target response strategy for responding to the existing collision situation; the first response policy is for indicating: adjusting simulation motion data of each particle with abnormal collision in the virtual element at the current moment;
if the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene have abnormal collision, motion information of the corresponding particles moving due to the abnormal collision is obtained, and a target response strategy for responding to the existing collision condition is determined according to the motion information; a collision volume refers to an object in a virtual scene that supports collisions with virtual elements.
In another embodiment, the motion information includes a motion distance; accordingly, in determining a target response strategy for responding to an existing crash situation based on the motion information, the one or more instructions may be loaded and executed by the processor to:
if the movement distance is smaller than the distance threshold value, the second response strategy is used as a target response strategy for responding to the existing collision condition; wherein the second response policy is for indicating: adjusting simulated motion data of particles with abnormal collision in the virtual element at the current moment, or adjusting attribute information of a collision body at the current moment;
if the movement distance is greater than or equal to the distance threshold, the third response strategy is used as a target response strategy for responding to the existing collision condition; wherein the third response policy is for indicating: and adjusting the simulated motion data of the particles with abnormal collision in the virtual element at the current moment and adjusting the attribute information of the collision body at the current moment.
In another embodiment, the simulated motion data for any particle at the current time comprises: the current acceleration of the corresponding particle at the current moment; if the current acceleration of the particle which is abnormally collided with the collision body in the virtual element is larger than the current acceleration of the collision body, the second response strategy is used for indicating: adjusting simulation motion data of particles with abnormal collision in the virtual element at the current moment; if the current acceleration of the particle which is abnormally collided with the collider in the virtual element is smaller than the current acceleration of the collider, the second response strategy is used for indicating: adjusting attribute information of a collision body at the current moment; wherein, the current acceleration of the collision body means: acceleration applied by the collision body before an abnormal collision occurs.
In another embodiment, the attribute information of the collision body at the current time includes: form data of the collision body at the current moment and physical properties of the collision body at the current moment; wherein the physical attributes include at least one of: coefficient of elasticity and coefficient of friction; the abnormal collision includes: collision penetration or abnormal impact; the abnormal impact includes at least one of: the rebound distance of rebound due to collision is larger than or equal to the rebound distance threshold value, the motion track of motion due to collision is abnormal, and the motion direction of motion due to collision is abnormal; accordingly, if the abnormal collision is collision penetration, the one or more instructions may be loaded and executed by the processor when adjusting the attribute information of the collision body at the current moment: adjusting the form data of the collision body at the current moment; if the abnormal collision is an abnormal collision, the one or more instructions may be loaded by the processor and specifically execute at least one of the following when adjusting the simulation information of the collision body at the current moment: and adjusting the form data of the collision body at the current moment and adjusting the physical attribute of the collision body at the current moment.
In another embodiment, the morphology data of the collision volume at the current time includes at least one of: pose of collision body at current moment and motion state of collision body at current moment;
Accordingly, when adjusting the pose of the collision volume at the current moment, the one or more instructions may be loaded by the processor and specifically execute at least one of: controlling the collision body to move towards a direction far away from the virtual element in the virtual scene so as to adjust the position of the collision body at the current moment, reduce the volume of the collision body at the current moment and change the shape of the collision body at the current moment; in adjusting the motion state of the collision volume, the one or more instructions may be loaded by the processor and specifically execute at least one of: the moving speed of the collision body is controlled within a preset speed range, and the acceleration of the collision body is adjusted.
In another embodiment, a collision body includes: a collision body of a first type or a collision body of a second type; wherein the collision volume of the first type comprises at least one of: capsule, sphere and cube; the collision body of the second type comprises: a collision volume constructed based on a triangular mesh.
In another embodiment, the virtual scene further comprises a collision body, wherein the collision body refers to an object supporting collision with the virtual element in the virtual scene; accordingly, the one or more instructions may be loaded and executed by the processor to:
Acquiring attribute information of a collision body in a virtual scene at the current moment;
calibrating attribute information of the collision body at the current moment according to the collision detection result to obtain calibrated attribute information;
and when the virtual element is rendered and displayed by adopting the target form data, rendering and displaying the collision body according to the calibrated attribute information.
In another embodiment, when the attribute information of the collision body at the current moment is calibrated according to the collision detection result, and the calibrated attribute information is obtained, the one or more instructions may be loaded and executed by the processor:
if the collision detection result indicates that the virtual element has no collision condition at the current moment, the attribute information of the collision body at the current moment is used as calibrated attribute information;
if the collision detection result indicates that the virtual element has a collision condition at the current moment, the attribute information of the collision body at the current moment is calibrated according to the target response strategy, and the calibrated attribute information is obtained.
In another embodiment, the virtual element includes a plurality of particles; accordingly, the one or more instructions may be loaded and executed by the processor to:
displaying virtual elements and element brushes in an element editor, and continuously detecting control operations for the element brushes in the element editor;
When one control operation is detected, calling an element brush to select a target area from the displayed virtual elements according to the currently detected control operation;
according to the parameter configuration operation aiming at the target area, uniformly configuring parameters of each particle in the target area to obtain the parameter information of each particle in the target area; the parameter information of any particle includes: distance constraint parameters and physical attribute parameters, the distance constraint parameters of any particle are used for constraining the distance between the corresponding particle and other particles;
parameter information of each particle in the target region is added to the element model of the virtual element.
In another embodiment, the parameter configuration operation for the target area includes: configuring a textile algorithm of a target area; the parameter information of each particle in the target region further includes: according to the connection mode of the corresponding particles determined by the textile algorithm configured for the target area;
when the configured weaving algorithm is the first weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with particles adjacent to the ith particle in a preset direction; when the configured weaving algorithm is the second weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with a particle indirectly adjacent to the ith particle in a preset direction; when the configured weaving algorithm is the third weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with the particles of the H particles spaced from the ith particle in the preset direction; wherein I e [1, I ], I is the number of particles in the target area, and H is an integer greater than 1.
In another embodiment, if the current time is the time of the initial operation of the virtual scene, the information in the element model further includes: form data of the preconfigured virtual element at the current moment; the morphological data includes a location in the virtual scene where each particle in the virtual element is located; accordingly, the one or more instructions may be loaded and executed by the processor to:
traversing each particle at the region edge of the target region, and determining the currently traversed particle as the current particle;
taking particles which are positioned outside the target area and adjacent to the current particles in the virtual element as target particles;
if the connection mode of the current particle is different from that of the target particle, smoothing the position corresponding to the current particle and the position corresponding to the target particle in the morphological data included in the element model to update the morphological data included in the element model.
In another embodiment, the virtual element includes a plurality of particles, and if the current time is not a starting runtime of the virtual scene, the information in the element model includes: target form data of the virtual element at the previous moment, distance constraint parameters and physical attribute parameters of each particle in the virtual element; correspondingly, when the physical simulation is performed on the form of the virtual element at the current moment according to the information in the element model to obtain simulated form data, the one or more instructions may be loaded and specifically executed by the processor:
Invoking a physical simulation engine, and calculating the acting force of each particle at the previous moment according to the physical attribute parameters of each particle included in the element model and the acting force influence factors configured for the virtual elements;
invoking a physical simulation engine to respectively calculate the form indication information of the virtual element according to the acting force received by each particle at the previous moment and the distance constraint parameter of the corresponding particle;
and updating the target form data of the virtual element at the previous moment by adopting the form indication information of the virtual element to obtain the simulated form data.
In another embodiment, the virtual element comprises a plurality of particles, and the simulated morphological data comprises: the simulated position of each particle in the virtual element at the current moment; the virtual scene also comprises a collision body, wherein the collision body refers to an object which supports collision with the virtual element in the virtual scene; correspondingly, when the collision condition of the virtual element at the current moment is detected in the virtual scene based on the simulated morphological data to obtain a collision detection result, the one or more instructions may be loaded and specifically executed by the processor:
determining a relative positional relationship between the virtual element and the collision body based on the simulated position of each particle in the virtual element at the current time and the position of the collision body at the current time;
If the relative position relationship indicates that the particles in the virtual element are positioned in the three-dimensional space where the collision body is positioned in the virtual scene, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, wherein the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene have abnormal collision;
if the relative position relationship indicates that particles in the virtual element are in a collision detection area of the collision body, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, wherein the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene collide normally; the collision detection region is a two-dimensional region defined by a first collision detection radius with the collision body as the center.
In another embodiment, the virtual element comprises a plurality of particles, and the simulated morphological data comprises a simulated position of each particle at the current time; the virtual scene comprises a collision body, wherein the collision body refers to an object which supports collision with the virtual element in the virtual scene; detecting the collision condition of the virtual element at the current moment in the virtual scene based on the simulated morphological data, and when a collision detection result is obtained, loading and specifically executing the one or more instructions by the processor:
According to the simulation position of each particle in the virtual element at the current moment and the second collision detection radius, determining a self-collision detection area of each particle respectively;
intersecting detection is carried out on the self-collision detection areas of all particles in the virtual element, so that a detection result is obtained;
if the detection result indicates that the self-collision detection areas with at least two particles intersect, a collision detection result for indicating that the virtual element has a collision condition at the current moment is generated, and the existing collision condition indicates that the at least two particles in the virtual element have abnormal collision.
In another embodiment, the virtual scene comprises a P-frame scene picture, P being an integer greater than 1; in running the virtual scene, the one or more instructions may be loaded and executed by the processor, respectively:
when a p-th frame scene picture of the virtual scene is displayed, acquiring attribute information of collision objects in the virtual scene in the p-th frame scene picture; the collision object includes: particles supporting self-collision in the virtual element or collision bodies in the virtual scene, p epsilon [1, P-1];
if the acquired attribute information meets the preset condition, segmenting the display interval duration between the p-th frame scene picture and the p+1-th frame scene picture to obtain a plurality of time points, wherein the last time point in the plurality of time points is the display time corresponding to the p+1-th frame scene picture;
Sequentially detecting a plurality of time points, and triggering and executing the step of acquiring the element model of the virtual element in the virtual scene when one time point is detected;
wherein, when the current time is the last time point of the plurality of time points, the step of rendering and displaying the virtual element by using the target form data of the virtual element at the current time point is executed.
In another embodiment, the attribute information is at least one of: volume and speed of movement; the preset conditions include at least one of the following: the volume need be less than or equal to a preset volume threshold and the speed of movement need be greater than or equal to a preset speed threshold.
The method comprises the steps of obtaining an element model of a virtual element in a virtual scene in the process of running the virtual scene, and carrying out physical simulation on the form of the virtual element at the current moment according to information which is included in the element model and is required for carrying out physical simulation on the form of the virtual element at the current moment, so as to obtain simulated form data. The information in the element model is comprehensive information required by physical simulation, physical characteristics of the virtual element in the virtual scene can be simulated based on the information, more accurate form data can be further obtained, the form of the virtual element displayed when moving in the virtual scene is facilitated to approach the real world, the virtual element has a more realistic simulation effect, and the display effect of the virtual element is further improved. Furthermore, based on the simulated form data, the collision condition of the virtual element at the current moment can be detected, and further the simulated form data can be calibrated according to the detected collision detection result, so that the target form data of the virtual element at the current moment can be obtained. In the process, the simulated form data is taken as the detection basis for collision detection, the obtained collision detection result can reflect various collision conditions of the virtual element more comprehensively and accurately, and further the simulated form data can be calibrated more accurately according to the collision detection result, so that more real and accurate target form data can be obtained. Compared with the simulated morphological data, the target morphological data can be more accurate morphological data, the virtual element is rendered and displayed by adopting the target morphological data at the current moment, and when no collision exists or a collision condition which does not influence the collision effect exists, the virtual element which is more true and close to the real world can be rendered and displayed based on the target morphological data with higher accuracy, so that the virtual element has a better display effect; when the collision condition affecting the collision effect exists, the repair of the collision condition can be realized based on the calibration of the simulated morphological data, so that the better collision effect can be ensured, the collision effect is controllable, and the display effect of the virtual element is further improved.
It should be noted that, according to an aspect of the present application, there is also provided a computer program product or a computer program, which comprises computer instructions stored in a computer readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the methods provided in the various alternatives to the method embodiment aspects shown in fig. 2 or fig. 4 described above. It is to be understood that the foregoing disclosure is only of the preferred embodiments of the present application and is not, of course, intended to limit the scope of the claims hereof, as defined by the appended claims.

Claims (20)

1. A method of data processing, comprising:
in the process of running a virtual scene, obtaining an element model of a virtual element in the virtual scene, wherein the virtual element is an element supporting deformation in the motion process, and the element model comprises: the information required when the form of the virtual element at the current moment is subjected to physical simulation;
According to the information in the element model, performing physical simulation on the form of the virtual element at the current moment to obtain simulated form data;
based on the simulated morphological data, detecting the collision condition of the virtual element at the current moment in the virtual scene to obtain a collision detection result;
calibrating the simulated morphological data according to the collision detection result to obtain target morphological data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment.
2. The method of claim 1, wherein calibrating the simulated morphology data based on the collision detection results to obtain target morphology data of the virtual element at the current time comprises:
if the collision detection result indicates that the virtual element has no collision condition at the current moment, the simulated form data are used as target form data of the virtual element at the current moment;
if the collision detection result indicates that the virtual element has a collision condition at the current moment, determining a target response strategy for responding to the existing collision condition, and calibrating the simulated form data according to the target response strategy to obtain target form data of the virtual element at the current moment.
3. The method of claim 2, wherein the virtual element comprises a plurality of particles, and the simulated morphological data comprises: simulation motion data of each particle in the virtual element at the current moment; the determining a target response strategy for responding to an existing collision condition includes:
if the existing collision situation indicates that at least two particles in the virtual element have abnormal collision, the first response strategy is used as a target response strategy for responding to the existing collision situation; the first response policy is to indicate: adjusting simulation motion data of each particle which is abnormally collided in the virtual element at the current moment;
if the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene have abnormal collision, acquiring motion information of the corresponding particles moving due to the abnormal collision, and determining a target response strategy for responding to the existing collision condition according to the motion information; the collision body refers to an object supporting collision with the virtual element in the virtual scene.
4. The method of claim 3, wherein the motion information comprises a motion distance; the determining a target response strategy for responding to the existing collision condition according to the motion information comprises the following steps:
If the movement distance is smaller than the distance threshold value, the second response strategy is used as a target response strategy for responding to the existing collision condition; wherein the second response policy is for indicating: adjusting simulated motion data of particles with abnormal collision in the virtual element at the current moment, or adjusting attribute information of the collision body at the current moment;
if the movement distance is greater than or equal to a distance threshold, the third response strategy is used as a target response strategy for responding to the existing collision condition; wherein the third response policy is for indicating: and adjusting the simulated motion data of the particles with abnormal collision in the virtual element at the current moment, and adjusting the attribute information of the collision body at the current moment.
5. The method of claim 4, wherein the simulated motion data for any particle at the current time comprises: the current acceleration of the corresponding particle at the current moment;
if the current acceleration of the particle, which is abnormally collided with the collision body, in the virtual element is larger than the current acceleration of the collision body, the second response strategy is used for indicating: adjusting simulation motion data of particles which are abnormally collided in the virtual element at the current moment;
If the current acceleration of the particle, which is abnormally collided with the collision body, in the virtual element is smaller than the current acceleration of the collision body, the second response strategy is used for indicating: adjusting attribute information of the collision body at the current moment;
wherein the current acceleration of the collision body means: acceleration of the collision body used before the occurrence of an abnormal collision.
6. The method of claim 4, wherein the attribute information of the collision volume at the current time includes: form data of the collision body at the current moment and physical properties of the collision body at the current moment; wherein the physical attributes include at least one of: coefficient of elasticity and coefficient of friction;
the abnormal collision includes: collision penetration or abnormal impact; the abnormal impact includes at least one of: the rebound distance of rebound due to collision is larger than or equal to the rebound distance threshold value, the motion track of motion due to collision is abnormal, and the motion direction of motion due to collision is abnormal;
if the abnormal collision is the collision penetration, adjusting the attribute information of the collision body at the current moment comprises: adjusting the form data of the collision body at the current moment; if the abnormal collision is the abnormal collision, adjusting the simulation information of the collision body at the current moment comprises at least one of the following steps: and adjusting the form data of the collision body at the current moment and adjusting the physical attribute of the collision body at the current moment.
7. The method of claim 6, wherein the morphology data of the collision volume at the current time comprises at least one of: the pose of the collision body at the current moment and the motion state of the collision body at the current moment;
wherein adjusting the pose of the collision body at the current moment comprises at least one of the following: controlling the collision body to move towards a direction far away from the virtual element in a virtual scene so as to adjust the position of the collision body at the current moment, reduce the volume of the collision body at the current moment and change the shape of the collision body at the current moment;
adjusting the motion state of the collision body includes at least one of: and controlling the movement speed of the collision body within a preset speed range, and adjusting the acceleration of the collision body.
8. The method of any one of claims 3-7, wherein the collision body comprises: a collision body of a first type or a collision body of a second type;
wherein the collision volume of the first type comprises at least one of: capsule, sphere and cube; the collision volume of the second type comprises: a collision volume constructed based on a triangular mesh.
9. The method of claim 2, further comprising a collision volume in the virtual scene, the collision volume being an object in the virtual scene that supports collisions with the virtual element; the method further comprises the steps of:
acquiring attribute information of a collision body in the virtual scene at the current moment;
calibrating attribute information of the collision body at the current moment according to the collision detection result to obtain calibrated attribute information;
and when the virtual element is rendered and displayed by adopting the target form data, rendering and displaying the collision body according to the calibrated attribute information.
10. The method of claim 9, wherein calibrating the attribute information of the collision body at the current time according to the collision detection result to obtain the calibrated attribute information comprises:
if the collision detection result indicates that the virtual element has no collision condition at the current moment, the attribute information of the collision body at the current moment is used as calibrated attribute information;
and if the collision detection result indicates that the virtual element has a collision condition at the current moment, calibrating the attribute information of the collision body at the current moment according to the target response strategy to obtain the calibrated attribute information.
11. The method of claim 1, wherein the virtual element comprises a plurality of particles; the method further comprises the steps of:
displaying the virtual element and the element brush in an element editor, and continuously detecting a control operation for the element brush in the element editor;
when one control operation is detected, calling the element brush to select a target area from the displayed virtual elements according to the currently detected control operation;
according to the parameter configuration operation aiming at the target area, uniformly configuring parameters of each particle in the target area to obtain the parameter information of each particle in the target area; the parameter information of any particle includes: distance constraint parameters and physical attribute parameters, the distance constraint parameters of any particle are used for constraining the distance between the corresponding particle and other particles;
and adding parameter information of each particle in the target area to an element model of the virtual element.
12. The method of claim 11, wherein the parameter configuration operation for the target region comprises: configuring the operation of a textile algorithm of the target area;
The parameter information of each particle in the target region further includes: according to the connection mode of the corresponding particles determined by the textile algorithm configured for the target area;
when the configured weaving algorithm is the first weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with particles adjacent to the ith particle in a preset direction;
when the configured weaving algorithm is the second weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with a particle indirectly adjacent to the ith particle in a preset direction;
when the configured weaving algorithm is a third weaving algorithm, the connection mode of the ith particle in the target area is used for indicating: connecting the ith particle with particles spaced from the ith particle by H particles in a preset direction;
wherein I e [1, I ], I is the number of particles in the target region, and H is an integer greater than 1.
13. The method of claim 12, wherein if the current time is a time of an initial run of the virtual scene, the information in the element model further comprises: the pre-configured form data of the virtual element at the current moment; the morphological data includes a location in the virtual scene where each particle in the virtual element is located; the method further comprises the steps of:
Traversing each particle at the region edge of the target region, and determining the currently traversed particle as the current particle;
taking particles which are positioned outside the target area and are adjacent to the current particles in the virtual element as target particles;
if the connection mode of the current particle is different from the connection mode of the target particle, smoothing the position corresponding to the current particle and the position corresponding to the target particle in the morphological data included in the element model so as to update the morphological data included in the element model.
14. The method of claim 1, wherein the virtual element comprises a plurality of particles, and if the current time is not a starting runtime of the virtual scene, the information in the element model comprises: target form data of the virtual element at the previous moment, a distance constraint parameter and a physical attribute parameter of each particle in the virtual element;
and performing physical simulation on the form of the virtual element at the current moment according to the information in the element model to obtain simulated form data, wherein the method comprises the following steps:
invoking a physical simulation engine, and calculating the acting force of each particle at the previous moment according to the physical attribute parameters of each particle included in the element model and the acting force influence factors configured for the virtual elements;
Invoking the physical simulation engine to respectively calculate the form indication information of the virtual element according to the acting force received by each particle at the previous moment and the distance constraint parameter of the corresponding particle;
and updating the target form data of the virtual element at the previous moment by adopting the form indication information of the virtual element to obtain the simulated form data.
15. The method of claim 1, wherein the virtual element comprises a plurality of particles, and the simulated morphological data comprises: the simulated position of each particle in the virtual element at the current moment; the virtual scene also comprises a collision body, wherein the collision body refers to an object which supports collision with the virtual element in the virtual scene;
based on the simulated morphological data, detecting the collision condition of the virtual element at the current moment in the virtual scene to obtain a collision detection result, wherein the collision detection result comprises:
determining a relative positional relationship between the virtual element and the collision body based on a simulated position of each particle in the virtual element at a current time and a position of the collision body at the current time;
if the relative position relationship indicates that the particles in the virtual element are located in the three-dimensional space where the collision body is located in the virtual scene, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, wherein the existing collision condition indicates that the particles in the virtual element have abnormal collision with the collision body in the virtual scene;
If the relative position relationship indicates that particles in the virtual element are in a collision detection area of the collision body, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, wherein the existing collision condition indicates that the particles in the virtual element and the collision body in the virtual scene collide normally; the collision detection area is a two-dimensional area which is determined by taking the collision body as a center according to a first collision detection radius.
16. The method of claim 1, wherein the virtual element comprises a plurality of particles, and the simulated morphology data comprises a simulated position of each particle at a current time; the virtual scene comprises a collision body, wherein the collision body refers to an object which supports collision with the virtual element in the virtual scene;
based on the simulated morphological data, detecting the collision condition of the virtual element at the current moment in the virtual scene to obtain a collision detection result, wherein the collision detection result comprises:
according to the simulation position of each particle in the virtual element at the current moment and the second collision detection radius, determining a self-collision detection area of each particle respectively;
Intersecting detection is carried out on the self-collision detection areas of the particles in the virtual element, so that a detection result is obtained;
if the detection result indicates that the self-collision detection areas with at least two particles intersect, generating a collision detection result for indicating that the virtual element has a collision condition at the current moment, wherein the existing collision condition indicates that at least two particles in the virtual element have abnormal collision.
17. The method of claim 1, wherein the virtual scene comprises a P-frame scene picture, P being an integer greater than 1; in the process of running the virtual scene, the method further comprises the following steps:
when a p-th frame scene picture of the virtual scene is displayed, acquiring attribute information of collision objects in the virtual scene in the p-th frame scene picture; the collision object includes: particles with self-collision or collision bodies in the virtual scene are supported in the virtual element, and p epsilon [1, P-1];
if the acquired attribute information meets the preset condition, segmenting the display interval duration between the p-th frame scene picture and the p+1st frame scene picture to obtain a plurality of time points, wherein the last time point in the plurality of time points is the display time corresponding to the p+1st frame scene picture;
Sequentially detecting the time points, and triggering and executing the step of acquiring the element model of the virtual element in the virtual scene when one time point is detected;
executing the step of rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment when the current moment is the last time point in the plurality of time points; the attribute information is at least one of the following: volume and speed of movement; the preset conditions include at least one of the following: the volume is required to be less than or equal to a preset volume threshold and the speed of movement is required to be greater than or equal to a preset speed threshold.
18. A data processing apparatus, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring an element model of a virtual element in a virtual scene in the process of running the virtual scene, the virtual element is an element supporting deformation in the motion process, and the element model comprises: the information required when the form of the virtual element at the current moment is subjected to physical simulation;
the processing unit is used for carrying out physical simulation on the form of the virtual element at the current moment according to the information in the element model to obtain simulated form data;
The processing unit is further used for detecting the collision condition of the virtual element at the current moment in the virtual scene based on the simulated morphological data to obtain a collision detection result;
the processing unit is further used for calibrating the simulated form data according to the collision detection result to obtain target form data of the virtual element at the current moment; and rendering and displaying the virtual element by adopting the target form data of the virtual element at the current moment.
19. A computer device comprising an input interface and an output interface, further comprising: a processor and a computer storage medium;
wherein the processor is adapted to implement one or more instructions, the computer storage medium storing one or more instructions adapted to be loaded by the processor and to perform a data processing method as claimed in any one of claims 1 to 17.
20. A computer storage medium storing one or more instructions adapted to be loaded by a processor and to perform a data processing method according to any one of claims 1 to 17.
CN202310798206.2A 2023-07-03 2023-07-03 Data processing method, device, equipment and storage medium Active CN116510295B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310798206.2A CN116510295B (en) 2023-07-03 2023-07-03 Data processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310798206.2A CN116510295B (en) 2023-07-03 2023-07-03 Data processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116510295A true CN116510295A (en) 2023-08-01
CN116510295B CN116510295B (en) 2023-09-12

Family

ID=87390642

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310798206.2A Active CN116510295B (en) 2023-07-03 2023-07-03 Data processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116510295B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104881557A (en) * 2015-06-19 2015-09-02 南京大学 Method for dynamically simulating human body and clothing in computer
CN105976418A (en) * 2016-06-28 2016-09-28 珠海金山网络游戏科技有限公司 Design system and method for human dynamic bone
US20180268591A1 (en) * 2015-02-15 2018-09-20 Zhejiang University Real-Time Animation Method for Hair-Object Collisions
CN111249719A (en) * 2020-01-20 2020-06-09 腾讯科技(深圳)有限公司 Track prompting method and device, storage medium and electronic device
US20230166398A1 (en) * 2021-11-30 2023-06-01 Fanuc Corporation Collision handling methods in grasp generation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180268591A1 (en) * 2015-02-15 2018-09-20 Zhejiang University Real-Time Animation Method for Hair-Object Collisions
CN104881557A (en) * 2015-06-19 2015-09-02 南京大学 Method for dynamically simulating human body and clothing in computer
CN105976418A (en) * 2016-06-28 2016-09-28 珠海金山网络游戏科技有限公司 Design system and method for human dynamic bone
CN111249719A (en) * 2020-01-20 2020-06-09 腾讯科技(深圳)有限公司 Track prompting method and device, storage medium and electronic device
US20230166398A1 (en) * 2021-11-30 2023-06-01 Fanuc Corporation Collision handling methods in grasp generation

Also Published As

Publication number Publication date
CN116510295B (en) 2023-09-12

Similar Documents

Publication Publication Date Title
EP1723861B1 (en) Method and device for simulating wearing of a knit garment
JP6266873B2 (en) Apparatus, system and method for simulating materials
CN105976418A (en) Design system and method for human dynamic bone
CN106780766B (en) Matching implementation method and relevant apparatus
CN105354879A (en) Particle spring structure based universal garment three-dimensional model simulation method and system
CN106296778A (en) Virtual objects motion control method and device
US11094115B2 (en) Generating clothing patterns of garment using bounding volumes of body parts
CN106204697B (en) A kind of cloth tearing dynamic simulator system
KR102553955B1 (en) Method of generating training data of artificail neural network for estimatng material property of fabric, method and apparatus of estimatng material property of fabric
CN114299200A (en) Cloth animation processing method and device, electronic equipment and storage medium
CN112114663A (en) Implementation method of virtual reality software framework suitable for visual and tactile fusion feedback
CN116510295B (en) Data processing method, device, equipment and storage medium
CN109002571B (en) Cloth dynamic simulation method based on isogeometric spring particle model
US9111391B2 (en) Image generating device, image generating method, and non-transitory information storage medium
CN115170701A (en) Cloth processing method and device, electronic equipment and readable storage medium
Sengupta et al. Virtual garment simulation
KR20190070884A (en) Method and apparatus for automating 3D item digital conversion in 3D item simulation
CN110717297A (en) Method and system for establishing fabric simulation model, storage medium and electronic equipment
KR101134534B1 (en) 3D Simulation Method Using Material Points
Li et al. An object-oriented system for dynamics-based 3D cloth simulation
Li et al. A novel adaptive update method for over-stretching treatment in clothing animation
CN114170354A (en) Virtual character clothing manufacturing method, device, equipment, program and readable medium
Wong High performance virtual clothing dynamics
KR101683780B1 (en) method and apparatus for changing physical properties of patterns
Simnett Real-time simulation and visualisation of cloth using edge-based adaptive meshes

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40091130

Country of ref document: HK