Collision effect adding method and device, equipment, storage medium
By acquiring image data and collision parameters, and utilizing optical flow components and particle systems, collision effects can be easily added, solving the problems of cumbersome operation and complexity in existing technologies, and achieving efficient collision effect generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2026-03-27
AI Technical Summary
In existing technologies, adding collision effects is cumbersome and complex, making it difficult to achieve collision effects between image data and particle systems in modeling software.
By acquiring the image data and collision parameters of the object to be collided with, optical flow conversion is performed using an optical flow component, and particle interaction is carried out in the particle system to add collision effects.
It enables convenient and rapid addition of collision effects, saves terminal power consumption, and solves the problems of cumbersome and complex operation.
Smart Images

Figure CN116342844B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and relate to but are not limited to a collision effect adding method and device, equipment and storage medium. BACKGROUND
[0002] Object collision is widely used in virtual reality and virtual game fields. Adding or implementing collision effect can enable users to enjoy immersive experience and effect, and enhance user experience.
[0003] In the prior art, a scheme for implementing or adding collision effect is as follows: manually setting corresponding force field, rigid body and other parameters for different three-dimensional models in modeling software, so that the three-dimensional models have collision effect in motion. This scheme is complicated to operate and increases complexity. SUMMARY
[0004] Therefore, the collision effect adding method and device, equipment and storage medium provided by embodiments of the present application can solve the problem of complicated operation and increased complexity in the prior art.
[0005] In a first aspect, the present application provides a collision effect adding method, comprising:
[0006] obtaining image data of a to-be-collided object;
[0007] obtaining collision parameters, the collision parameters being used to reflect a collision effect required to be generated in a current scene;
[0008] adding corresponding collision effect to the to-be-collided object based on the collision parameters and the image data of the to-be-collided object.
[0009] In some embodiments, the adding corresponding collision effect to the to-be-collided object based on the collision parameters and the image data of the to-be-collided object comprises:
[0010] performing optical flow conversion on the image data of the to-be-collided object to obtain an optical flow image of the to-be-collided object;
[0011] performing particle interaction on the optical flow image of the to-be-collided object based on the collision parameters, to add corresponding collision effect of the to-be-collided object in a particle system.
[0012] In some embodiments, the obtaining image data of a to-be-collided object comprises:
[0013] calling an optical flow (opticalFlow) component to obtain image data of a to-be-collided object.
[0014] In some embodiments, the obtaining collision parameters comprises:
[0015] The particles processing particlesGpu component is called to obtain the collision parameter.
[0016] In some embodiments, the collision parameter comprises configuration parameters of an opticalFlow component and configuration parameters of a particlesGpu component, wherein the configuration parameters of the opticalFlow component are used to reflect a required motion force generated by the object to be collided in a particle system, and the configuration parameters of the particlesGpu component are used to reflect a required collision effect generated by the object to be collided in the particle system.
[0017] In some embodiments, the configuration parameters of the opticalFlow component comprise force field parameters, and the configuration parameters of the particlesGpu component comprise at least one of the following: model size, lens distance, particle drag force, and particle collision range, wherein the model size is determined based on the image data of the object to be collided, and the lens distance is a distance between a virtual lens in the current scene and the object to be collided.
[0018] In some embodiments, the particle collision range is in a linear shape.
[0019] In a second aspect, the embodiments of the present application provide a collision effect adding device, comprising:
[0020] A first obtaining module is configured to obtain image data of an object to be collided.
[0021] A second obtaining module is configured to obtain a collision parameter, wherein the collision parameter is used to reflect a required collision effect in a current scene.
[0022] An effect adding module is configured to add a corresponding collision effect to the object to be collided based on the collision parameter and the image data of the object to be collided.
[0023] For the content not introduced or described in the embodiments of the present application, reference can be made to the related introduction in the method embodiments of the first aspect described above, which will not be repeated here.
[0024] In a third aspect, the embodiments of the present application provide a computer device, comprising a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and the processor implements the method according to the embodiments of the present application when executing the program.
[0025] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method according to the embodiments of the present application.
[0026] Compared with the prior art, the present application has at least the following beneficial effects:
[0027] In the embodiment of the present application, the computer device obtains image data of a to-be-collided object; obtains a collision parameter, the collision parameter being used to reflect a collision effect required to be generated in a current scene; and adds a corresponding collision effect to the to-be-collided object based on the collision parameter and the image data of the to-be-collided object. It can be seen that the present application can add a corresponding collision effect to the to-be-collided object based on the collision parameter and the image data of the to-be-collided object, which can not only realize convenient and rapid addition of the collision effect, but also save terminal power consumption. At the same time, the problems of complicated operation and increased complexity in the prior art are also solved. BRIEF DESCRIPTION OF DRAWINGS
[0028] The drawings incorporated into the specification and forming a part of the specification, show embodiments consistent with the present application, and together with the specification, serve to explain the technical solutions of the present application.
[0029] Figure 1 is a system framework schematic diagram provided by the embodiment of the present application.
[0030] Figure 2 is a structure schematic diagram of a virtual engine provided by the embodiment of the present application.
[0031] Figure 3 is an image transmission schematic diagram based on a virtual engine provided by the embodiment of the present application.
[0032] Figure 4 is a flow schematic diagram of a collision effect adding method provided by the embodiment of the present application.
[0033] Figure 5 is a structure schematic diagram of a collision effect adding device provided by the embodiment of the present application.
[0034] Figure 6 is a structure schematic diagram of a computer device provided by the embodiment of the present application.
[0035] Figure 7 is a structure schematic diagram of a chip provided by the embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the specific technical solutions of the present application will be further described in detail below with reference to the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but not to limit the scope of the present application.
[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application.
[0038] In the following description, reference is made to the accompanying drawings which form a part hereof, and in which are shown, by way of illustration, embodiments for practicing the present application. It is to be understood that other embodiments can be used and structural or
[0039] It should be noted that the terms "first", "second", "third", etc. used in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific order of the objects. It can be understood that the "first", "second", "third" can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0040] The applicant has also found in the process of filing the present application that for input image data, such as picture data captured from a camera, the image data needs to be processed separately to obtain the required action of the object to be collided, such as a portrait; and then the image data is collided with an independent particle system to generate a collision effect. However, in the prior art, it is not possible to implement in modeling software, that is, it is not possible to process the image data using modeling software and then generate a corresponding collision effect with a particle system.
[0041] To solve the above problems, the present application provides a collision effect adding method and device, equipment and storage medium. First, the system framework diagram applicable to the present application is introduced. Please refer to Figure 1 is a possible system framework diagram provided by the embodiments of the present application. As shown in Figure 1 The system is applied to a computer device, and the system 100 includes a communication unit 110, a memory 120, an input unit 130, a display unit 140, a sensing unit 150, an audio circuit 160, a camera unit 170, a processor 180, and a power supply 190, etc. It can be understood that Figure 1 The system structure shown in the above figure does not constitute a limitation on the computer device, and more or fewer components than the figure, or combination of certain components, or different component arrangement can be included according to actual needs. Among them:
[0042] The communication unit 110 can include a radio frequency (RF) circuit, a wireless fidelity (WiFi) unit, or other modules or units with communication functions. The RF circuit can be used for receiving and sending signals in the process of information or communication, especially for receiving downlink information from a base station and processing the information by the processor 180. In addition, the RF circuit can send uplink data to the base station. Generally, the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, and the like. In addition, the RF circuit can also communicate with a network and other devices through wireless communication. The above wireless communication can use any communication standard or protocol, including but not limited to global system for mobile communication (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short message service (SMS), and the like.
[0043] WiFi belongs to a short-range wireless transmission technology. A computer device can help a user to send and receive emails, browse web pages, and access streaming media through a WiFi unit, which provides the user with wireless broadband Internet access.
[0044] The memory 120 can be used to store software programs and modules. The processor 180 can execute various functions of the computer device and data processing by running the software programs and modules stored in the memory 120. The memory 120 can mainly include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required for a function (such as a sound playing function, an image playing function, and the like), and the like. The data storage area can store data created according to the use of the computer device (such as audio data, a phone book, and the like), and the like. In addition, the memory 120 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.
[0045] The input unit 130 can be used to receive inputted digital or character information, and to generate key signal inputs related to the user settings of the computer device and the control of functions. Specifically, the input unit 130 can include a touch panel 131 and other input devices 132. The touch panel 131, also called a touch screen, can collect touch operations (such as operations of a user using a finger, a stylus, or any suitable object or accessory on or near the touch panel 131) of the user on or near it, and drive the corresponding connection device according to the pre-set program. Optionally, the touch panel 131 can include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, and converts it into touch coordinates and sends it to the processor 180, and can also receive the commands from the processor 180 and execute them. In addition, the touch panel 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 131, the input unit 130 can also include other input devices 132. Specifically, the other input devices 132 can include one or more of a physical keyboard, function keys (such as volume control buttons, on-off buttons, etc.), trackballs, mice, joysticks, etc.
[0046] The display unit 140 can be used to display information input by the user or information provided to the user and various menus of the computer device. The display unit 140 can include a display panel 141, which can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 131 can cover the display panel 141, and when the touch panel 131 detects a touch operation on or near it, it transmits to the processor 180 to determine the type of touch event, and then the processor 180 provides corresponding visual output on the display panel 141 according to the type of touch event. Although in the above description, the touch panel 131 and the display panel 141 are realized as two independent components to realize the input and output functions of the computer device, in some embodiments, the touch panel 131 and the display panel 141 can be integrated to realize the input and output functions of the computer device. Figure 1
[0047] The sensing unit 150 includes at least one sensor, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor can include an ambient light sensor to adjust the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor to turn off the display panel 141 and / or the backlight when the computer device is moved close to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude and direction of the acceleration in each direction (typically three axes), the magnitude and direction of the gravity when the device is static, and can be used for identifying the device posture application (such as landscape / portrait screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, knock), and the like. As for other sensors that can also be configured on the computer device, such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, will not be described here.
[0048] The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the computer device. The audio circuit 160 can convert the received audio data into an electrical signal, transmit it to the speaker 161, and convert it into a sound signal output by the speaker 161. On the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data. After being processed by the processor 180, the audio data is transmitted to another device via the communication unit 110, or output to the storage 120 for further processing.
[0049] The camera unit 170 is used to implement the shooting function and collect corresponding shooting images, such as still images, dynamic images, or videos. In actual application, the camera unit 170 can include at least one camera, and the number and type of the camera are not limited in the present application, such as but not limited to a long-focus camera, a short-focus camera, an infrared camera, or other cameras with shooting functions. The specific structure of the camera will not be described here.
[0050] The processor 180 is the control center of the computer device, which connects all parts of the computer device through various interfaces and lines, executes the software programs and / or modules stored in the storage 120, and calls the data stored in the storage 120, to perform various functions and process data of the computer device, thereby monitoring the computer device as a whole. Optionally, the processor 180 can include one or more processing units; preferably, the processor 180 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 180.
[0051] The system also includes a power supply 190 (such as a battery) for powering the various components. Preferably, the power supply can be logically connected to the processor 180 through a power management system, so that the power management system can manage charging, discharging, and power consumption management, etc. The computer device can also include a communication interface, a key, a motor, a Bluetooth module, etc., which will not be described here.
[0052] The computer device of the present application includes, but is not limited to, a smart phone (such as an Android phone, an IOS phone, etc.), a personal computer, a tablet computer, a palm computer, an electronic reader, a mobile Internet device (MID), a wearable smart device, or other devices with communication functions, etc.
[0053] Next, an embodiment of a virtual engine adapted by the present application is introduced. Please refer to Figure 2 is a possible structure diagram of a virtual engine provided by an embodiment of the present application. As Figure 2 shown, the virtual engine 200 is a virtual engine in a computer device, which can include an optical flow component 201 and a particle processing component 202. It can be understood that Figure 2 the component structure shown in the figure does not constitute a limitation on the virtual engine 200, and more or fewer functional components than shown can be included according to actual needs, which is not limited by the present application. Among them:
[0054] The virtual engine 200 of the present application is mainly used to add or realize corresponding collision effects for the object to be collided. In actual application, the virtual engine 200 can be a pixel particle TouchDesigner interactive engine, or other software engines for realizing / adding collision effects, etc., which is not limited by the present application.
[0055] The optical flow component 201 is mainly used for optical flow conversion of image data of the object to be collided, to convert into a corresponding optical flow image. The optical flow image is used to represent the motion information of the object to be collided, so as to facilitate subsequent generation of corresponding forces on the particle system based on the motion information, to realize corresponding collision effects. The optical flow component 201 can also transmit the optical flow image of the object to be collided to the particle processing component 202 for processing. Please refer to Figure 3 is a possible image transmission diagram based on a virtual engine provided by an embodiment of the present application. As Figure 3 shown, after obtaining the image data of the object to be collided, the virtual engine 200 can transmit the image data to the optical flow component 201 for processing, and then transmit the processed optical flow image to the particle processing component 202 for processing via the optical flow component 201.
[0056] Optical flow or optic flow, which is related to the present application, is a concept in the detection of object motion in a field of view. It is used to describe the motion of an observed target, surface or edge caused by motion relative to an observer. Optical flow is very useful in pattern recognition, computer vision and other image processing fields, and can be used for motion detection, object cutting, collision time and object expansion calculation, motion compensation coding, or stereoscopic measurement through object surfaces and edges, etc. without limitation.
[0057] The particlesGpu component 202 is mainly used to receive the optical flow image sent by the opticalFlow component 201, and to generate particle interaction based on the optical flow image and the particle system (such as particles in the particle system) to add corresponding collision effects to the object to be collided.
[0058] It should be noted that the opticalFlow component 201 and the particlesGpu component 202 shown in the present application are only example components in the virtual engine 200, and more or fewer functional components can be included according to actual conditions, which are not limited herein.
[0059] Based on the foregoing embodiments, the following describes a method embodiment applicable to the present application.
[0060] Please refer to Figure 4 is a flow diagram of a possible collision effect adding method provided by an embodiment of the present application. As Figure 4 shown, the method is applied to a computer device, and can be specifically applied to a virtual engine in the computer device. The method includes the following implementation steps:
[0061] S401, obtaining image data of an object to be collided.
[0062] The present application does not limit the implementation manner of obtaining image data, for example, the image data of the object to be collided can be obtained by shooting through a camera device, or the image data of the object to be collided can be received from other devices (such as terminal devices or servers) through a network.
[0063] In actual application, the present application can obtain the image data of the object to be collided by calling the opticalFlow component in the virtual engine (such as the TouchDesigner interactive engine), and the image data of the present application is usually two-dimensional image data.
[0064] Before calling the opticalFlow component, the present application can pre-configure corresponding working parameters of the opticalFlow component, which can be referred to as configuration parameters of the opticalFlow component. The configuration parameters of the opticalFlow component are mainly used to indicate or reflect the required motion force of the to-be-collided object in the particle system, and can be understood as the force that the to-be-collided object can generate in the particle system to a certain extent. In actual application, the configuration parameters of the opticalFlow component can include but are not limited to, for example, force field parameters, rigid body parameters or other custom parameters, etc.
[0065] S402, obtain collision parameters, the collision parameters are used to reflect the required collision effect in the current scene.
[0066] The present application does not limit the implementation manner of obtaining the collision parameters, for example, the present application can obtain the collision parameters by calling the particlesGpu component in the virtual engine (such as the TouchDesigner interactive engine). The collision parameters of the present application are mainly used to indicate or reflect the collision effect that is intended / required to be generated in the current scene. Different collision parameters can be set for different application scenarios, that is, the present application can set appropriate collision parameters in combination with the current application scenario (referred to as the current scene), so that the image data of the to-be-collided object is more obvious in the collision effect, which is not limited and described here.
[0067] Before calling the particlesGpu component, the present application also needs to pre-configure corresponding working parameters of the particlesGpu component, which can be referred to as configuration parameters of the particlesGpu component. The configuration parameters of the particlesGpu component are mainly used to indicate or reflect the required collision effect of the to-be-collided object in the particle system, which can include but are not limited to any one or a combination of more of the following: for example, model size, lens distance, particle drag strength, particle collision range, screen display information or other custom information, etc. Among them:
[0068] The model size is determined based on the image data of the to-be-collided object. In the implementation process, the particlesGpu component can generate a plane image according to the received image data, and use the screen image as the model of the to-be-collided object, that is, the model size that can be collided. The screen display information includes but is not limited to the size information (such as length and / or width) of the display screen and the resolution or other display screen information of the display screen. The lens distance refers to the distance between the virtual lens in the current scene and the to-be-collided object. The particle drag strength and the particle collision range are both parameters for limiting / regulating the particle collision effect.
[0069] In practical applications, the particlesGpu component can adjust the model size and lens distance according to the actual required output screen resolution. For example, when the resolution of the output display screen needs to be 1080p or 720p, the application can set different model sizes and lens distances in the program code according to the model size generated by the planar image, so as to adjust the shooting range of the lens. If the model size and lens distance are not adjusted, the to-be-collided object will be located at the edge of the lens shooting picture, and the effect picture formed after subsequent processing will not correctly correspond the to-be-collided object and the object in the lens picture, resulting in poor game experience for the player / guest. It can be seen that the application can set or adjust the corresponding component configuration parameters according to the display requirements of the picture.
[0070] The application also adjusts the particle dragging force and particle collision range according to the visual effect. For example, the high and low of the particle dragging force can control the collision effect of the to-be-collided object in the particle system, and the higher the particle dragging force, the higher the speed of the collided particle in the collision process. However, too high particle dragging force can easily cause the picture to become very chaotic and fancy during the collision process.
[0071] It can be understood that the collision range of the particle usually appears in a cubic square by default, and the planar collision model generated by the application based on the image data of the to-be-collided object (which is two-dimensional planar image data) lacks thickness data and is located at the center of the cubic square, resulting in that most of the particles cannot achieve the collision effect. Therefore, the application needs to change the collision range of the particle from a cubic square to a line, that is, the particle collision range of the application needs to be linear in shape, so that the state of the particle generation is also presented in a planar manner, which can make the central planar image data more intuitive to produce a collision relationship with the particle system. At the same time, since the particle generation has a length range setting, it usually needs to be manually adjusted, and the length of the linear particle generation will be stretched according to the lens distance in the program, which can better fill the picture and improve the display quality and effect of the picture.
[0072] In practical applications, the collision parameters of the application can include the configuration parameters of the opticalFlow component and the configuration parameters of the particlesGpu component. The configuration parameters of the opticalFlow component and the particlesGpu component can be referred to the related description in the foregoing embodiments, which will not be repeated here.
[0073] S403, based on the collision parameters and the image data of the to-be-collided object, adding a corresponding collision effect to the to-be-collided object.
[0074] The application can perform optical flow conversion on the image data of the to-be-collision object by calling the opticalFlow component in the virtual engine to obtain an optical flow image of the to-be-collision object. The implementation of optical flow conversion can be referred to the foregoing Figure 2 In the related introduction in the embodiments, details are not repeated here. After obtaining the optical flow image, the opticalFlow component can transmit the optical flow image to the particlesGpu component, so that the particlesGpu component can interact with the particle system. In the implementation process, the application can further call the particlesGpu component in the virtual engine to perform particle interaction on the optical flow image of the to-be-collision object based on the collision parameters, so as to add corresponding collision effects for the to-be-collision object in the particle system. The application does not limit the implementation of the foregoing particle interaction. For example, the application can add the collision effect of the to-be-collision object by using the particle system to make or add corresponding particles, so as to complete the addition of the collision effect of the to-be-collision object.
[0075] By implementing the embodiments of the application, the computer device obtains image data of a to-be-collision object; obtains collision parameters, the collision parameters being used to reflect a collision effect to be generated in a current scene; and adds a corresponding collision effect for the to-be-collision object based on the collision parameters and the image data of the to-be-collision object. It can be seen that the application can add a corresponding collision effect for the to-be-collision object based on the collision parameters and the image data of the to-be-collision object, which not only realizes convenient and rapid addition of the collision effect, but also saves terminal power consumption. At the same time, the problems of complicated operation and increased complexity in the prior art are also solved.
[0076] It should be understood that, although Figure 4 The steps in the flowchart of the application are displayed in sequence according to the arrows, but these steps are not necessarily executed in sequence according to the arrows. Unless otherwise specified in this document, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, Figure 4 At least part of the steps in the application can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these sub-steps or stages is not necessarily sequential, but can be executed in rotation or alternation with other steps or sub-steps or stages of other steps.
[0077] Based on the foregoing embodiments, this application provides a collision effect adding device, which includes various modules and units included in each module, and can be implemented by a processor; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), microprocessor (MPU), digital signal processor (DSP) or field programmable gate array (FPGA), etc.
[0078] Please see Figure 5 This is a schematic diagram of a collision effect adding device provided in an embodiment of this application. Figure 5 The device shown includes a first acquisition module 501, a second acquisition module 502, and an effect addition module 503; wherein:
[0079] The first acquisition module 501 is used to acquire image data of the object to be collided with;
[0080] The second acquisition module 502 is used to acquire collision parameters, which are used to reflect the collision effect required in the current scene;
[0081] The effect addition module 503 is used to add corresponding collision effects to the object to be collided based on the collision parameters and the image data of the object to be collided.
[0082] In some embodiments, the effect-adding module 503 is specifically used for:
[0083] Optical flow conversion is performed on the image data of the object to be collided with to obtain the optical flow image of the object to be collided with;
[0084] Based on the collision parameters, particle interaction is performed on the optical flow image of the object to be collided with, so as to add the collision effect corresponding to the object to be collided with to the particle system.
[0085] In some embodiments, the first acquisition module 501 is specifically used for:
[0086] Call the opticalflow component to obtain the image data of the object to be collided with.
[0087] In some embodiments, the second acquisition module 502 is specifically used for:
[0088] Call the particlesGpu component to obtain collision parameters.
[0089] In some embodiments, the collision parameters include configuration parameters of the opticalFlow component and configuration parameters of the particlesGpu component, wherein the configuration parameters of the opticalFlow component are used to reflect the motion force required to be generated by the object to be collided in the particle system, and the configuration parameters of the particlesGpu component are used to reflect the collision effect required to be generated by the object to be collided in the particle system.
[0090] In some embodiments, the configuration parameters of the opticalFlow component include force field parameters, and the configuration parameters of the particlesGpu component include at least one of the following: model size, camera distance, particle dragging force, and particle collision range; wherein, the model size is determined based on the image data of the object to be collided with, and the camera distance is the distance between the virtual camera in the current scene and the object to be collided with.
[0091] In some embodiments, the particle collision range is linear.
[0092] The description of the above device embodiments is similar to that of the above method embodiments, and has similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0093] It should be noted that, in the embodiments of this application... Figure 5 The collision effect addition device shown is illustrative of the module division, representing only a logical functional division; in actual implementation, other division methods may be used. Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, exist as separate physical units, or be integrated into one unit by two or more units. The integrated units can be implemented in hardware, as software functional units, or a combination of both.
[0094] It should be noted that, in the embodiments of the present application, if the above-mentioned method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes a plurality of instructions for causing an electronic device to execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various media that can store program codes. Thus, the embodiments of the present application are not limited to any particular hardware and software combination.
[0095] The computer device provided in the embodiments of the present application can be a smart phone, and its internal structure diagram can be as shown in Figure 6 The computer device includes a processor, a memory and a network interface connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a collision effect adding method.
[0096] The computer readable storage medium provided in the embodiments of the present application stores a computer program, and the computer program is executed by a processor to implement the steps in the method provided in the above-mentioned embodiments.
[0097] The computer program product provided in the embodiments of the present application includes instructions, and when the computer program product is executed on a computer, the computer is caused to execute the steps in the method provided in the above-mentioned method embodiments.
[0098] Those skilled in the art can understand that Figure 6 The structure shown in the above-mentioned embodiments is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0099] In one embodiment, the apparatus provided in the present application can be implemented in the form of a computer program. The computer program can be executed on a computer such as Figure 6The computer device shown runs. The memory of the computer device can store various program modules constituting the sampling device, such as, Figure 5 The first acquisition module, the second acquisition module and the effect adding module shown. The computer program constituted by each program module makes the processor execute the steps in the collision effect adding method of each embodiment of the present application described in the specification.
[0100] In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the following steps:
[0101] Obtain image data of a to-be-collided object;
[0102] Obtain collision parameters, the collision parameters being used to reflect a collision effect required to be generated in a current scene;
[0103] Based on the collision parameters and the image data of the to-be-collided object, add a corresponding collision effect to the to-be-collided object.
[0104] In one embodiment, the adding of the corresponding collision effect to the to-be-collided object based on the collision parameters and the image data of the to-be-collided object comprises:
[0105] Perform optical flow conversion on the image data of the to-be-collided object to obtain an optical flow image of the to-be-collided object;
[0106] Based on the collision parameters, perform particle interaction on the optical flow image of the to-be-collided object to add a corresponding collision effect of the to-be-collided object in a particle system.
[0107] In one embodiment, the obtaining of the image data of the to-be-collided object comprises:
[0108] Call an optical flow component to obtain the image data of the to-be-collided object.
[0109] In one embodiment, the obtaining of the collision parameters comprises:
[0110] Call a particle processing component to obtain the collision parameters.
[0111] In one embodiment, the collision parameters comprise configuration parameters of an optical flow component and configuration parameters of a particle processing component, wherein the configuration parameters of the optical flow component are used to reflect a motion force required to be generated by the to-be-collided object in a particle system, and the configuration parameters of the particle processing component are used to reflect a collision effect required to be generated by the to-be-collided object in the particle system.
[0112] In one embodiment, the configuration parameter of the opticalFlow component includes force field parameters, and the configuration parameter of the particlesGpu component includes at least one of the following: model size, lens distance, particle drag strength, and particle collision range; wherein the model size is determined based on image data of the object to be collided, and the lens distance is a distance between a virtual lens in the current scene and the object to be collided.
[0113] In one embodiment, the particle collision range is in a linear shape.
[0114] Please refer to Figure 7 is a structural schematic diagram of a chip provided in an embodiment of the present application. As shown in the structural schematic diagram of the chip 700, the chip 700 includes a processor 701, an interface 702, and optionally a memory 703. The number of the processor 701 can be one or more, and the number of the interface 702 can be multiple. Figure 7
[0115] In one embodiment, for the case that the chip is used to implement the method embodiments described in the present application:
[0116] The interface 702 is configured to receive or output a signal.
[0117] The processor 701 is configured to perform part or all of the contents of the collision effect adding method embodiments described above.
[0118] It can be understood that the processor in the embodiments of the present application can be an integrated circuit chip with a signal processing capability. In the implementation process, each step of the above method embodiments can be completed by an integrated logic circuit or an instruction in the form of software in the processor. The processor can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0119] Understandably, the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically EPROM (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM) and direct memory bus random access memory (DRAM) (DRAM). It should be noted that the memory of the system and method described herein is intended to include but not limited to these and any other suitable type of memory.
[0120] It should be noted here that the above description of the storage medium, device and chip embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium, storage medium and device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0121] It should be understood that the term "one embodiment" or "an embodiment" or "some embodiments" as used herein means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. Thus, the appearances of the phrase "in one embodiment" or "in an embodiment" or "in some embodiments" in various places throughout the specification are not necessarily referring to the same embodiment. Further, the particular features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that the sequence of steps in the above-described processes is not meant to be limiting, and that the steps can be executed in any suitable order, as determined by the function and logic of the steps, and that the execution of the steps should not limit the implementation of the embodiments of the application. The sequence of the above-described embodiments of the application is merely for description, and does not represent the advantages or disadvantages of the embodiments. The above description of the various embodiments tends to emphasize differences between the various embodiments, and the same or similar parts can be mutually referred to, and are not described again for the sake of brevity.
[0122] The term "and / or", as used herein, merely describes association between associated objects, and can represent three conditions: A and / or B; both A and B exist together, A exists alone, and B exists alone.
[0123] It should be noted that the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0124] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The above-described embodiments are merely illustrative. For example, the division of the modules is merely a logical functional division, and actual implementation can have another division manner, such as: a plurality of modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed components can be indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0125] The modules described above as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules; they can be located in one place or distributed on multiple network units; and some or all of the modules can be selected as needed to achieve the purposes of the embodiments.
[0126] In addition, the functional modules in the embodiments of the present application can be integrated in one processing unit, or each module can be a separate unit, or two or more modules can be integrated in one unit; the integrated modules can be realized in the form of hardware or in the form of hardware plus software functional units.
[0127] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, and the foregoing program can be stored in a computer readable storage medium, and the program executes the steps including the above-mentioned method embodiments when executed; and the foregoing storage medium includes mobile storage devices, read only memory (ROM), magnetic discs or optical discs and various storage medium that can store program codes.
[0128] Alternatively, the integrated units of the present application, if implemented in the form of software functional modules and sold or used as independent products, can also be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products, and the computer software products are stored in a storage medium, including a number of instructions to make an electronic device execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes mobile storage devices, ROM, magnetic discs or optical discs and various storage medium that can store program codes.
[0129] The methods disclosed in the several method embodiments of the present application can be combined arbitrarily without conflict to obtain new method embodiments.
[0130] The features disclosed in the several product embodiments of the present application can be combined arbitrarily without conflict to obtain new product embodiments.
[0131] The features disclosed in the several method or device embodiments of the present application can be combined arbitrarily without conflict to obtain new method or device embodiments.
[0132] The above merely provides the implementation of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the change or replacement within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for adding collision effects, characterized in that, The method includes: Obtain the image data of the object to be collided with; Obtain collision parameters, which are used to reflect the collision effect to be produced in the current scene; Based on the collision parameters and the image data of the object to be collided with, a corresponding collision effect is added to the object to be collided with. The step of adding a corresponding collision effect to the object to be collided based on the collision parameters and the image data of the object to be collided includes: Optical flow conversion is performed on the image data of the object to be collided with to obtain the optical flow image of the object to be collided with; Based on the collision parameters, particle interaction is performed on the optical flow image of the object to be collided with, so as to add the collision effect corresponding to the object to be collided with to the particle system.
2. The method according to claim 1, characterized in that, The acquisition of image data of the object to be collided with includes: Call the opticalflow component to obtain the image data of the object to be collided with.
3. The method according to claim 1, characterized in that, The acquisition of collision parameters includes: Call the particlesGpu component to obtain collision parameters.
4. The method according to claim 2 or 3, characterized in that, The collision parameters include configuration parameters of the opticalFlow component and configuration parameters of the particlesGpu component. The configuration parameters of the opticalFlow component are used to reflect the motion force required for the object to be collided with in the particle system, and the configuration parameters of the particlesGpu component are used to reflect the collision effect required for the object to be collided with in the particle system.
5. The method according to claim 4, characterized in that, The configuration parameters of the opticalFlow component include force field parameters, and the configuration parameters of the particlesGpu component include at least one of the following: model size, camera distance, particle dragging force, and particle collision range; wherein, the model size is determined based on the image data of the object to be collided with, and the camera distance is the distance between the virtual camera in the current scene and the object to be collided with.
6. The method according to claim 5, characterized in that, The particle collision range has a linear shape.
7. A collision effect adding device, characterized in that, The device includes: The first acquisition module is used to acquire image data of the object to be collided with; The second acquisition module is used to acquire collision parameters, which are used to reflect the collision effect to be generated in the current scene; The effect addition module is used to add corresponding collision effects to the object to be collided based on the collision parameters and the image data of the object to be collided. The effect addition module is specifically used for: Optical flow conversion is performed on the image data of the object to be collided with to obtain the optical flow image of the object to be collided with; Based on the collision parameters, particle interaction is performed on the optical flow image of the object to be collided with, so as to add the collision effect corresponding to the object to be collided with to the particle system.
8. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Collision effect rendering method, device and system
CN112587930A
Image processing method and device, electronic equipment and computer storage medium
CN114511721A