Special effect generation method and device, storage medium and electronic equipment
By obtaining the position information and motion information of virtual objects in the game, dynamically adjusting the trajectory parameters of the special effect object, making it flexibly follow the target virtual object, solving the problem of rigid special effect paths in the existing technology, and improving the efficiency of special effect generation and visual effects.
Patent Information
- Application Number
- CN202510429874.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-06-27
AI Technical Summary
The existing special effects generation method based on pre-rendered special effects animations leads to the rigidity of the special effects path and the inability to adapt to character movements or scene obstacles, resulting in the visual separation of special effects and virtual characters or special effects model penetration, which reduces the efficiency of special effects generation.
By obtaining the position information of the target virtual object and the special effect object in the virtual scene, the first track parameters of the special effect object relative to the target virtual object are determined, and the following track parameters of the special effect object are adjusted according to the motion information of the target virtual object, so as to achieve the special effect object flexibly following the motion of the target virtual object in the virtual scene.
It realizes accurate and flexible follow-up between the special effect objects and the target virtual objects, improves the efficiency of special effect generation, and avoids the visual separation between special effects and virtual characters in space.
Smart Images

Figure CN120204723A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game technologies, and in particular, to a special effect generation method, apparatus, storage medium, and electronic device. Background Art
[0002] In some games and interactive media applications, scene reward special effects (such as gold coin collection, task completion prompts, etc.) are one of the core elements to enhance the user experience. Existing special effect generation methods often implement scene reward special effects through pre-rendered animation technology. The pre-rendered special effect animation is played around a virtual character through predefined animation sequences (such as particle explosion, light effect diffusion), and after being triggered, it is calculated along a fixed path.
[0003] In the research and practice process of the existing technology, it is found that the special effect paths generated by the existing special effect generation methods based on pre-rendered special effect animations are rigid and cannot adapt to the movement of the character or scene obstacles, which may lead to problems such as a visual disconnection between the special effect and the virtual character in space or the special effect penetrating the model, thus resulting in poor special effect generation efficiency. Summary of the Invention
[0004] Embodiments of this application provide a special effect generation method, apparatus, storage medium, and electronic device, which can make a special effect object adapt to the movement of a target virtual object, accurately and flexibly control the special effect object to move following the target virtual object in a virtual scene, and improve the special effect generation efficiency.
[0005] Embodiments of this application provide a special effect generation method, including:
[0006] Obtain first position information of a target virtual object and second position information of a special effect object in a virtual scene;
[0007] Based on the first position information and the second position information, determine a first trajectory parameter of the special effect object relative to the target virtual object;
[0008] According to the movement information of the target virtual object and the first trajectory parameter, determine a target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object;
[0009] Based on the target trajectory parameter, control the special effect object to move following the target virtual object in the virtual scene.
[0010] Correspondingly, embodiments of this application provide a special effect generation apparatus, including:
[0011] An obtaining unit, configured to obtain first position information of a target virtual object and second position information of a special effect object in a virtual scene;
[0012] The first determination unit is configured to determine a first trajectory parameter of the special effect object relative to the target virtual object based on the first position information and the second position information;
[0013] The second determination unit is configured to determine a target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter;
[0014] The control unit is configured to control the special effect object to move following the target virtual object in the virtual scene based on the target trajectory parameter.
[0015] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and the computer program is suitable for being loaded by a processor to execute the steps in any of the special effect generation methods provided by the embodiments of the present application.
[0016] In addition, an embodiment of the present application further provides an electronic device, including a processor and a memory, the memory stores an application program, and the processor is configured to run the application program in the memory to implement the special effect generation method provided by the embodiment of the present application.
[0017] An embodiment of the present application further provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the steps in the special effect generation method provided by the embodiment of the present application.
[0018] In the embodiment of the present application, the first position information of the target virtual object and the second position information of the special effect object in the virtual scene are obtained; based on the first position information and the second position information, a first trajectory parameter of the special effect object relative to the target virtual object is determined; according to the motion information of the target virtual object and the first trajectory parameter, a target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object is determined; based on the target trajectory parameter, the special effect object is controlled to move following the target virtual object in the virtual scene. In this way, by determining the first trajectory parameter of the special effect object relative to the target virtual object according to the position information of the target virtual object and the special effect object in the virtual scene, and determining the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter, based on the target trajectory parameter, the special effect object can be adapted to the motion of the target virtual object, so as to accurately and flexibly control the special effect object to move following the target virtual object in the virtual scene, and improve the special effect generation efficiency. Description of the Drawings
[0019] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0020] Figure 1 It is a schematic diagram of the implementation scenario of a special effect generation method provided by an embodiment of the present application;
[0021] Figure 2 It is a schematic flow diagram of a special effect generation method provided by an embodiment of the present application;
[0022] Figure 3a It is a schematic diagram of special effect generation of a special effect generation method provided by an embodiment of the present application;
[0023] Figure 3b It is another schematic diagram of special effect generation of a special effect generation method provided by an embodiment of the present application;
[0024] Figure 4a It is a schematic diagram of the special effect object layer of a special effect generation method provided by an embodiment of the present application;
[0025] Figure 4b It is another schematic diagram of the special effect object layer of a special effect generation method provided by an embodiment of the present application;
[0026] Figure 4c It is yet another schematic diagram of the special effect object layer of a special effect generation method provided by an embodiment of the present application;
[0027] Figure 4d It is a schematic diagram of the motion speed curve of a special effect generation method provided by an embodiment of the present application;
[0028] Figure 5 It is a schematic structural diagram of a special effect generation device provided by an embodiment of the present application;
[0029] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts fall within the scope of protection of the present application.
[0031] An embodiment of the present application provides a special effect generation method, apparatus, storage medium, and electronic device. Among them, the special effect generation apparatus can be integrated in the electronic device, and the electronic device can be a server or a terminal device, etc.
[0032] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and big data and artificial intelligence platforms. The terminal can include, but is not limited to, mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, and the present application does not make any restrictions here.
[0033] Please refer to Figure 1 , taking the special effect generation apparatus integrated in the electronic device as an example, Figure 1 is a schematic diagram of the implementation scenario of the special effect generation method provided by the embodiment of the present application. Among them, the electronic device can obtain the first position information of the target virtual object in the virtual scene and the second position information of the special effect object; based on the first position information and the second position information, determine the first trajectory parameter of the special effect object relative to the target virtual object; according to the motion information of the target virtual object and the first trajectory parameter, determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object; based on the target trajectory parameter, control the special effect object to move following the target virtual object in the virtual scene.
[0034] It should be noted that Figure 1 the schematic diagram of the implementation environment scenario of the special effect generation method shown is only an example. The implementation environment scenario of the special effect generation method described in the embodiment of the present application is for more clearly explaining the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided by the embodiment of the present application. Those of ordinary skill in the art know that with the evolution of data processing and the emergence of new business scenarios, the technical solution provided by the present application is equally applicable to similar technical problems.
[0035] The solution provided by the embodiment of the present application is specifically described through the following embodiments. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments.
[0036] This embodiment will be described from the perspective of the special effect generation apparatus. The special effect generation apparatus can be specifically integrated in the electronic device, and the electronic device can be a terminal and / or a server, and the present application does not make any restrictions here.
[0037] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of a special effect generation method provided by an embodiment of the present application. The special effect generation method includes:
[0038] In step 101, obtain the first position information of the target virtual object in the virtual scene and the second position information of the special effect object.
[0039] Among them, the virtual scene can also be called a game scene, which can be a virtual scene displayed (or provided) when a game application runs on a terminal or a server. Players play games in the virtual scene by manipulating virtual objects. Optionally, the virtual scene is a simulation environment of the real world, or a semi-simulated and semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any one of a two-dimensional virtual scene and a three-dimensional virtual scene. The virtual environment can be the sky, land, ocean, etc., and can also be a venue for game battles that exists independently in the virtual scene. The embodiments of the present application do not make limitations here. The target virtual object can be a virtual object in the virtual scene and can be a game character manipulated by a player.
[0040] The first position information can be the position of the target virtual object in the virtual scene before interacting with the special effect object. The first position information can be the position coordinates of the target virtual object in the virtual scene, or the coordinates of a specific part of the target virtual object. For example, it can be the position coordinates of parts such as the head and hands, and can be specifically set according to the actual situation. The second position information can be the initial position of the special effect object in the virtual scene, that is, the position in the virtual scene before interacting with the target virtual object. The special effect object can be a virtual object with special effect effects set in the virtual scene. For example, it can be a reward point special effect, which can be used as a reward for players and trigger and obtain interactions with players in the virtual scene.
[0041] Optionally, the special effect object and the target virtual object can be attached with collision bodies, so that the interaction situation between the special effect object and the target virtual object can be determined based on the collision between the collision bodies attached to the special effect object and the target virtual object.
[0042] For example, please refer to Figure 3a , Figure 3a which is a special effect generation schematic diagram of a special effect generation method provided by an embodiment of the present application. In the virtual scene, a target virtual object and a special effect object for the reward point of the target virtual object can be displayed. Among them, the white model character is the target virtual object, and the special effect ball is the special effect object. At the same time, the target virtual object and the special effect object need to be attached with collision bodies for triggering.
[0043] In step 102, based on the first position information and the second position information, determine the first trajectory parameter of the special effect object relative to the target virtual object.
[0044] Among them, the first trajectory parameter can be information about the trajectory for determining the movement of the special effect object to the position where the target virtual object is located. For example, it can be the position of the trajectory points of the trajectory for the special effect object to move to the position where the target virtual object is located.
[0045] Among them, there can be various ways to determine the first trajectory parameter of the special effect object relative to the target virtual object based on the first position information and the second position information. For example, based on the first position information, the second position information, and the curve formula of the second target curve, determine the first trajectory parameter of the special effect object relative to the target virtual object, where the second position information serves as the starting point of the second target curve, and the first position information serves as the ending point of the second target curve.
[0046] Among them, the second target curve can be a curve for simulating the trajectory. For example, it can be a Bezier curve, a parabola, etc. For example, in order to achieve the flexible trajectory curve effect of the reward point special effect, the Bezier curve can be used as the basic algorithm to simulate the trajectory curve from the special effect object to the position where the target virtual object is located. The curve formula can be the formula of the second target curve. The second position information can serve as the starting control point of the trajectory simulated by the second target curve, and the first position information can serve as the ending control point of the trajectory simulated by the second target curve.
[0047] For example, taking the second target curve as a Bezier curve as an example, the basic n - order Bezier curve equation can be expressed as:
[0048]
[0049] Among them, b n (t) is the point with relative position t on the n - order Bezier curve, ∑ can be expressed as the summation symbol, b j is the control point of the Bezier curve, is the Bezier polynomial, which can be specifically expressed as:
[0050]
[0051] Optionally, in the embodiments of the present application, a 1 - order Bezier curve is mainly used, that is, the curve formula of the second target curve is the equation obtained by taking n = 1 in the n - order Bezier curve equation, that is, b 1(t). Therefore, the real-time positions of the special effect object and the target virtual object in the virtual scene are used as two control points of the Bezier curve to participate in the calculation of the Bezier curve. Among them, the second position information b0 of the special effect object is used as the starting point of the Bezier curve, and the first position information b1 of the target virtual object is used as the ending point of the Bezier curve.
[0052] For example, please refer to Figure 3b , Figure 3b is another schematic diagram of special effect generation for a special effect generation method provided by an embodiment of the present application. Based on the second position information of the special effect object, the first position information of the target virtual object, and the curve formula of the first-order Bezier curve, the first trajectory parameter corresponding to the special effect object can be determined. Thus, based on the first trajectory parameter, the trajectory of the second target curve from the special effect object to the position of the target virtual object in the virtual scene can be simulated.
[0053] In step 103, according to the motion information of the target virtual object and the first trajectory parameter, the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object is determined.
[0054] Among them, the motion information can be information indicating the motion situation of the target virtual object in the virtual scene. For example, it can indicate the motion speed and motion direction of the target virtual object in the virtual scene. Specifically, it can be the velocity vector of the target virtual object moving in the virtual scene. The target trajectory parameter can be information for determining the following trajectory of the special effect object relative to the target virtual object, and can indicate the position of the trajectory point where the special effect object follows the motion of the target virtual object.
[0055] Thus, in order to reduce the real-time calculation overhead of the trajectory curve of the special effect object following the target virtual object, the embodiment of the present application performs trajectory prediction based on the motion information of the target virtual object. Thus, according to the predicted trajectory and the curve trajectory determined based on the first position information of the target virtual object and the second position information of the special effect object, the target trajectory for the special effect object to finally follow the motion of the target virtual object can be determined, which can achieve flexible and accurate following of the target virtual object and improve the special effect generation effect.
[0056] Among them, there are various ways to determine the target trajectory parameters of the follow-up trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameters. For example, the motion information of the target virtual object and the trajectory simulation period can be obtained; according to the motion information, the trajectory simulation period, and the first position information of the target virtual object, the third position information of the target virtual object after the trajectory simulation period is determined; based on the second position information and the third position information, the second trajectory parameters are determined; based on the first trajectory parameters and the second trajectory parameters, the target trajectory parameters of the follow-up trajectory of the special effect object relative to the target virtual object are determined.
[0057] Among them, the trajectory simulation period can be the period for simulating the follow-up trajectory of the special effect object following the target virtual object according to the motion information of the target virtual object. For example, the trajectory simulation period can be a period such as 1 second, 2 seconds, 3 seconds, etc. For example, when the trajectory simulation period is 1 second, that is, the trajectory calculation of the special effect object following the target virtual object is performed every 1 second according to the motion information. When the trajectory simulation period is 2 seconds, that is, the trajectory calculation of the special effect object following the target virtual object is performed every 2 seconds according to the motion information, and so on. The third position information can be the position of the target virtual object in the virtual scene after the trajectory simulation period estimated based on the motion information. The second trajectory parameters can be the information used to determine the trajectory of the special effect object following the target virtual object after the trajectory simulation period estimated based on the motion information. For example, it can be the position of the trajectory point of the trajectory of the special effect object following the target virtual object after the trajectory simulation period determined based on the motion information of the target virtual object.
[0058] Among them, there are various ways to determine the third position information of the target virtual object after the trajectory simulation period according to the motion information, the trajectory simulation period, and the first position information of the target virtual object. For example, the predicted trajectory offset distance can be calculated according to the trajectory simulation period and the motion information; the first position information of the target virtual object and the predicted trajectory offset distance are added to obtain the third position information of the target virtual object after the trajectory simulation period.
[0059] Among them, the predicted trajectory offset distance can be the distance that the target virtual object moves after the trajectory simulation period estimated based on the motion information.
[0060] Among them, there are various ways to determine the second trajectory parameters based on the second position information and the third position information. For example, the second trajectory parameters can be determined based on the second position information, the third position information, and the curve formula of the first target curve, where the second position information serves as the starting point of the first target curve and the third position information serves as the ending point of the first target curve.
[0061] Among them, the first target curve can be a curve such as a Bezier curve or a parabola. The type of the first target curve corresponding to the second trajectory parameter is the same as the type of the second target curve corresponding to the first trajectory parameter. For example, the target curves corresponding to the first trajectory parameter and the second trajectory parameter can both be Bezier curves.
[0062] In this way, in each trajectory simulation period, the first position information of the target virtual object in the virtual scene and the second position information of the special effect object in the virtual scene can be obtained. Then, according to the first position information and the second position information, the curve trajectory of the special effect object following the target virtual object within the current trajectory simulation period can be determined to obtain the first trajectory parameter. At the same time, according to the calculation formula corresponding to the second trajectory parameter, the third position information of the target virtual object after the current trajectory simulation period can be calculated. Then, according to the second position information and the third position information, the following trajectory of the special effect object moving to the position of the target virtual object after the trajectory simulation period can be determined to obtain the second trajectory parameter. Thus, by performing weighted summation on the first trajectory parameter and the second trajectory parameter, the target trajectory parameter indicating the following trajectory of the special effect object relative to the target virtual object can be obtained. Then, based on the target trajectory parameter, the trajectory point positions of the trajectory of the special effect object following the target virtual object can be determined, and the movement of the special effect object can be controlled, realizing the reduction of the simulation frequency of the trajectory curve and the real-time calculation overhead of the trajectory while maintaining a low following error, thereby reducing the performance consumption.
[0063] For example, taking the first target curve as a Bezier curve, the motion information can be the velocity vector of the target virtual object The first position information b1 of the target virtual object can be estimated according to the velocity vector The position b_pre1 of the target virtual object in the next trajectory simulation period ΔT, that is, the third position information. The starting control point of the first target curve is the second position information of the current special effect object, that is, b_pre0 = b0. In this way, the determination process of the second trajectory parameter can be expressed as:
[0064]
[0065] Among them, the second trajectory parameter can be expressed as b_pre j It can be the control point of the first target curve corresponding to the second trajectory parameter. Among them, the second position information b_pre0 is used as the starting point of the first target curve, and the third position information b_pre1 is used as the ending point of the first target curve. That is, the second position information of the special effect object is used as the starting control point of the first target curve, and the estimated third position information of the target virtual object is used as the termination control point of the first target curve. The determination process of the third position information can be expressed as:
[0066]
[0067] Among them, b1 represents the current position of the target virtual object in the virtual scene, that is, the first position information. It can be expressed as the predicted trajectory offset distance, where It can be expressed as the velocity vector of the target virtual object, and ΔT can be expressed as the trajectory simulation period.
[0068] After determining the second trajectory parameter, the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object can be determined based on the first trajectory parameter and the second trajectory parameter. Among them, there are various ways to determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object based on the first trajectory parameter and the second trajectory parameter. For example, the weight corresponding to the first trajectory parameter and the weight corresponding to the second trajectory parameter can be determined, so that the first trajectory parameter and the second trajectory parameter can be weighted and summed according to the weight corresponding to the first trajectory parameter and the weight corresponding to the second trajectory parameter to obtain the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object.
[0069] For example, the determination process of the target trajectory parameter can be expressed as:
[0070]
[0071] Among them, p VEX (t) can be the target trajectory parameter, and the position of the trajectory point where the special effect object follows the target virtual object for movement can be determined. b 1 (t) can be the first trajectory parameter, and the position of the trajectory point of the Bezier curve calculated based on the first position information and the second position information can be determined. can be the second trajectory parameter, and the position of the trajectory point of the Bezier curve estimated based on the movement information of the target virtual object can be determined. α can be expressed as the weight corresponding to the second trajectory parameter, which can indicate the influence intensity coefficient of the second trajectory parameter, and 1 - α can be expressed as the weight corresponding to the first trajectory parameter.
[0072] Therefore, in order to reduce the real-time calculation overhead of the Bezier curve, the embodiment of the present application can reduce the simulation frequency of the Bezier curve while maintaining a low following error by using the Bezier curve trajectory estimated based on the velocity vector of the target virtual object, thereby reducing the performance consumption.
[0073] In step 104, based on the target trajectory parameter, control the special effect object to follow the target virtual object for movement in the virtual scene.
[0074] Among them, based on the target trajectory parameters, the position of the trajectory points where the special effect object follows the target virtual object can be determined, so that the movement of the special effect object following the target virtual object in the virtual scene can be controlled according to the position of the trajectory points.
[0075] In one embodiment, the special effect generation method provided by the embodiments of the present application can be configured as a special effect following curve component. Thus, when it is necessary to simulate the following trajectory curve of the special effect to the virtual character, the special effect following curve component can be mounted on the reward point special effect object. At the same time, the position information of the corresponding bone of the virtual character can be specified as the following target point of the following trajectory curve. Then, based on the special effect generation method provided by the embodiments of the present application, the following trajectory of the special effect object following the virtual character in the virtual scene is simulated, and the movement of the special effect object following the virtual character in the virtual scene is controlled according to the position of the trajectory points in the following trajectory, improving the convenience and efficiency of special effect generation.
[0076] Optionally, the special effect object can be configured with multiple special effect stages, and the multiple special effect stages can include a stationary stage, a following stage, and a trigger stage.
[0077] Among them, when there is no collision between the special effect object and the target virtual object, the special effect object is in the stationary stage; when the special effect object collides with the target virtual object for the first time, the special effect object enters the following stage, and in the following stage, the special effect object follows the target virtual object; when the special effect object collides with the target virtual object for the second time, the special effect object enters the trigger stage, and in the trigger stage, the special effect object stops following the target virtual object.
[0078] Correspondingly, there are multiple ways to obtain the first position information of the target virtual object and the second position information of the special effect object in the virtual scene. For example, when the special effect object is in the following stage, the first position information of the target virtual object and the second position information of the special effect object in the virtual scene can be obtained.
[0079] In this way, in the following stage, based on the positions of the target virtual object and the special effect object in the virtual scene, the target trajectory parameters for the special effect object to follow the target virtual object can be determined, so that the movement of the special effect object following the target virtual object in the virtual scene can be controlled according to the target trajectory parameters.
[0080] Optionally, the special effect object can be configured with multiple special effect object layers, and each special effect stage is configured as a special effect object rendered based on at least one special effect object layer.
[0081] Among them, the special effect object layer can be a special effect layer used to implement the special effect of the special effect object in different special effect stages, and each special effect layer can be used to render a corresponding special effect in the virtual scene. For example, the special effect object layer can include a basic static layer, a motion trail layer, and an interaction trigger layer, etc. In the static stage, the special effect object can be rendered in the virtual scene based on the basic static layer. In the following stage, the special effect object can be rendered in the virtual scene based on the basic static layer and the motion trail layer. In the trigger stage, the special effect object can be rendered in the virtual scene based on the interaction trigger layer.
[0082] Optionally, the special effect styles of the basic static layer, the motion trail layer, and the interaction trigger layer can be set according to actual needs. For example, please refer to Figure 4a , Figure 4a FIG. is a schematic diagram of a special effect object layer of a special effect generation method provided by an embodiment of the present application. What is shown in the figure can be a special effect of a basic static layer. For another example, please refer to Figure 4b , Figure 4b FIG. is another schematic diagram of a special effect object layer of a special effect generation method provided by an embodiment of the present application. What is shown in the figure can be a special effect of a motion trail layer. In addition, please refer to Figure 4c , Figure 4c FIG. is still another schematic diagram of a special effect object layer of a special effect generation method provided by an embodiment of the present application. What is shown in the figure can be a special effect of an interaction trigger layer. In this way, based on the basic static layer, the motion trail layer, and the interaction trigger layer of the special effect object in each special effect stage, the special effect object can be statically displayed in the virtual scene. When the target virtual object controlled by the player touches the special effect object, that is, when the collision body of the target virtual object first contacts the collision body of the special effect object, the basic static layer and the motion trail layer can be triggered to be superimposed, and the special effect of the special effect object following the target virtual object can be displayed in the virtual scene. When the special effect object collides with the target virtual object again during the following stage, based on the interaction trigger layer, the effect that the target virtual object obtains or absorbs the reward corresponding to the special effect object can be realized in the virtual scene, and the special effect object corresponding to the reward point disappears after the special effect is played. In this way, the interaction special effect between the target virtual object and the reward point is realized in the virtual scene.
[0083] Optionally, during the following stage, the special effect objects corresponding to the basic static layer and the motion trail layer can move along with the following trajectory of the special effect object relative to the target virtual object. At the same time, the movement speed of the special effect object moving along the following trajectory can be controlled during the following process. For example, please refer to Figure 4d , Figure 4dIt is a schematic diagram of the motion speed curve of a special effect generation method provided by an embodiment of the present application. The motion speed curve is as shown by the curve in the figure. Among them, the abscissa of the motion speed curve is the position of the trajectory point in the following trajectory of the special effect object, and the range of the abscissa is from the starting point to the ending point of the following trajectory of the special effect object. The ordinate can be the motion speed of the special effect object. Thus, based on the motion speed curve, the special effect object can be flexibly controlled to follow the target virtual object based on the following trajectory, improving the effect of special effect generation.
[0084] In one embodiment, each special effect object layer can be set with at least one special effect layer configuration parameter. Each type of special effect layer configuration parameter corresponds to a different special effect complexity, and each type of special effect layer configuration parameter is used to render a special effect with the corresponding complexity in the virtual scene, thereby generating a corresponding special effect object in the virtual scene.
[0085] Among them, there can be various processes for determining the special effect layer configuration parameters corresponding to each special effect stage of the special effect object. For example, the display control parameters of the special effect object in the virtual scene can be obtained; based on the display control parameters, the special effect layer configuration parameters corresponding to each special effect stage of the special effect object can be determined.
[0086] Among them, the display control parameter can be a parameter that affects the display effect of the special effect object in the virtual scene. For example, it can include at least one of the camera distance between the special effect object and the virtual camera in the virtual scene, and the motion speed of the special effect object in the virtual scene.
[0087] Among them, there can be various ways to determine the special effect layer configuration parameters corresponding to each special effect stage of the special effect object based on the display control parameters. For example, the display control parameter can include the camera distance, and the special effect object layer can be set with at least two special effect layer configuration parameters. Thus, according to the corresponding relationship between the special effect layer configuration parameters of each special effect object layer and the preset distance range, and the camera distance, the special effect layer configuration parameters corresponding to each special effect stage of the special effect object can be determined.
[0088] For example, when the special effect object is in the static stage, the special effects of the basic static layer can be lightweight rendered based on the Levels of Detail (LOD) technology according to the distance between the special effect object and the camera space of the virtual camera. For example, the basic static layer can be set with special effect layer configuration parameters with three configurations of low, medium, and high. Among them, only the special effects of the first special effect layer (lv1) take effect in the low configuration, the first special effect layer and the second special effect layer (lv2) are superimposed in the medium configuration, and the third special effect layer (lv3) is further superimposed in the high configuration. Thus, when the camera distance x of the special effect object < the preset distance threshold X lv1 when, the special effect layer configuration parameters (lv1 + lv2 + lv3) of the high configuration of the basic static layer are enabled. When the preset distance threshold X lv1When < camera distance x < preset distance threshold X lv2 , enable the special effect layer configuration parameters (lv1 + lv2) configured in the basic static layer. When the camera distance x > preset distance threshold X lv2 , enable the special effect layer configuration parameters (lv1) with low configuration in the basic static layer. In this way, dynamic lightweight rendering of special effect objects is achieved, performance consumption during special effect generation is reduced, and thus the particle special effect performance and artistic effect of special effect objects are balanced.
[0089] Among them, the specific values of the preset distance threshold X lv1 and X lv2 can be set according to actual requirements, and are not limited in this embodiment of the present application.
[0090] Optionally, there can be various ways to determine the special effect layer configuration parameters corresponding to the special effect object in each special effect stage based on the display control parameters. For example, the display parameter can include the movement speed, and at least two special effect layer configuration parameters can be set for the special effect object layer. In this way, according to the correspondence between the special effect layer configuration parameters of each special effect object layer and the preset speed range, as well as the movement speed, the special effect layer configuration parameters corresponding to the special effect object in each special effect stage can be determined.
[0091] For example, when the special effect object is in the following stage, LOD lightweight settings can be performed according to the movement speed of the special effect object. Among them, when the movement speed of the special effect object is relatively large, the details of the basic static layer special effect are likely to be ignored. At this time, the main focus is on depicting the effect of the movement trailing layer. For example, when the movement speed v of the special effect object is less than the preset speed threshold V lv1 , the basic static layer is rendered based on the high-configuration special effect layer configuration parameters, and the movement trailing layer is rendered based on the low-configuration special effect layer configuration parameters. When the movement speed v is within the preset speed range (V lv1 , V lv2 ), the basic static layer and the movement trailing layer are rendered based on the medium-configuration special effect layer configuration parameters. When the movement speed v is greater than the preset speed threshold V lv2 , the basic static layer is rendered based on the low-configuration special effect layer configuration parameters, and the movement trailing layer is rendered based on the high-configuration special effect layer configuration parameters. Among them, the specific values of V lv1 and V lv2 can be set according to actual requirements, and are not limited in this embodiment of the present application.
[0092] In game and interactive media applications, scene reward special effects (such as gold coin collection, mission completion prompts, etc.) are one of the core elements to enhance the user experience. Currently, there are mainly three techniques for implementing reward point special effects: user interface (UI) icon feedback technology, pre-rendered special effect animation technology, and particle system dynamic generation technology. The UI icon feedback technology displays reward icons (such as "+100 gold coins") at fixed positions on the screen (such as corners), and uses scaling or color changes to prompt interactions. The pre-rendered special effect animation plays around the character through predefined animation sequences (such as particle explosions, light effect diffusion), and calculates along a fixed path after being triggered. The particle system dynamic generation generates dynamic special effects (such as smoke, sparks) in real time based on particle emitters, and simulates the behavior of particles through a physics engine. However, the special effects through UI icon feedback have a sense of visual fragmentation, are irrelevant to the actual spatial position of the virtual character, destroy the immersion of the scene, and cannot adjust the position and form of the special effects according to the character's movement speed and perspective change. The path of the pre-rendered special effect animation is rigid, unable to adapt to the character's movement direction or scene obstacles in real time, which may lead to special effects penetrating the model or visual errors, and the animation resources occupy a large amount of memory space. The reward point special effects based on the particle system have high computational overhead and high resource occupancy rate, are prone to lag on mobile devices or low-end hardware, and at the same time, there is a following delay caused by the inertia of particle movement, and the special effect objects lag significantly when dynamically moving virtual characters, and the accuracy of object following is poor.
[0093] In order to maintain the real-time dynamic adaptation of reward points while consuming low performance, and to solve the problems of insufficient visual immersion and spatial fragmentation of reward point special effects, the embodiments of the present application provide a Visual Special Effects (VFX) solution for the interaction of reward points in game scenes. By combining dynamic curve tracking, multi-layer composite special effect rendering, and lightweight dynamic LOD technology, the interaction of reward point special effects is efficiently realized. Specifically, by extracting the body bone positions of the virtual character as the following target points, when the virtual character touches the reward point, a Bezier curve will be drawn as the following trajectory according to the positions of the reward point and the virtual character. At the same time, the curve of the trajectory is dynamically adjusted according to the motion vector of the virtual character, reducing the calculation frequency of the Bezier curve, reducing the simulation calculation consumption of the curve, and the following delay error of the special effect. Subsequently, the reward point special effect is rendered in layers, and a special effect motion control script is written to display different special effect layers according to different motion states. The basic special effect layer is rendered at the static stage of the reward point, the motion trail layer is added at the following stage after the trigger motion, and the interaction trigger layer special effect is triggered when the virtual character is touched again. Finally, the reward point special effect disappears. In addition, in order to optimize the performance of the reward point special effect, according to the actual distance and motion speed of the reward point in the camera space, the lightweight dynamic LOD classification of the reward point special effect is controlled. When the reward point is far from the virtual camera position, the number of particles of the reward point special effect object will be reduced according to the distance control. The faster the special effect object moves, the trajectory in the following stage is the main performance of the special effect, reducing the complexity of the basic static layer and increasing the number of particles of the motion trail layer, so that the artistic performance and performance consumption of the reward point special effect reach a dynamic balance, and the generation efficiency of the reward point special effect is improved.
[0094] Thus, through the special effect generation method provided by the embodiments of the present application, the real-time following of the reward point special effect object to the target virtual object can be realized. At the same time, the high-precision character following is realized by predicting the character position through the motion vector of the target virtual object, eliminating the sense of fragmentation in the spatial position between the special effect object and the target virtual object. Through layered rendering according to different special effect stages of the special effect object, the high-performance special effect dynamic performance including the basic static layer, the motion trail layer, and the interaction trigger layer is realized. And through lightweight dynamic LOD, the performance consumption of rendering the special effect object by the reward point special effect is reduced according to the camera space position and motion speed. At the same time, through parametric configuration, a single reward point special effect can be adapted to target virtual objects of different body types, reducing the production and development cycle of the reward point special effect and greatly improving the special effect generation efficiency.
[0095] As can be seen from the above, in the embodiment of the present application, the first position information of the target virtual object in the virtual scene and the second position information of the special effect object are obtained; based on the first position information and the second position information, the first trajectory parameter of the special effect object relative to the target virtual object is determined; according to the motion information of the target virtual object and the first trajectory parameter, the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object is determined; based on the target trajectory parameter, the special effect object is controlled to move following the target virtual object in the virtual scene. In this way, by determining the first trajectory parameter of the special effect object relative to the target virtual object according to the position information of the target virtual object and the special effect object in the virtual scene, and determining the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter, based on the target trajectory parameter, the special effect object can be adapted to the motion of the target virtual object, realizing accurate and flexible control of the special effect object to move following the target virtual object in the virtual scene, and improving the special effect generation efficiency.
[0096] To better implement the above method, an embodiment of the present invention further provides a special effect generation device, which can be integrated in an electronic device, and the electronic device can be a terminal or a server.
[0097] For example, as Figure 5 shown, it is a schematic structural diagram of the special effect generation device provided by the embodiment of the present application. The special effect generation device may include an acquisition unit 201, a first determination unit 202, a second determination unit 203, and a control unit 204, as follows:
[0098] The acquisition unit 201 is configured to acquire the first position information of the target virtual object in the virtual scene and the second position information of the special effect object;
[0099] The first determination unit 202 is configured to determine the first trajectory parameter of the special effect object relative to the target virtual object based on the first position information and the second position information;
[0100] The second determination unit 203 is configured to determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter;
[0101] The control unit 204 is configured to control the special effect object to move following the target virtual object in the virtual scene based on the target trajectory parameter.
[0102] In some embodiments, the second determination unit 203 includes:
[0103] Acquire the motion information of the target virtual object and the trajectory simulation period;
[0104] Determine the third position information of the target virtual object after the trajectory simulation period according to the motion information, the trajectory simulation period, and the first position information of the target virtual object;
[0105] Determine the second trajectory parameter based on the second position information and the third position information;
[0106] Determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object based on the first trajectory parameter and the second trajectory parameter.
[0107] In some embodiments, the above-mentioned determining the third position information of the target virtual object after the trajectory simulation period according to the motion information, the trajectory simulation period, and the first position information of the target virtual object is used for:
[0108] Calculate the predicted trajectory offset distance according to the trajectory simulation period and the motion information;
[0109] Add the first position information of the target virtual object and the predicted trajectory offset distance to obtain the third position information of the target virtual object after the trajectory simulation period.
[0110] In some embodiments, the above-mentioned determining the second trajectory parameter based on the second position information and the third position information is specifically used for:
[0111] Determine the second trajectory parameter based on the second position information, the third position information, and the curve formula of the first target curve, where the second position information is used as the starting point of the first target curve, and the third position information is used as the ending point of the first target curve.
[0112] In some embodiments, the first determining unit 202 is used for:
[0113] Determine the first trajectory parameter of the special effect object relative to the target virtual object based on the first position information, the second position information, and the curve formula of the second target curve, where the second position information is used as the starting point of the second target curve, and the first position information is used as the ending point of the second target curve.
[0114] In some embodiments, the special effect object is configured with multiple special effect stages, and the multiple special effect stages include a stationary stage, a following stage, and a trigger stage;
[0115] When there is no collision between the special effect object and the target virtual object, the special effect object is in the stationary stage; when the special effect object collides with the target virtual object for the first time, the special effect object enters the following stage, and in the following stage, the special effect object follows the target virtual object; when the special effect object collides with the target virtual object for the second time, the special effect object enters the trigger stage, and in the trigger stage, the special effect object stops following the target virtual object;
[0116] An acquisition unit 201, configured to:
[0117] When the special effect object is in the following stage, acquire the first position information of the target virtual object in the virtual scene and the second position information of the special effect object.
[0118] In some embodiments, the special effect object is configured with multiple special effect object layers, and each special effect stage is configured as a special effect object rendered based on at least one special effect object layer.
[0119] In some embodiments, at least one special effect layer configuration parameter is set for each special effect object layer, and the special effect complexity corresponding to each special effect layer configuration parameter is different. The process of determining the special effect layer configuration parameters corresponding to the special effect stages of the special effect object includes:
[0120] Acquire the display control parameters of the special effect object in the virtual scene, where the display control parameters include at least one of the camera distance between the special effect object and the virtual camera in the virtual scene and the movement speed in the virtual scene;
[0121] Based on the display control parameters, determine the special effect layer configuration parameters corresponding to the special effect stages of the special effect object.
[0122] In some embodiments, the display control parameters include the camera distance, and at least two special effect layer configuration parameters are set for the special effect object layer. The above process of determining the special effect layer configuration parameters corresponding to the special effect stages of the special effect object based on the display control parameters is specifically configured to:
[0123] According to the correspondence between the special effect layer configuration parameters of each special effect object layer and the preset distance range, and the camera distance, determine the special effect layer configuration parameters corresponding to the special effect stages of the special effect object.
[0124] In some embodiments, the display parameters include the movement speed, and at least two special effect layer configuration parameters are set for the special effect object layer. The above process of determining the special effect layer configuration parameters corresponding to the special effect stages of the special effect object based on the display control parameters is specifically configured to:
[0125] According to the correspondence between the special effect layer configuration parameters of each special effect object layer and the preset speed range, and the movement speed, determine the special effect layer configuration parameters corresponding to the special effect stages of the special effect object.
[0126] In specific implementation, each of the above units can be implemented as an independent entity, or can be arbitrarily combined and implemented as the same or several entities. For the specific implementation of each of the above units, reference can be made to the foregoing method embodiments, which will not be elaborated herein.
[0127] As can be seen from the above, in the embodiment of the present application, the acquisition unit 201 acquires the first position information of the target virtual object and the second position information of the special effect object in the virtual scene; the first determination unit 202 determines the first trajectory parameter of the special effect object relative to the target virtual object based on the first position information and the second position information; the second determination unit 203 determines the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter; the control unit 204 is configured to control the special effect object to move following the target virtual object in the virtual scene based on the target trajectory parameter. In this way, by determining the first trajectory parameter of the special effect object relative to the target virtual object according to the position information of the target virtual object and the special effect object in the virtual scene, and determining the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter, it is possible to make the special effect object adapt to the motion of the target virtual object based on the target trajectory parameter, so as to accurately and flexibly control the special effect object to move following the target virtual object in the virtual scene and improve the special effect generation efficiency.
[0128] The embodiment of the present application further provides an electronic device, as Figure 6 shown, which shows a schematic structural diagram of the electronic device involved in the embodiment of the present application. The electronic device may be a terminal or a server. Specifically:
[0129] The electronic device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored on the memory 302 and executable on the processor. Among them, the processor 301 is electrically connected to the memory 302. Those skilled in the art can understand that the structural diagram of the electronic device shown in the figure does not constitute a limitation on the electronic device, and it may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements.
[0130] The processor 301 is the control center of the electronic device 300, connects various parts of the entire electronic device 300 through various interfaces and lines, executes various functions of the electronic device 300 and processes data by running or loading software programs and / or modules stored in the memory 302, and calling the data stored in the memory 302, so as to monitor the entire electronic device 300.
[0131] In the embodiment of the present application, the processor 301 in the electronic device 300 will load the instructions corresponding to the processes of one or more application programs into the memory 302 according to the following steps, and the processor 301 will run the application programs stored in the memory 302 to implement various functions:
[0132] Obtain the first position information of the target virtual object in the virtual scene and the second position information of the special effect object; based on the first position information and the second position information, determine the first trajectory parameter of the special effect object relative to the target virtual object; according to the motion information of the target virtual object and the first trajectory parameter, determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object; based on the target trajectory parameter, control the special effect object to move following the target virtual object in the virtual scene.
[0133] This solution can obtain the first position information of the target virtual object in the virtual scene and the second position information of the special effect object; based on the first position information and the second position information, determine the first trajectory parameter of the special effect object relative to the target virtual object; according to the motion information of the target virtual object and the first trajectory parameter, determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object; based on the target trajectory parameter, control the special effect object to move following the target virtual object in the virtual scene. In this way, by determining the first trajectory parameter of the special effect object relative to the target virtual object according to the position information of the target virtual object and the special effect object in the virtual scene, and determining the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter, thus based on the target trajectory parameter, the special effect object can be adapted to the motion of the target virtual object, realizing accurate and flexible control of the special effect object to move following the target virtual object in the virtual scene, and improving the special effect generation efficiency.
[0134] For the specific implementation of each of the above operations, reference can be made to the previous embodiments and will not be elaborated here.
[0135] Optionally, as Figure 6 shown, the electronic device 300 further includes: a touch display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. Among them, the processor 301 is electrically connected to the touch display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307 respectively. Those skilled in the art can understand that Figure 6 the structure of the electronic device shown in
[0136] The touch display screen 303 can be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface. The touch display screen 303 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, videos, and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. The touch panel can be used to collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any suitable object or accessory on or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute the corresponding program. Optionally, the touch panel 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, converts it into contact coordinates, and then sends it to the processor 301, and can receive and execute the commands sent by the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides a corresponding visual output on the display panel according to the type of touch event. In the embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 303 to implement the input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two independent components to implement the input and output functions. That is, the touch display screen 303 can also be used as a part of the input unit 306 to implement the input function.
[0137] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with a network device or other electronic devices through wireless communication, and transmit and receive signals with the network device or other electronic devices.
[0138] The audio circuit 305 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 305 can transmit the electrical signal after converting the received audio data to the speaker, and the speaker converts it into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 305 and then converted into audio data. After the audio data is output to the processor 301 for processing, it is transmitted through the radio frequency circuit 304 to, for example, another electronic device, or the audio data is output to the memory 302 for further processing. The audio circuit 305 may also include an earphone jack to provide communication between a peripheral earphone and the electronic device.
[0139] The input unit 306 can be used to receive input digital, character information or user feature information (such as fingerprint, iris, face information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0140] The power supply 307 is used to supply power to each component of the electronic device 300. Optionally, the power supply 307 can be logically connected to the processor 301 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 307 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
[0141] Although Figure 6 not shown in the figure, the electronic device 300 may further include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.
[0142] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. It should be noted that the electronic device provided in the embodiments of the present application and the special effect generation method in the above embodiments belong to the same concept. The specific implementation process is detailed in the above method embodiments and will not be elaborated here.
[0143] As can be seen from the above, the electronic device provided in the embodiments of the present application can obtain the first position information of the target virtual object and the second position information of the special effect object in the virtual scene; based on the first position information and the second position information, determine the first trajectory parameter of the special effect object relative to the target virtual object; according to the motion information of the target virtual object and the first trajectory parameter, determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object; based on the target trajectory parameter, control the special effect object to move following the target virtual object in the virtual scene. In this way, by determining the first trajectory parameter of the special effect object relative to the target virtual object according to the position information of the target virtual object and the special effect object in the virtual scene, and determining the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter, based on the target trajectory parameter, the special effect object can be adapted to the motion of the target virtual object, and accurate and flexible control of the special effect object to move following the target virtual object in the virtual scene can be realized, improving the special effect generation efficiency.
[0144] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by a computer program or by controlling related hardware through a computer program. The computer program can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0145] For this reason, an embodiment of the present application provides a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps in any of the special effect generation methods provided by the embodiments of the present application. For example, the computer program can execute the following steps:
[0146] Obtain the first position information of the target virtual object and the second position information of the special effect object in the virtual scene; based on the first position information and the second position information, determine the first trajectory parameter of the special effect object relative to the target virtual object; according to the motion information of the target virtual object and the first trajectory parameter, determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object; based on the target trajectory parameter, control the special effect object to move following the target virtual object in the virtual scene.
[0147] This solution can obtain the first position information of the target virtual object and the second position information of the special effect object in the virtual scene; based on the first position information and the second position information, determine the first trajectory parameter of the special effect object relative to the target virtual object; according to the motion information of the target virtual object and the first trajectory parameter, determine the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object; based on the target trajectory parameter, control the special effect object to move following the target virtual object in the virtual scene. In this way, by determining the first trajectory parameter of the special effect object relative to the target virtual object according to the position information of the target virtual object and the special effect object in the virtual scene, and determining the target trajectory parameter of the following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter, based on the target trajectory parameter, the special effect object can be adapted to the motion of the target virtual object, and accurately and flexibly control the special effect object to move following the target virtual object in the virtual scene, improving the special effect generation efficiency.
[0148] For the specific implementation of each of the above operations, reference can be made to the previous embodiments and will not be elaborated here.
[0149] Among them, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), a magnetic disk or an optical disc, etc.
[0150] Since the computer program stored in the computer-readable storage medium can execute the steps in any of the special effect generation methods provided by the embodiments of the present application, the beneficial effects achievable by any of the special effect generation methods provided by the embodiments of the present application can be realized. For details, refer to the previous embodiments and will not be elaborated herein.
[0151] Wherein, according to one aspect of the present application, there is provided a computer program product, the computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the methods provided in various optional implementation manners provided in the above embodiments.
[0152] The above has introduced in detail a special effect generation method, device, storage medium and electronic device provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A special effect generation method, characterized in that: include: Acquire first position information of a target virtual object and second position information of a special effect object in a virtual scene; Determining a first trajectory parameter of the special effect object relative to the target virtual object based on the first position information and the second position information; Determining, according to the motion information of the target virtual object and the first trajectory parameter, a target trajectory parameter of the special effect object relative to the following trajectory of the target virtual object; Based on the target trajectory parameters, the special effect object is controlled to move in the virtual scene following the target virtual object.
2. The special effect generation method according to claim 1, characterized in that: The step of determining, according to the motion information of the target virtual object and the first trajectory parameter, a target trajectory parameter of the special effect object relative to the target virtual object includes: Acquire motion information and trajectory simulation period of the target virtual object; Determine, according to the motion information and the trajectory simulation period, and the first position information of the target virtual object, the third position information of the target virtual object after the trajectory simulation period; determining a second trajectory parameter based on the second position information and the third position information; Based on the first trajectory parameter and the second trajectory parameter, a target trajectory parameter of the special effect object relative to the following trajectory of the target virtual object is determined.
3. The special effect generation method according to claim 2, characterized in that: The determining, according to the motion information, the trajectory simulation period, and the first position information of the target virtual object, the third position information of the target virtual object after the trajectory simulation period includes: Calculating a predicted trajectory offset distance according to the trajectory simulation period and the motion information; The first position information of the target virtual object and the predicted trajectory offset distance are added to obtain third position information of the target virtual object after the trajectory simulation cycle.
4. The special effect generation method according to claim 2, characterized in that: The determining of the second trajectory parameter based on the second position information and the third position information includes: Based on the second position information and the third position information, and a curve formula of the first target curve, a second trajectory parameter is determined, wherein the second position information serves as a starting point of the first target curve, and the third position information serves as an end point of the first target curve.
5. The special effect generation method according to claim 1, characterized in that: The determining, based on the first position information and the second position information, a first trajectory parameter of the special effect object relative to the target virtual object includes: Based on the first position information and the second position information, and the curve formula of the second target curve, determine the first trajectory parameter of the special effect object relative to the target virtual object, wherein the second position information serves as the starting point of the second target curve and the first position information serves as the ending point of the second target curve.
6. The special effect generation method according to any one of claims 1 to 5, characterized in that: The special effect object is configured with a plurality of special effect stages, and the plurality of special effect stages include a static stage, a following stage and a triggering stage; When there is no collision between the special effect object and the target virtual object, the special effect object is in the static stage; when there is a first collision between the special effect object and the target virtual object, the special effect object enters the following stage, in which the special effect object follows the movement of the target virtual object; when there is a second collision between the special effect object and the target virtual object, the special effect object enters the triggering stage, in which the special effect object stops following the target virtual object; The step of obtaining first position information of a target virtual object and second position information of a special effect object in a virtual scene includes: When the special effect object is in the following stage, first position information of the target virtual object and second position information of the special effect object in the virtual scene are obtained.
7. The special effect generation method according to claim 6, characterized in that: The special effect object is configured with a plurality of special effect object layers, and each of the special effect stages is configured to render the special effect object based on at least one special effect object layer.
8. The special effect generation method according to claim 7, characterized in that: Each of the special effect object layers is provided with at least one special effect layer configuration parameter, each special effect layer configuration parameter corresponds to a different special effect complexity, and the process of determining the special effect layer configuration parameters corresponding to each special effect stage of the special effect object includes: Acquire a display control parameter of the special effect object in the virtual scene, wherein the display control parameter includes at least one of a camera distance between the special effect object and a virtual camera of the virtual scene and a movement speed in the virtual scene; Based on the display control parameters, the special effect layer configuration parameters corresponding to the special effect object in each special effect stage are determined.
9. The special effect generation method according to claim 8, characterized in that: The display control parameter includes the camera distance, the special effect object layer is set with at least two special effect layer configuration parameters, and determining the special effect layer configuration parameters corresponding to the special effect object in each special effect stage based on the display control parameter includes: According to the correspondence between the special effect layer configuration parameters of each special effect object layer and the preset distance range, and the camera distance, the special effect layer configuration parameters corresponding to the special effect object in each special effect stage are determined.
10. The special effect generation method according to claim 8, characterized in that: The display parameter includes the motion speed, the special effect object layer is provided with at least two special effect layer configuration parameters, and determining the special effect layer configuration parameters corresponding to the special effect object in each special effect stage based on the display control parameter includes: According to the correspondence between the special effect layer configuration parameters of each special effect object layer and the preset speed range, and the movement speed, the special effect layer configuration parameters corresponding to the special effect object in each special effect stage are determined.
11. A special effect generating device, characterized in that: include: An acquisition unit, used to acquire first position information of a target virtual object and second position information of a special effect object in a virtual scene; A first determining unit, configured to determine a first trajectory parameter of the special effect object relative to the target virtual object based on the first position information and the second position information; A second determining unit, configured to determine a target trajectory parameter of a following trajectory of the special effect object relative to the target virtual object according to the motion information of the target virtual object and the first trajectory parameter; A control unit is used to control the special effect object to move in the virtual scene following the target virtual object based on the target trajectory parameters.
12. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The method comprises a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of any one of the methods of claims 1 to 10.