Three-dimensional animation processing method and device and electronic equipment
By building scripts in the drawing engine to output configuration panels and draw motion trajectories, the problem that existing tools cannot provide the motion paths of objects in three-dimensional animations is solved, and the user's ability to visually edit motion trajectories is realized, improving the user experience.
Patent Information
- Application Number
- CN202411576569.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-21
AI Technical Summary
Existing game development tools cannot provide the motion path of objects in three-dimensional animations, which makes it inconvenient for developers to develop games.
By building the first script and the second script in the drawing engine, outputting the configuration panel, the user can configure the path items of the moving object, the first script creates the target animation, the second script draws the motion trajectory for the target object in the target animation, and outputs the Preview screen.
It realizes that when users use the drawing engine to create three-dimensional animations, they can visually display the motion trajectory of moving objects in the target animation, improving the user experience.
Smart Images

Figure CN119494896A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a three-dimensional animation processing method, device and electronic equipment. Background Art
[0002] Typically, users can use game development tools to create 3D animations in which objects move.
[0003] However, current game development tools cannot provide the motion paths of objects in three-dimensional animations, making it inconvenient for developers to develop games. Summary of the invention
[0004] In view of the above problems, the present application provides a 3D animation processing method, device and electronic device to improve the user experience of using the rendering engine. The specific solution is as follows:
[0005] A first aspect of the present application provides a three-dimensional animation processing method, the method comprising:
[0006] Outputting a configuration panel through a first script, wherein the configuration panel presents a plurality of configuration items about a moving object; the first script is constructed based on a rendering engine of a three-dimensional animation;
[0007] In response to a configuration operation on at least one of the configuration items on the configuration panel, creating a target animation through the first script; the target animation includes at least one target object;
[0008] In response to the configuration operation, drawing a corresponding motion trajectory for the target object in the target animation through a second script, the second script being constructed based on the drawing engine;
[0009] A preview screen of the target animation is output, wherein the preview screen is at least used to present a motion trajectory corresponding to the target object.
[0010] In a possible implementation, the configuration operation includes: configuration information of the target object at a plurality of configuration points, the configuration points corresponding to motion postures corresponding to the target object;
[0011] Wherein, the method further comprises:
[0012] receiving a configuration modification operation on the configuration panel for the configuration point;
[0013] In response to the configuration modification operation, the motion trajectory corresponding to the target object in the target animation is adjusted according to the modification information in the configuration modification operation.
[0014] In a possible implementation, the first script includes a first code module, and the first code module is used to execute:
[0015] receiving a configuration modification operation on the configuration panel for the configuration point;
[0016] In response to the configuration modification operation, the motion trajectory corresponding to the target object in the target animation is adjusted according to the modification information in the configuration modification operation.
[0017] In a possible implementation, the first script is saved in a target folder of the drawing engine;
[0018] The first script includes: a custom editor class, which is inherited from the editor class in the drawing engine; and the custom editor class is used to implement the configuration panel.
[0019] In a possible implementation, the first script includes a second code module, and the second code module is used to create a first graphical user interface in the configuration panel;
[0020] Wherein, the first graphical user interface is used to trigger an operation of acquiring target information; the target information at least includes: the position and direction of a current viewing angle camera of the target animation.
[0021] In a possible implementation, the configuration operation includes: configuration information of the target object at a plurality of configuration points, the configuration points corresponding to motion postures corresponding to the target object;
[0022] Wherein, drawing a corresponding motion trajectory for the target object in the target animation through the second script includes:
[0023] Creating a plurality of control points corresponding to a Bezier curve according to the configuration points in the configuration operation;
[0024] According to the plurality of control points, a plurality of curve points are obtained;
[0025] A corresponding motion trajectory is drawn for the target object according to the plurality of curve points, wherein the motion trajectory is a curve type of a Bezier curve.
[0026] In a possible implementation, the configuration operation further includes: a curve smoothness parameter; the curve smoothness parameter is used to control the curve smoothness of the motion trajectory;
[0027] Wherein, according to the multiple control points, multiple curve points are obtained, including:
[0028] The third code module in the second script is used to process the starting point, the ending point, the multiple control points, and the curve smoothness parameter in the configuration points to obtain multiple curve points.
[0029] In a possible implementation, the configuration operation includes: configuration information of the target object at a plurality of configuration points, the configuration points corresponding to motion postures corresponding to the target object;
[0030] The configuration items include: configuration items of easing type;
[0031] Wherein, drawing a corresponding motion trajectory for the target object in the target animation through the second script includes:
[0032] At least according to the configuration information corresponding to each of the configuration points in the configuration item of the easing type in the configuration operation, obtain the corresponding motion progress of the target object at each motion time, wherein the motion progress represents the progress of the posture change between two adjacent configuration points;
[0033] According to the corresponding motion progress of the target object at each motion time, a corresponding motion trajectory is drawn for the target object, and the motion trajectory is a slow motion curve type.
[0034] A second aspect of the present application provides a three-dimensional animation processing device, the device comprising:
[0035] A panel output unit, configured to execute a first script, wherein the first script is configured to output a configuration panel, wherein the configuration panel presents a plurality of configuration items about a moving object; the first script is constructed based on a rendering engine for a three-dimensional animation; in response to a configuration operation on the configuration panel for at least one of the configuration items, a target animation is created; the target animation includes at least one target object; the configuration operation includes: configuration information of the target object at a plurality of configuration points, wherein the configuration points correspond to the corresponding motion postures of the target object;
[0036] a trajectory drawing unit, configured to execute a second script, wherein the second script is configured to draw a corresponding motion trajectory for the target object in the target animation in response to a configuration operation for at least one of the configuration items, and the second script is constructed based on the drawing engine;
[0037] The animation preview unit is used to output the target animation, and the target animation is used to present the motion posture of the target object corresponding to each of the configuration points.
[0038] A third aspect of the present application provides a computer program product, comprising computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the three-dimensional animation processing method of the first aspect or any implementation method of the first aspect.
[0039] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0040] The memory is used to store computer programs;
[0041] The processor is used to execute the computer program so that the electronic device can implement the three-dimensional animation processing method of the above-mentioned first aspect or any implementation manner of the first aspect.
[0042] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can perform the three-dimensional animation processing method of the above-mentioned first aspect or any implementation method of the first aspect.
[0043] With the help of the above technical scheme, in a three-dimensional animation processing method, device and electronic device provided by the present application, function expansion is performed in the drawing engine. After the first script and the second script are constructed based on the drawing engine, a configuration panel is output to the user through the first script. After the user performs configuration operations on the configuration items of the moving object on the configuration panel, the target animation can be created through the first script, and the motion trajectory of the target object in the target animation can be drawn through the second script. In this way, when the preview screen of the target animation is output, the motion trajectory corresponding to the target object can be presented to the user. In this way, in the process of the user using the drawing engine to create the target animation, the motion trajectory of the moving object in the target animation is visible to the user, thereby improving the user experience of using the drawing engine. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 A flowchart of a three-dimensional animation processing method provided in an embodiment of the present application;
[0046] Figure 2 An example diagram of a configuration panel implemented in an embodiment of the present application;
[0047] Figure 3 An example diagram of the target animation achieved by the embodiment of the present application;
[0048] Figure 4 This is an example diagram of implementing trajectory preview in an embodiment of the present application;
[0049] Figure 5 A partial flow chart of a three-dimensional animation processing method provided in an embodiment of the present application;
[0050] Figure 6 An example diagram of the configuration points of the target object in the embodiment of the present application;
[0051] Figure 7 Another partial flow chart of a three-dimensional animation processing method provided in an embodiment of the present application;
[0052] Figure 8 This is an example diagram of control points in the embodiments of the present application;
[0053] Fig. 9 Another partial flow chart of a three-dimensional animation processing method provided in an embodiment of the present application;
[0054] Fig.10 A schematic diagram of the structure of a three-dimensional animation processing device provided in an embodiment of the present application;
[0055] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0056] Fig.12 This is an example diagram of configuring the configuration items of the path points in the configuration panel implemented in this application;
[0057] Fig.13 Real-time display and preview of the paths and curves drawn for this application. DETAILED DESCRIPTION
[0058] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0059] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0060] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0061] refer to Figure 1 , is a flowchart of a method for processing 3D animation provided in an embodiment of the present application, which can be applied to electronic devices capable of data processing, such as mobile phones, tablet devices or notebooks equipped with a 3D animation painting engine. The technical solution in this embodiment is mainly used to improve the user experience of creating 3D animation using a painting engine.
[0062] Specifically, the method in this embodiment may include the following steps:
[0063] Step 101: Output a configuration panel through a first script.
[0064] The first script is constructed based on the drawing engine of the three-dimensional animation. The first script can be a script written based on C#. The first script is added to the drawing engine. Based on this, after the drawing engine is started, the drawing engine can call the first script, thereby outputting a configuration panel, and the user can operate on the configuration panel.
[0065] It should be noted that the configuration panel presents multiple configuration items about the moving object. For example, for each moving object, there can be multiple configuration items, such as Figure 2 As shown in , the configuration panel at least includes the configuration items of "need camera screenshot transition", "stay time after reaching", "path cycle type", "movement easing type", "movement time", "rotation easing type", "reach the last node to surround the target point", etc. Therefore, the user can configure one or more corresponding configuration items for each moving object on the configuration panel.
[0066] Step 102: In response to a configuration operation on at least one configuration item on the configuration panel, create a target animation through a first script.
[0067] The configuration operation may include an operation of at least one target object on at least one configuration item. The target object here is a moving object on the configuration panel on which the user performs a configuration operation of the configuration item.
[0068] The target animation can contain at least one target object. Figure 3 As shown in , there is a ball in the target animation. The ball moves in the target animation. The ball is the target object.
[0069] Step 103: In response to the configuration operation, a corresponding motion trajectory is drawn for the target object in the target animation through the second script.
[0070] The second script is built based on the drawing engine. The second script can be a script written based on C#. The second script is added to the drawing engine. Based on this, after the drawing engine is started, the drawing engine can call the second script, thereby drawing a corresponding motion track for the target object in the target animation created by the first script, thereby outputting the motion track of the target object to the user in the target animation.
[0071] Step 104: Output a preview image of the target animation.
[0072] The preview screen is at least used to present the motion trajectory corresponding to the target object. The preview screen can be presented in the output interface constructed by the rendering engine, such as Figure 4 as shown in .
[0073] It can be seen from the above scheme that in a three-dimensional animation processing method provided by an embodiment of the present application, function expansion is performed in the drawing engine. After the first script and the second script are constructed based on the drawing engine, a configuration panel is output to the user through the first script. After the user performs configuration operations on the configuration items of the moving object on the configuration panel, the target animation can be created through the first script, and the motion trajectory can be drawn for the target object in the target animation through the second script. In this way, when the preview screen of the target animation is output, the motion trajectory corresponding to the target object can be presented to the user. In this way, in the process of the user using the drawing engine to create the target animation, the motion trajectory of the moving object in the target animation is visible to the user, thereby improving the user experience of using the drawing engine.
[0074] In one implementation, the configuration operation may include: configuration information of the target object at multiple configuration points, the configuration points corresponding to the corresponding motion postures of the target object, that is, each motion posture of the target object corresponds to a configuration point, and the user can perform configuration operations on the configuration panel for the configuration items corresponding to each configuration point of the target object, and the resulting configuration operation includes the configuration information of the target object at each configuration point, such as the configuration information corresponding to each configuration point on configuration items such as "stay time after arrival", "path cycle type", "movement easing type", "time required for movement", and "rotation easing type".
[0075] Based on this, in step 102, a corresponding target animation can be created through a first script based on the configuration information of the target object at each configuration point, and each motion posture of the target object in the target animation matches the configuration information at each configuration point in the configuration operation. At the same time, in step 103, a corresponding motion trajectory can be drawn for the target object in the target animation through a second script based on the configuration information of the target object at each configuration point, and the trajectory position of the target object in its motion trajectory matches the configuration information of each configuration point.
[0076] Therefore, after step 104, the present embodiment may further include the following processing: Figure 5 As shown in:
[0077] Step 105: Receive a configuration modification operation for a configuration point on the configuration panel.
[0078] For example, Figure 2 For example, the user can modify the existing configuration information of each configuration point on the configuration panel, such as modifying the configuration items such as "stay time after arrival", "path cycle type", "movement deceleration type", and "time required for movement". Based on this, the present embodiment can receive a configuration modification operation, which includes the modification information of each configuration point on the modified configuration item, that is, the information of the modified configuration item, such as the modified "stay time after arrival", "path cycle type", "movement deceleration type", and "time required for movement".
[0079] Step 106: In response to the configuration modification operation, the motion trajectory corresponding to the target object in the target animation is adjusted according to the modification information in the configuration modification operation.
[0080] Specifically, in step 106, the first script can be used to adjust the motion trajectory corresponding to the target object in the target animation according to the modification information, such as adjusting the trajectory position corresponding to the modified configuration point, thereby obtaining a new motion trajectory corresponding to the target object. The new motion trajectory is synchronously presented in the preview screen.
[0081] Therefore, in this embodiment, the first script can be used to provide users with a visual editing service of the motion trajectory, thereby further improving the user experience of using the drawing engine.
[0082] In a specific implementation, the first script may include a first code module, and the first code module is used to execute step 105 and step 106. The first code module may be a function module of OnSceneGUI(), and the first code module may be used to draw a custom graphic or interact based on the user's input operation in the configuration panel, that is, to preview, draw or modify the motion trajectory. Specifically, the first code module may use a corresponding class or method in the drawing engine to preview, draw or modify the motion trajectory.
[0083] In one implementation, the first script is saved in a target folder of the drawing engine. Based on this, the first script at least includes: a custom editor class, which is inherited from the editor class in the drawing engine, and is used to implement the configuration panel.
[0084] For example, the custom editor class in the first script may be AILensSeqEditor, which is the script type of AILensSeq. The AILensSeqEditor can implement a configuration panel by inheriting the editor class in the drawing engine.
[0085] In one implementation, the first script may include a second code module, and the second code module is used to create a first graphical user interface on the configuration panel.
[0086] The first graphical user interface is used to trigger an operation of acquiring target information. The target information at least includes: the position and direction of the current viewing angle camera of the target animation.
[0087] In addition, the second code module is also used to create a second graphical user interface in the configuration panel, and the second graphical user interface is used to set the functions of the current view camera, for example, setting the current view camera to the current configuration point position, that is, the current node position, and for example, obtaining the focus position of the scene camera and synchronizing it to the current view camera.
[0088] For example, the second code module may be OnInspectorGUI(). In this embodiment, the OnInspectorGUI() in the drawing engine is rewritten so that the OnInspectorGUI() can customize the appearance and functions of the configuration panel. For example, customized graphical user interface GUI (Graphical User Interface) elements may be added, such as a first button for obtaining the position and direction of the current view camera, a second button for setting the current view camera to the current node position, and a third button for obtaining the focus position of the scene camera and synchronizing it to the current view camera. The GUI elements may also be sliders, text fields, etc.
[0089] In one implementation, the configuration operation may include: configuration information of the target object at a plurality of configuration points, where the configuration points correspond to the motion postures of the target object. Figure 6 As shown in , the target object corresponds to multiple configuration points, and each configuration point corresponds to the motion posture of the target object at the configuration point, such as position and posture (such as orientation).
[0090] Based on this, in step 103, when drawing the corresponding motion trajectory for the target object in the target animation by the second script, it can be achieved in the following ways, such as Figure 7 As shown in:
[0091] Step 701: Create a plurality of control points corresponding to the Bezier curve according to the configuration points in the configuration operation.
[0092] For example, in this embodiment, for each configuration point, at least one corresponding control point can be created based on the motion position corresponding to the previous configuration point. Thus, multiple control points are created for the target object.
[0093] Step 702: Obtain multiple curve points according to multiple control points.
[0094] Specifically, in step 702, the third code module in the second script may be used to process the start point, the end point and the multiple control points in the configuration points to obtain multiple curve points.
[0095] Step 703: Draw a corresponding motion trajectory for the target object according to the multiple curve points.
[0096] The motion trajectory is a Bezier curve type. Figure 8 As shown in , in this embodiment, firstly, multiple control points are created based on the configuration points of the user, multiple curve points are obtained according to the control points, and then these curve points are connected to obtain the motion trajectory of the target object.
[0097] Furthermore, in this embodiment, the third code module in the second script, such as a code module based on the GetBeizerList method, can be used to process the starting point, the end point, multiple control points and the curve smoothness parameters in the configuration points to obtain multiple curve points.
[0098] The curve smoothness parameter here can be obtained from the configuration operation, that is, the user configures the parameters through the configuration panel. The curve smoothness parameter is used to control the curve smoothness of the motion trajectory. Therefore, in this embodiment, the curve points can be set according to the user's drawing requirements for the curve smoothness, and the curve smoothness presented by these curve points after being connected matches the curve smoothness parameter set by the user.
[0099] The more the number of curve points obtained based on the curve smoothness parameter within a unit distance is, the higher the smoothness of the presented curve is, and the smoother the movement of the target object in the target animation is for the user.
[0100] Specifically, the third code module may process the starting point, the ending point, the multiple control points and the curve smoothness parameters in the configuration points based on the Bezier formula to obtain multiple curve points.
[0101] In addition, in this embodiment, the second script may also include a fourth code module such as a code module based on the OnValidate() method. The fourth code module can verify the configuration information corresponding to each configuration item in the configuration operation to ensure that the configuration information satisfies the configuration rules, such as the parameters in the configuration information need to be within the parameter range corresponding to the corresponding configuration item.
[0102] In one implementation, the configuration operation may include: configuration information of the target object at multiple configuration points, where the configuration points correspond to the corresponding motion postures of the target object. The configuration items include configuration items of easing type, and accordingly, each configuration point has corresponding configuration information of easing type, such as configuration information of moving easing type and configuration information of rotating easing type. Based on this, when drawing the corresponding motion trajectory for the target object in the target animation through the second script in step 103, it can be implemented in the following manner, such as Fig. 9 As shown in:
[0103] Step 901: obtaining the corresponding motion progress of the target object at each motion time according to at least the configuration information corresponding to each configuration point in the configuration item of the easing type in the configuration operation.
[0104] Among them, the motion progress represents the progress of the posture change between two adjacent configuration points, such as the position change progress and the posture change progress. Different easing types correspond to different easing functions, such as linear, square, cubic, exponential and other functions. The easing function is used to obtain the corresponding motion progress of the target object at each motion time.
[0105] It should be noted that the input parameters of the easing function may include: the movement time of the current configuration point, i.e., the current timestamp, and the animation duration, i.e., the total duration from the previous configuration point to the current configuration point. The easing function calculates the movement progress of the target object at the movement time corresponding to the current configuration point based on the input parameters.
[0106] In addition, the motion progress of the target object at each motion time can also be used for other operations, such as updating the position, scaling, rotation, etc. of the target object in the target animation.
[0107] Specifically, in this embodiment, a fifth code module can be constructed in advance in the second script, such as a code module based on AI_LensHelper. The fifth code module can call a corresponding easing function such as the Evaluate method, and pass the target object's starting posture, ending posture, animation duration, current motion time and easing function as parameters, thereby obtaining the current value of the animation, that is, the motion progress corresponding to the target object at the motion time.
[0108] Step 902: Draw a corresponding motion trajectory for the target object according to the corresponding motion progress of the target object at each motion time.
[0109] The motion trajectory is a curve type of motion easing.
[0110] Specifically, in this embodiment, a trajectory can be drawn according to the corresponding motion progress of the target object at each motion time, thereby obtaining the motion trajectory corresponding to the target object. The obtained motion trajectory is a slow-motion type curve, and the motion type of the target object presented is slow motion.
[0111] refer to Fig.10 , is a schematic diagram of the structure of a 3D animation processing device provided in an embodiment of the present application, which can be configured in an electronic device capable of data processing, such as a mobile phone, tablet device or notebook equipped with a 3D animation painting engine. The technical solution in this embodiment is mainly used to improve the user experience of creating 3D animation using a painting engine.
[0112] Specifically, the device in this embodiment may include the following modules:
[0113] The panel output unit 1001 is used to execute a first script, wherein the first script is used to output a configuration panel, wherein the configuration panel presents a plurality of configuration items about a moving object; the first script is constructed based on a rendering engine of a three-dimensional animation; in response to a configuration operation on the configuration panel for at least one of the configuration items, a target animation is created; the target animation includes at least one target object; the configuration operation includes: configuration information of the target object at a plurality of configuration points, wherein the configuration points correspond to the corresponding motion postures of the target object;
[0114] A trajectory drawing unit 1002, configured to execute a second script, wherein the second script is configured to draw a corresponding motion trajectory for the target object in the target animation in response to a configuration operation for at least one of the configuration items, and the second script is constructed based on the drawing engine;
[0115] The animation preview unit 1003 is used to output the target animation, where the target animation is used to present the motion posture of the target object corresponding to each of the configuration points.
[0116] With the help of the above technical scheme, in a three-dimensional animation processing device provided by an embodiment of the present application, function expansion is performed in the drawing engine. After the first script and the second script are constructed based on the drawing engine, a configuration panel is output to the user through the first script. After the user performs configuration operations on the configuration items of the moving object on the configuration panel, the target animation can be created through the first script, and the motion trajectory can be drawn for the target object in the target animation through the second script. In this way, when the preview screen of the target animation is output, the motion trajectory corresponding to the target object can be presented to the user. In this way, in the process of the user using the drawing engine to create the target animation, the motion trajectory of the moving object in the target animation is visible to the user, thereby improving the user experience of using the drawing engine.
[0117] In one implementation, the configuration operation includes: configuration information of the target object at a plurality of configuration points, the configuration points corresponding to motion postures corresponding to the target object;
[0118] Among them, the trajectory drawing unit 1002 is also used to: receive a configuration modification operation for the configuration point on the configuration panel; in response to the configuration modification operation, adjust the motion trajectory corresponding to the target object in the target animation according to the modification information in the configuration modification operation.
[0119] Specifically, the first script includes a first code module, and the first code module is used to execute the following: receiving a configuration modification operation for the configuration point on the configuration panel; in response to the configuration modification operation, adjusting the motion trajectory corresponding to the target object in the target animation according to the modification information in the configuration modification operation.
[0120] In one implementation, the first script is saved in a target folder of the drawing engine; wherein the first script includes: a custom editor class, the custom editor class inherits from an editor class in the drawing engine; the custom editor class is used to implement the configuration panel.
[0121] In one implementation, the first script includes a second code module, and the second code module is used to create a first graphical user interface in the configuration panel; wherein the first graphical user interface is used to trigger an operation to obtain target information; and the target information includes at least: the position and direction of the current perspective camera of the target animation.
[0122] In one implementation, the configuration operation includes: configuration information of the target object at multiple configuration points, the configuration points corresponding to the corresponding motion posture of the target object; when the second script draws the corresponding motion trajectory for the target object in the target animation, it is specifically used to: create multiple control points corresponding to the Bezier curve according to the configuration points in the configuration operation; obtain multiple curve points according to the multiple control points; and draw the corresponding motion trajectory for the target object according to the multiple curve points, and the motion trajectory is a curve type of the Bezier curve.
[0123] In one implementation, the configuration operation also includes: a curve smoothness parameter; the curve smoothness parameter is used to control the curve smoothness of the motion trajectory; when the second script obtains multiple curve points according to the multiple control points, it is specifically used to: use the third code module in the second script to process the starting point, the end point, the multiple control points, and the curve smoothness parameter in the configuration point to obtain multiple curve points.
[0124] In one implementation, the configuration operation includes: configuration information of the target object at a plurality of configuration points, the configuration points corresponding to the motion postures corresponding to the target object; the configuration items include: configuration items of easing type;
[0125] Among them, when the second script draws the corresponding motion trajectory for the target object in the target animation, it is specifically used to: obtain the corresponding motion progress of the target object at each motion time at least according to the configuration information corresponding to each of the configuration points in the configuration operation on the configuration item of the easing type, and the motion progress represents the progress of the posture change between two adjacent configuration points; according to the corresponding motion progress of the target object at each motion time, draw the corresponding motion trajectory for the target object, and the motion trajectory is a curve type of motion easing.
[0126] It should be noted that the specific implementation method of each unit in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.
[0127] An embodiment of the present application further provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0128] The memory is used to store computer programs;
[0129] The processor is used to execute the computer program so that the electronic device can implement the three-dimensional animation processing method described in any of the above embodiments.
[0130] refer to Fig.11 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic device in the embodiments of the present application may include but is not limited to fixed terminals such as mobile phones, notebook computers, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig.11 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0131] like Fig.11 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage device 1108 to a random access memory (RAM) 1103, so as to implement the processing method of the three-dimensional animation described in any of the embodiments above. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 1103. The processing device 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0132] Typically, the following devices may be connected to the I / O interface 1105: an input device 1106 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1107 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1108 including, for example, a memory card, a hard disk, etc.; and a communication device 1109. The communication device 1109 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.11 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0133] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any three-dimensional animation processing method provided in the embodiment of the present application.
[0134] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any three-dimensional animation processing method provided in the embodiment of the present application.
[0135] Taking the drawing engine of three-dimensional animation as an example, the technical solution of this application is illustrated as follows:
[0136] First of all, this application expands the functionality of the editor of the drawing engine, specifically by generating a Bezier path through C# code, and then configuring the position, rotation, movement speed, movement slow-motion animation, rotation slow-motion animation, response events, etc. of each path point (i.e., configuration point) to play and preview the trajectory motion, so that a motion path (i.e., motion trajectory) of a moving object can be quickly and easily built. The motion path supports three types of loops, including first connection, starting from the beginning, and reciprocating loops. This application provides an application programming interface (API) for conveniently calling animation playback, pause, and playback of a specified path. Fig.12 As shown in , it is an example diagram of configuring the configuration items of the path points in the configuration panel implemented in this application, such as Fig.13 As shown in the figure, it is a real-time display and preview of the path and curve drawn by this application.
[0137] The following is an explanation of the application's extension of the property panel of the drawing engine's editor:
[0138] In the extension of the editor, you can inherit the Editor class through the extension script and override the OnInspectorGUI method. In the OnInspectorGUI method, you can display the elements and call methods as needed, and display the UI layout according to the methods provided by the GUI.
[0139] refer to Fig.12 , the steps to extend the editor are as follows:
[0140] 1. Create a new C# script, the first script, which will be used to create the editor extension. Name it "AILensSeqEditor", which is the name of the first script.
[0141] 2. In the script, use the Editor namespace of the drawing engine to define a custom editor class, namely AILensSeqEditor below, which will inherit from the Editor class. For example:
[0142] using UnityEditor;
[0143] using UnityEngine;
[0144] [CustomEditor(typeof(AILensSeq))]
[0145] public class AILensSeqEditor:Editor
[0146] {
[0147] / / Implement the custom editor class functionality here
[0148] }
[0149] In the above code, this application uses the [CustomEditor] attribute to specify the script type to be extended, such as the type of AILensSeq in the previous text. In this example, this application can apply a custom editor to a script named "AILensSeq".
[0150] 3. In the custom editor class, you can rewrite some methods to implement the required functions. As follows:
[0151] OnInspectorGUI(): Override this method to customize the appearance and functionality of the Inspector panel. You can add custom GUI elements such as buttons, sliders, text fields, etc.
[0152] OnSceneGUI(): Override this method to draw custom graphics or interact in the scene view. You can use the Handles class of the drawing engine to draw lines, shapes, etc.
[0153] OnEnable() and OnDisable(): These methods are called when the editor window is enabled and disabled. You can do initialization and cleanup work in these methods.
[0154] OnValidate(): This method is called when the field value in the Inspector panel changes. Validation and processing can be done in this method.
[0155] OnGUI(): This method is called in every frame of the editor window. You can implement your custom GUI drawing logic in this method.
[0156] 4. Implement the required functions in the custom editor class. You can use the GUI layout and drawing functions provided by the drawing engine to create a custom editor interface.
[0157] 5. Save the script to the Editor folder in the drawing engine's project file.
[0158] 6. In the drawing engine editor, select the script object to be extended, that is, the first script, and then view and use the custom editor class in the Inspector panel.
[0159] The core code of the script is as follows:
[0160] public class AILensSeqEditor:Editor
[0161] {
[0162] private void OnSceneGUI(UnityEditor.SceneView sceneView) / / Custom refresh event delegate method
[0163] {
[0164] Repaint();
[0165] }
[0166] The following is a description of the algorithm for generating a Bezier curve by controlling multiple points in this application:
[0167] In this application, by reading the configuration information of the current configuration point and automatically generating a path curve according to the position of the previous path (previous configuration point), multiple Bezier control points can be created to control the expression of the current curve. The number of control points corresponds to the order of the Bezier curve formula used.
[0168] The specific implementation method is as follows:
[0169] 1. Create a new C# class, the second script, which will be used to calculate and draw Bezier curves. Name it "AI_LensHelper".
[0170] 2. In the script, define a public static method such as the GetBeizerList method in the following code. This method will accept a starting point, an end point, a set of Bezier control points, a curve smoothness parameter, and return a list representing the points on the Bezier curve. For example, the core code of the second script is as follows:
[0171] using UnityEngine;
[0172] using System.Collections.Generic;
[0173] public class AI_LensHelper
[0174] {
[0175] public static List <vector3>GetBeizerList(Vector3 startPoint,TransformendPoint,List <transform>controlPoint,int segmentNum=30)
[0176] {
[0177] List <vector3>curvePoints=new List <vector3>();
[0178] / / Implement the calculation of Bezier curve here
[0179] return curvePoints;
[0180] }
[0181] }
[0182] Among them, startPoint is the starting point; endPoint is the end point; controlPoint is used to store control points; segmentNum is the curve smoothness parameter, which represents the number of curve points in a unit instance. The constructed curve points are stored in curvePoints.
[0183] 3. In the GetBeizerList method, use the Bezier curve formula to calculate the points on the curve. The order of the Bezier curve formula is determined based on the number of control points.
[0184] 4. In the GetBeizerList method, use a loop to calculate multiple curve points on the curve. The resolution (that is, the number of points, which is the curve smoothness parameter mentioned above) can be adjusted as needed.
[0185] 5. Add the calculated points to the curvePoints list.
[0186] 6. Return the curvePoints list as the output of the method.
[0187] 7. When the motion path is displayed and the object is moving, call the GetBeizerList method and pass the control point list as a parameter. Then, you can use the returned point list to draw the curve and move it.
[0188] Taking the Bezier curve drawing of three control points as an example, the key C# code is implemented as follows:
[0189]
[0190] The following is an explanation of the implementation of the slow-motion animation algorithm in this application:
[0191] In this application, the easing type of the movement and rotation of the current configuration point can be read and the easing of the animation can be realized according to the C# algorithm.
[0192] Combination Fig.13 The specific steps for drawing the curve are as follows:
[0193] 1. Use the AI_LensHelper script created above, which is the second script.
[0194] 2. In the script, define a public static method such as Evaluate, which will accept the animation type, current time, total duration, animation curve, and return the current value of the animation. The code is as follows:
[0195]
[0196] Among them, easeType is the easing type, time is the current time, that is, at two configuration points ( Fig.13 duration is the total duration, AnimationCurve m_Curve is the animation curve, overshootOrAmplitude is the motion parameter in the corresponding motion type, period is the motion parameter, and currentValue is used to store the motion progress.
[0197] 3. In the easing animation algorithm, the selected easing function is used to calculate the current value of the animation (i.e. the progress of the motion). Common easing functions include linear, square, cubic, exponential, etc. You can use different easing functions as needed. If a specific easing curve is passed in, you need to read the specific value on the curve and return it.
[0198] 4. Before calculating the current value, the progress of the animation can be calculated by the timestamp (time) and the animation duration (duration), and used as the input of the easing function.
[0199] 5. Based on the calculated current value, other operations can be performed, such as updating the position, scaling, rotation, etc. of the game object.
[0200] 6. Return the current value as the output of the method.
[0201] 7. You can call the Evaluate method and pass the starting value, target value, animation duration, current time, and easing function as parameters. Then, you can use the returned current value to achieve the animation effect.
[0202] The core code is as follows:
[0203]
[0204] It can be seen that the technical solution of this application has the following key points:
[0205] 1. The editor of the extended drawing engine is combined with C# scripts to achieve smooth transition of curves of moving objects and real-time display and preview of paths.
[0206] 2. In the drawing engine, the C# implementation algorithm is based on the Bezier curve formula and the easing animation formula.
[0207] In summary, this application is based on Bezier curves and easing animation algorithms to solve the problem that the drawing engine cannot display and preview the object motion path editing in real time, improves the editing path efficiency of moving objects and the implementation of more paths, and can easily and quickly solve the problem of how a moving object moves.
[0208] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0209] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0210] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0211] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc. < / transform>
Claims
1. A three-dimensional animation processing method, characterized in that: The method comprises: Outputting a configuration panel through a first script, wherein the configuration panel presents a plurality of configuration items about a moving object; the first script is constructed based on a rendering engine of a three-dimensional animation; In response to a configuration operation on at least one of the configuration items on the configuration panel, creating a target animation through the first script; the target animation includes at least one target object; In response to the configuration operation, drawing a corresponding motion trajectory for the target object in the target animation through a second script, the second script being constructed based on the drawing engine; A preview screen of the target animation is output, wherein the preview screen is at least used to present a motion trajectory corresponding to the target object.
2. The method according to claim 1, characterized in that The configuration operation includes: configuration information of the target object at a plurality of configuration points, the configuration points corresponding to the motion postures corresponding to the target object; Wherein, the method further comprises: receiving a configuration modification operation on the configuration panel for the configuration point; In response to the configuration modification operation, the motion trajectory corresponding to the target object in the target animation is adjusted according to the modification information in the configuration modification operation.
3. The method according to claim 2, characterized in that The first script includes a first code module, and the first code module is used to execute: receiving a configuration modification operation on the configuration panel for the configuration point; In response to the configuration modification operation, the motion trajectory corresponding to the target object in the target animation is adjusted according to the modification information in the configuration modification operation.
4. The method according to claim 1, characterized in that The first script is saved in a target folder of the rendering engine; The first script includes: a custom editor class, which is inherited from the editor class in the drawing engine; and the custom editor class is used to implement the configuration panel.
5. The method according to claim 1, characterized in that: The first script includes a second code module, and the second code module is used to create a first graphical user interface in the configuration panel; Wherein, the first graphical user interface is used to trigger an operation of acquiring target information; the target information at least includes: the position and direction of a current viewing angle camera of the target animation.
6. The method according to claim 1, characterized in that The configuration operation includes: configuration information of the target object at a plurality of configuration points, the configuration points corresponding to the motion postures corresponding to the target object; Wherein, drawing a corresponding motion trajectory for the target object in the target animation through the second script includes: Creating a plurality of control points corresponding to a Bezier curve according to the configuration points in the configuration operation; According to the plurality of control points, a plurality of curve points are obtained; A corresponding motion trajectory is drawn for the target object according to the plurality of curve points, wherein the motion trajectory is a curve type of a Bezier curve.
7. The method according to claim 6, characterized in that The configuration operation also includes: a curve smoothness parameter; the curve smoothness parameter is used to control the curve smoothness of the motion trajectory; Wherein, according to the multiple control points, multiple curve points are obtained, including: The third code module in the second script is used to process the starting point, the ending point, the multiple control points, and the curve smoothness parameter in the configuration points to obtain multiple curve points.
8. The method according to claim 1, characterized in that: The configuration operation includes: configuration information of the target object at a plurality of configuration points, the configuration points corresponding to the motion postures corresponding to the target object; The configuration items include: configuration items of easing type; Wherein, drawing a corresponding motion trajectory for the target object in the target animation through the second script includes: At least according to the configuration information corresponding to each of the configuration points in the configuration item of the easing type in the configuration operation, obtain the corresponding motion progress of the target object at each motion time, wherein the motion progress represents the progress of the posture change between two adjacent configuration points; According to the corresponding motion progress of the target object at each motion time, a corresponding motion trajectory is drawn for the target object, and the motion trajectory is a slow motion curve type.
9. A three-dimensional animation processing device, characterized in that: The device comprises: A panel output unit, configured to execute a first script, wherein the first script is configured to output a configuration panel, wherein the configuration panel presents a plurality of configuration items about a moving object; the first script is constructed based on a rendering engine for a three-dimensional animation; in response to a configuration operation on the configuration panel for at least one of the configuration items, a target animation is created; the target animation includes at least one target object; the configuration operation includes: configuration information of the target object at a plurality of configuration points, wherein the configuration points correspond to the corresponding motion postures of the target object; a trajectory drawing unit, configured to execute a second script, wherein the second script is configured to draw a corresponding motion trajectory for the target object in the target animation in response to a configuration operation for at least one of the configuration items, and the second script is constructed based on the drawing engine; The animation preview unit is used to output the target animation, and the target animation is used to present the motion posture of the target object corresponding to each of the configuration points.
10. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the three-dimensional animation processing method as described in any one of claims 1 to 8.
Citation Information
Cited By
Animation generation method and device, electronic equipment and readable storage medium
CN121170084A