A method for creating three-dimensional animation
By acquiring the rotation matrix and position vector data from the Modsim simulation software, using the bisection method to obtain the pose matrix, and combining it with the time difference to create a 3D animation, the problem that the Modsim simulation software cannot display 3D animations was solved, and efficient 3D animation creation was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SYSWARE TECH CO LTD
- Filing Date
- 2022-10-24
- Publication Date
- 2026-06-05
AI Technical Summary
Modsim simulation software cannot display 3D animations of simulation models, and existing technologies struggle to create 3D animations efficiently.
By acquiring the rotation matrix and position vector data output by Modsim simulation software, the pose matrix at the target time is quickly obtained using the bisection method. A 3D animation is then created by combining the time difference and displayed using a 3D Viewer.
It enables the efficient creation of 3D animations based on Modsim simulation software files, reducing creation time and improving data acquisition speed.
Smart Images

Figure CN115578491B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic digital data processing technology, and in particular to a method for creating three-dimensional animation. Background Technology
[0002] Modsim simulation software can be used to simulate models, and its output files include data for each variable at different times. Modsim provides a user-friendly simulation environment and has a wide range of applications; however, it cannot create 3D animations of the models. Therefore, how to create 3D animations of simulation models based on files generated by Modsim is a problem that urgently needs to be solved. Summary of the Invention
[0003] The purpose of this invention is to provide a method for creating three-dimensional animations, which creates three-dimensional animations from simulation models based on files generated by Modsim simulation software.
[0004] According to the present invention, a method for creating three-dimensional animation is provided, comprising the following steps:
[0005] S100, obtain the target variable data of each component of the simulation model at each target time according to the file output by the Modsim simulation software; the target variables include rotation matrix variables and position vector variables, and each target time is the time corresponding to each key frame when performing 3D animation display.
[0006] S200: Obtain the pose matrix of each component at each target time based on the rotation matrix variable and position vector variable data of each component at each target time.
[0007] S300 creates 3D animations based on the pose matrix of each component at each target time and the time difference between the target times of adjacent keyframes when displaying the 3D animation.
[0008] Compared with the prior art, the present invention has significant advantages. Through the above technical solution, the three-dimensional animation creation method provided by the present invention can achieve considerable technical progress and practicality, and has broad industrial application value. It has at least the following advantages:
[0009] This invention obtains the rotation matrix and position vector variables of each component of the simulation model at each target time from the files output by the Modsim simulation software. Based on this data, the corresponding pose matrix is obtained. This yields the pose matrix of each component at each target time, which is also the pose matrix of each component corresponding to each keyframe during 3D animation display. By combining this with the duration of each keyframe during 3D animation display (the duration of each keyframe is the time difference between the target time of that keyframe and the target time of the next keyframe), the 3D animation of the simulation model can be created. This invention achieves the creation of 3D animation from the simulation model based on the files output by the Modsim simulation software. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a flowchart of the three-dimensional animation creation method of the present invention. Detailed Implementation
[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0013] According to the present invention, a method for creating three-dimensional animation is provided, such as... Figure 1 As shown, it includes the following steps:
[0014] S100, obtain the target variable data of each component of the simulation model at each target time according to the file output by the Modsim simulation software; the target variables include rotation matrix variables and position vector variables, and each target time is the time corresponding to each key frame when performing 3D animation display.
[0015] It should be understood that the main purpose of 3D animation display of the simulation model is to determine the pose matrix of each component of the simulation model in each keyframe during the 3D animation display. The pose matrix can be obtained from the corresponding rotation matrix and position vector. Therefore, this invention first obtains the rotation matrix variables and position vector variables of each component of the simulation model at each target time point from the file output by the Modsim simulation software. It should be understood that the file output by the Modsim simulation software stores the data of the rotation matrix variables and position vector variables corresponding to each time point during the simulation process, but this invention requires extracting the data of the rotation matrix variables and position vector variables corresponding to each target time point.
[0016] It should be understood that if the user sets the display to show 10 keyframes per second with equal intervals between each keyframe during the 3D animation display, then the time difference between the moments corresponding to adjacent keyframes is 0.1s. If the initial moment of the simulation is 0s and the moment corresponding to the first keyframe is 0.1s, then the data of the target variable corresponding to the moment of 0.1s in the file output by the Modsim simulation software is the data of the target variable corresponding to the first keyframe during the 3D animation display.
[0017] Optionally, the Modsim simulation software outputs either a .mat or .csv file. In the .csv file, the data for each time point is arranged row by row, with each row including not only the time information but also the data for the variables corresponding to that time point. Because the .csv file may contain redundant time points, the actual number of rows may be greater than the estimated number, making it impossible to directly obtain the number of rows corresponding to the target time T based on the relationship between the target time T and startTime. If a sequential traversal method is used to obtain the number of rows corresponding to the target time T, the traversal time will be too long, resulting in slow data acquisition and consequently, a longer 3D animation creation time. To reduce the 3D animation creation time, the method of obtaining the target variable data for each target time point of each component of the simulation model includes:
[0018] S110, Obtain the difference in the number of rows r1 = row between the user-inputted target time T and the CSV file output by the Modsim simulation software. p / row r row p The estimated number of rows in the CSV file. p = (stopTime - startTime) / stepTime, where stopTime is the simulation end time, startTime is the simulation start time, and stepTime is the simulation step size. r This represents the actual number of rows in the CSV file.
[0019] S120, obtain the row number interval [r] corresponding to T. start ,r end ], r start =T / (stopTime-startTime)*row r *(1-r1), r end =T / (stopTime-startTime)*row r *(1+r1); if r end Greater than row r Then set r end for row r .
[0020] According to the present invention, if the calculated r start and r end If it is a decimal, then perform a rounding operation on it.
[0021] S130, for [r] start ,r end Divide the r[r] into two equal parts to obtain the r[r] ... start [r1] and [r1,r] end ], r1 is [r start ,r end The corresponding number of rows in the second division, r1 = round((r start +r end If the time T1 corresponding to r1 is equal to T, then obtain the data of the target variable at time T1; if T is greater than T1, then for [r1, r... end Divide the x and y into two equal parts, resulting in [r1, r]. 2,r ] and [r 2,r ,r end ], r 2,r For [r1, r end The corresponding number of rows in the bisection, r 2,r =round((r1+r end ) / 2), and enter S131; if T is less than T1, then for [r start Divide r1 into two equal parts to obtain r. start ,r 2,l ] and [r 2,l [r1], r 2,l For [r start The number of rows corresponding to the bisection [r1], r 2,l =round((r start +r1) / 2), and enter S132.
[0022] S131, if r 2,r The corresponding time T 2,rIf it equals T, then obtain T. 2,r The data of the target variable at time T; if T is greater than T 2,r Then for [r] 2,r ,r end Divide the sample into two equal parts, and repeat this process until a preset termination condition is met; if T is less than T0... 2,r Then for [r1, r 2,r Divide the data into two equal parts, and repeat this process until a preset termination condition is met. The preset termination condition is that the number of rows in the resulting row interval after the division is less than or equal to a set row threshold, or the time corresponding to the number of rows divided in the two equal parts is equal to T, or the number of divisions in the two equal parts is greater than or equal to a set number threshold.
[0023] S132, if r 2,l The corresponding time T 2,l If it equals T, then obtain T. 2,l The data of the target variable at time T; if T is greater than T 2,l Then for [r] 2,l Divide r1 into two equal parts, and so on, until a preset termination condition is reached; if T is less than T 2,l Then for [r] start ,r 2,l Divide the sample into two equal parts, and repeat this process until the preset termination condition is met.
[0024] This invention utilizes a binary search method to obtain data for the target variable corresponding to T, which reduces the time required to acquire data and thus reduces the creation time of 3D animations.
[0025] According to the present invention, if the preset termination condition is that the time corresponding to the number of rows divided into two equal parts is equal to T, then the data of the target variable corresponding to the number of rows divided into two equal parts corresponding to the last division is obtained.
[0026] According to the present invention, if the preset termination condition is that the number of rows in the row number interval obtained after bisection is less than or equal to a set row number threshold or the number of bisections is greater than or equal to a set number threshold, then each row in the target row number interval is traversed until the time corresponding to a certain row is equal to T, and the data of the target variable of that row is obtained; the target row number interval is the row number interval obtained by the last bisection, including the row number corresponding to T.
[0027] Optionally, traverse the rows in ascending order of row number.
[0028] S200: Obtain the pose matrix of each component at each target time based on the rotation matrix variable and position vector variable data of each component at each target time.
[0029] The method of obtaining the pose matrix from the rotation matrix and the position vector is prior art. Those skilled in the art will understand that any prior art method for obtaining the pose matrix from the rotation matrix and the position vector falls within the protection scope of this invention.
[0030] S300 creates 3D animations based on the pose matrix of each component at each target time and the time difference between the target times of adjacent keyframes when displaying the 3D animation.
[0031] According to the present invention, the creation of a 3D animation based on the pose matrix of each component at each target time and the time difference between the target times corresponding to adjacent keyframes during 3D animation display includes:
[0032] S310 generates a simulation animation file, amination.json, based on the pose matrix of each component at each target time and the time difference between the target times corresponding to adjacent keyframes during 3D animation display.
[0033] It should be understood that when displaying a 3D animation, the time difference between the target moments corresponding to adjacent keyframes is the duration of continuous display of the keyframe with the earlier target moment among the adjacent keyframes.
[0034] As an example, the format of the simulation animation file amination.json is:
[0035]
[0036]
[0037]
[0038] S320: Input the simulation animation file amination.json and the lightweight simulation model product.json into 3DViewer to create a 3D animation.
[0039] As an example, the simulation model before lightweighting is a STEP file, which is an STP file with the STEP extension, belonging to STP 3D files; the process of lightweighting the STEP file to obtain a JSON format file is existing technology. Those skilled in the art will understand that any solution using existing lightweighting methods to obtain a simulation model falls within the protection scope of this invention.
[0040] It should be understood that 3D Viewer is an existing graphics editing application. By inputting the simulation animation file amination.json and the lightweight simulation model product.json into 3D Viewer, the creation of a 3D animation of the simulation model can be achieved.
[0041] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. It should also be understood that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.
Claims
1. A method for creating three-dimensional animation, characterized in that, Includes the following steps: S100: Obtain the target variable data of each component of the simulation model at each target time according to the file output by the Modsim simulation software; The target variables include rotation matrix variables and position vector variables, and each target time is the time corresponding to each key frame when performing a 3D animation display. S200, obtain the pose matrix of each component at each target time based on the rotation matrix variable and position vector variable data of each component at each target time; S300 creates 3D animation based on the pose matrix of each component at each target moment and the time difference between the target moments corresponding to adjacent keyframes when displaying 3D animation. In S100, the methods for obtaining the target variable data of each component of the simulation model at each target time include: S110, Obtain the difference in the number of rows between the user-inputted target time T and the CSV file output by the Modsim simulation software: r1=row p / row r row p The estimated number of rows in the CSV file. p =(stopTime - startTime) / stepTime, where stopTime is the simulation end time, startTime is the simulation start time, and stepTime is the simulation step size. r This represents the actual number of rows in the CSV file. S120, obtain the row number interval [r] corresponding to T. start ,r end ], r start =T / (stopTime-startTime)*row r *(1-r1), r end =T / (stopTime-startTime)* row r *(1+r1); if r end Greater than row r Then set r end for row r ; S130, for [r] start ,r end Divide the r[r] into two equal parts to obtain the r[r] ... start [r1] and [r1,r] end ], r1 is [r start ,r end The corresponding number of rows in the bisection, r1=round((r start +r end If the time T1 corresponding to r1 is equal to T, then obtain the data of the target variable at time T1; if T is greater than T1, then for [r1, r... end Divide the x-axis into two equal parts to obtain [r1, r2]. 2,r ] and [r 2,r ,r end ], r 2,r For [r1, r end The corresponding number of rows in the bisection, r 2,r = round((r1+r end ) / 2), and enter S131; if T is less than T1, then for [r start Divide r1 into two equal parts to obtain r. start , r 2,l ] and [r 2,l [r1], r 2,l For [r start The number of rows corresponding to the bisection [r1], r 2,l =round((r start +r1) / 2), and enter S132; S131, if r 2,r The corresponding time T 2,r If it equals T, then obtain T. 2,r The data of the target variable at time T; if T is greater than T 2,r Then for [r] 2,r ,r end Divide the sample into two equal parts, and repeat this process until a preset termination condition is met; if T is less than T0... 2,r Then for [r1, r 2,r Divide the data into two equal parts, and repeat this process until a preset termination condition is met. The preset termination condition is that the number of rows in the resulting row interval after the division is less than or equal to a set row threshold, or the time corresponding to the number of rows after the division is equal to T, or the number of divisions is greater than or equal to a set number threshold. S132, if r 2,l The corresponding time T 2,l If it equals T, then obtain T. 2,l The data of the target variable at time T; if T is greater than T 2,l Then for [r] 2,l Divide r1 into two equal parts, and so on, until a preset termination condition is reached; if T is less than T 2,l Then for [r] start , r 2,l Divide the sample into two equal parts, and repeat this process until the preset termination condition is met.
2. The method according to claim 1, characterized in that, In S300, the step of creating a 3D animation based on the pose matrix of each component at each target time and the time difference between the target times corresponding to adjacent keyframes during 3D animation display includes: S310, generate the simulation animation file amination.json based on the pose matrix of each component at each target time and the time difference between the target times corresponding to adjacent keyframes when displaying the 3D animation; S320: Input the simulation animation file amination.json and the lightweight simulation model product.json into the 3D Viewer to create a 3D animation.
3. The method according to claim 1, characterized in that, In S131, if the preset termination condition is that the number of rows in the row number interval obtained after bisection is less than or equal to the set row number threshold or the number of bisections is greater than or equal to the set number threshold, then each row in the target row number interval is traversed until the time corresponding to a certain row is equal to T, and the data of the target variable of that row is obtained; the target row number interval is the row number interval obtained by the last bisection, including the row number corresponding to T.
4. The method according to claim 3, characterized in that, Traverse the rows in ascending order of row number.
5. The method according to claim 1, characterized in that, In S131, if the preset termination condition is that the time corresponding to the number of rows divided into two equal parts is equal to T, then the data of the target variable corresponding to the number of rows divided into two equal parts corresponding to the last division is obtained.
6. The method according to claim 1, characterized in that, In S300, the time difference between the target times corresponding to adjacent key frames is greater than 30ms.