Animation rendering optimization method and system
By classifying and rendering the targets in the animation, and using the convolutional neural network model to predict lighting and shadow effects, the problem of low animation rendering efficiency is solved, and fast rendering and efficient modification are achieved.
Patent Information
- Application Number
- CN202510267277.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
During the animation rendering process, changes in each element in the video frame will increase the workload and reduce the rendering efficiency.
The rendered image is obtained by classifying the targets in the animation by categories and rendering the targets and postures of each category under the setting of each light source. Then, the convolutional neural network model is used to predict effective lighting and shadow renderings based on the target relative lighting angle or the distance of the point light source to achieve rapid rendering of animation.
Improve the speed of animation rendering, avoid frame-by-frame rendering, enhance rendering efficiency, and improve the speed of animation modification and rendering.
Smart Images

Figure CN120107422A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of animation rendering, and in particular to an animation rendering optimization method and system. Background Art
[0002] Animation rendering refers to the process of converting various elements (such as models, materials, light, lenses, etc.) in the animation production process into final visual images or videos through computer algorithms. It is one of the key steps in animation production, which transforms the created digital scene into a displayable picture. These pictures are arranged in sequence to obtain animation. Each picture that makes up the animation is a video frame. In the process of animation rendering, the video frames need to be rendered one by one. The changes of each element in the video frame will affect the workload of animation rendering and reduce the efficiency of animation rendering. Summary of the invention
[0003] The purpose of the present invention is to provide an animation rendering optimization method and system to solve the above-mentioned deficiencies in the prior art.
[0004] In order to achieve the above object, the present invention provides the following technical solution: an animation rendering optimization method, comprising the following steps:
[0005] Obtain the 3D scene settings, camera settings, and light source settings corresponding to the animation, wherein the 3D scene settings include the 3D models of all objects that will appear in the animation, such as the environment, characters, buildings, etc.; the camera settings include the angle, range, focus, and other parameters of the camera when shooting the 3D scene;
[0006] Obtain target key frames of each target in the three-dimensional scene setting in the animation, wherein the target key frame is a state or posture set at a specific time point in the animation, such as a character's action, an object's position, rotation, etc.;
[0007] Set textures and materials for each target in the 3D scene setting. When setting textures, images or texture maps can be mapped to the surface of the 3D model corresponding to the target through texture mapping to enhance details. When setting materials, the material properties of the 3D model corresponding to the target can be set, such as reflection, refraction, transparency, gloss, etc., so as to obtain a realistic surface effect during rendering;
[0008] Targets are classified according to their types to obtain multiple target groups. Targets of the same category can be divided into one target group according to the target category as needed. The specific category size can be customized, such as trees can be divided into one target group, or pine trees can be divided into one target group and willow trees can be divided into one target group. Target groups can also be divided according to individual differences, such as person A can be divided into one target group and person B can be divided into another target group.
[0009] A set number of light source settings are uniformly extracted from the light source settings to obtain a light source test setting, wherein there are several light source settings in the animation, and the type, position, and intensity of the light source corresponding to each moment in the animation can be set as needed, and there are as many light source settings as the type, position, and intensity of the light source corresponding to the moment, and the light source settings are arranged in the order of the corresponding moments, and a light source setting is extracted from each light source setting at a fixed interval to obtain a light source test setting, wherein the size of the fixed interval is set according to the number of light source test settings and the number of light source settings that need to be extracted, and the target key frames corresponding to each target group are uniformly extracted from the target key frames to obtain target test key frames, and the same is true when extracting, the target key frames corresponding to each target group are arranged in the order of the corresponding moments and then uniformly extracted;
[0010] Render the target key frames of each target group under each light source test setting respectively to obtain the corresponding rendering effect graph;
[0011] Based on the camera settings and the target keyframes, the target keyframes within the camera field of view are screened out to obtain valid frames, and the rendering effect graphs corresponding to the valid target keyframes are retrieved in the rendering effect graphs to obtain valid rendering graphs corresponding to the valid frames;
[0012] Calculate the valid rendering image corresponding to the time between the time corresponding to the adjacent valid rendering images, wherein the target key frame, the rendering effect image, the valid frame, and the valid rendering image are arranged in the order of the corresponding time;
[0013] The valid rendering images of each target group with the same corresponding time are merged to obtain a valid rendering frame, and the valid rendering frames are arranged in order of corresponding time to obtain an animation.
[0014] Furthermore, the step of uniformly extracting a set number of light source settings from the light source settings to obtain a light source test setting comprises the following steps:
[0015] According to the type of light source, the light source settings are divided into ambient light source, parallel light source, and point light source;
[0016] Set the target positive direction, calculate the angle between the target positive direction and the illumination direction of the parallel light source, the ray emitted by the target to the point light source and the target positive direction in each target key frame, and obtain the target relative illumination angle, where the target relative illumination angle is composed of the horizontal angle and the pitch angle;
[0017] Obtaining a target relative illumination angle interval based on the target relative illumination angle, wherein the target relative illumination angle interval is a minimum interval including all obtained target relative illumination angles, and dividing the target relative illumination angle interval into multiple parts to obtain multiple target relative illumination angle sub-intervals;
[0018] Calculate the distance between the target and the point light source in each target key frame to obtain the light source distance, obtain the light source distance interval based on the light source distance, wherein the light source distance interval is the minimum interval containing all the obtained light source distances, and divide the light source distance interval into multiple parts to obtain multiple light source distance sub-intervals;
[0019] Obtaining the light intensity of the light source, obtaining a light intensity interval based on the light intensity, wherein the light intensity interval is a minimum interval including all obtained light intensities, and dividing the light intensity interval into multiple parts to obtain multiple light intensity sub-intervals;
[0020] When the type of light source is ambient light source, the light intensity corresponding to the endpoint of each light intensity sub-interval corresponds to a light source test setting; when the type of light source is parallel light source and point light source, the distance corresponding to the endpoint of each light source distance sub-interval, the angle corresponding to the endpoint of each target relative light angle sub-interval, and the light intensity corresponding to the endpoint of each light intensity sub-interval correspond to a light source test setting.
[0021] Furthermore, rendering the target key frames of each target group under each light source test setting to obtain a corresponding rendering effect graph includes the following steps:
[0022] Perform illumination rendering on the target key frames of each target group under each light source test setting respectively, calculate the light performance effect of each location of the target in the target key frame under the corresponding light source test setting, wherein the light performance effect of each location of the target is the display effect of the target under the corresponding light, and obtain the corresponding illumination rendering image;
[0023] Perform shadow rendering on the target key frames of each target group under each light source test setting respectively, calculate the shadow performance effect of each target in the target key frame under the corresponding light source test setting, and obtain the corresponding shadow rendering image;
[0024] The rendering effect graph includes a lighting rendering graph and a shadow rendering graph of target key frames of the same target group under the same light source test setting.
[0025] Furthermore, the step of calculating the valid rendering images corresponding to the moments between the moments corresponding to adjacent valid rendering images comprises the following steps:
[0026] Obtain adjacent valid rendering images and corresponding times, and calculate the time difference between the times corresponding to the adjacent valid rendering images;
[0027] Obtaining the number of frames required for the animation, and based on the number of frames required for the animation and the time difference, calculating the number of valid renderings that need to be inserted between the adjacent valid renderings and the time corresponding to the valid renderings that need to be inserted, to obtain the difference time;
[0028] The effective rendering image at the difference moment between two adjacent effective rendering images is calculated based on the difference algorithm.
[0029] Furthermore, the method also includes supplementing a target frame between adjacent target key frames based on a difference algorithm, wherein the target frame is a state or posture of the target between two adjacent target key frames in the animation.
[0030] In one embodiment, the effective rendering image or target frame inserted at each time can be calculated by a linear interpolation method, and the effective rendering image or target frame is inserted between the effective rendering images or target key frames corresponding to time t1 and time t2. The formula is:
[0031] P(t)=(1-α)·P(t1)+α·P(t2);
[0032] Where P(t) is the interpolation result at time t, such as position, rotation, scale, etc. P(t1) and P(t2) are the attribute values of the effective rendering or target keyframe at time t1 and t2, respectively. α is a normalized time parameter, which indicates the ratio of the current interpolation. The calculation formula is:
[0033] Furthermore, the step of calculating the valid rendering images corresponding to the moments between the moments corresponding to adjacent valid rendering images comprises the following steps:
[0034] A convolutional neural network model is trained based on the target relative illumination angle and the corresponding effective illumination rendering image and the effective shadow rendering image, the distance of the point light source illumination and the corresponding effective illumination rendering image and the effective shadow rendering image, respectively, to obtain a rendering prediction model that outputs a predicted effective illumination rendering image and an effective shadow rendering image according to the input target relative illumination angle and the distance of the point light source illumination, wherein the rendering prediction model includes a illumination rendering prediction model for predicting an effective illumination rendering image, and a shadow rendering prediction model for predicting an effective shadow rendering image.
[0035] Further, the rendering prediction model is used to output a predicted effective lighting rendering map and an effective shadow rendering map according to the input target relative lighting angle, and output a predicted effective lighting rendering map and an effective shadow rendering map according to the input point light source lighting distance, including the following steps:
[0036] Retrieve the target frame and corresponding target group of the target to be rendered;
[0037] Determine the type of light source;
[0038] If the light source type is a parallel light source, the angle between the target positive direction of the target in the target frame and the illumination direction of the parallel light source is calculated to obtain the target relative illumination angle;
[0039] If the light source type is a point light source, the angle between the ray emitted by the target to the point light source in the target frame and the positive direction of the target is calculated to obtain the target relative illumination angle, and the distance between the target and the point light source in the target frame is calculated;
[0040] A rendering prediction model corresponding to the target group corresponding to the target frame is selected, and a corresponding illumination rendering prediction model or a shadow rendering prediction model is selected from the corresponding rendering prediction models according to the light source type.
[0041] An animation rendering optimization system includes a three-dimensional scene construction module, a key frame setting module, a model texture material setting module, a target classification module, a test rendering module, a rendering prediction module, and a rendering merging output module;
[0042] The three-dimensional scene construction module is used to obtain or construct three-dimensional scene settings, camera settings and light source settings information corresponding to the animation;
[0043] The key frame setting module is used to set the target key frame of each target in the three-dimensional scene setting in the animation;
[0044] The model texture material setting module is used to set the texture and material of each target in the three-dimensional scene setting;
[0045] The target classification module is used to classify targets according to their types to obtain multiple target groups;
[0046] The test rendering module is used to uniformly extract a set number of light source settings from the light source settings to obtain a light source test setting; uniformly extract target key frames corresponding to each target group from the target key frames to obtain target test key frames; render the target key frames of each target group under each light source test setting to obtain a corresponding rendering effect graph; based on the camera settings and the target key frames, filter out the target key frames within the camera field of view to obtain valid frames, retrieve the rendering effect graph corresponding to the valid target key frames in the rendering effect graph, and obtain a valid rendering graph corresponding to the valid frame;
[0047] The rendering prediction module is used to calculate the valid rendering images corresponding to the moments between the moments corresponding to adjacent valid rendering images;
[0048] The rendering merging and outputting module is used to merge the valid rendering images of each target group with the same corresponding time to obtain a valid rendering frame, and arrange the valid rendering frames in the order of the corresponding time to obtain an animation.
[0049] 1. Compared with the prior art, the present invention provides an animation rendering optimization method and system, which classifies different targets in the animation by category, and renders each posture of the target of each category under each light source setting to obtain the corresponding rendering image, and then trains the convolutional neural network model to realize the type of target to be rendered and the type of light source to illuminate the target, selects a suitable convolutional neural network model according to the input target relative lighting angle or the distance of the point light source, and outputs the predicted effective lighting rendering image and effective shadow rendering image.
[0050] 2. Compared with the prior art, the present invention provides an animation rendering optimization method and system, which calculates the target relative illumination angle or the distance of the point light source illumination of each target corresponding to the key frame moment of each target in the animation, and then obtains the effective illumination rendering map and the effective shadow rendering map corresponding to each target through the trained convolutional neural network model and then splices them to complete the rendering of a frame of animation, so that it is not necessary to render frame by frame, and the rendering map of each frame can be obtained by splicing the already rendered effective illumination rendering map and the effective shadow rendering map. At the same time, because the animation of each target is formed by arranging the specific target key frames of the target in a certain order, the rendering of the animation can be completed through the trained convolutional neural network model, avoiding the frame-by-frame rendering of the animation, and greatly improving the speed of animation rendering.
[0051] 3. Compared with the prior art, the animation rendering optimization method and system provided by the present invention selects and sorts the key frames of each target to form a new animation of the target, and then obtains the corresponding rendering image through the trained convolutional neural network model to complete the rendering of the new animation, thereby improving the animation modification speed under the same three-dimensional scene setting, as well as the rendering speed of the modified animation.
[0052] 4. Compared with the prior art, the animation rendering optimization method and system provided by the present invention supplements target frames between adjacent target key frames through a difference algorithm, so that the transition between target key frames is smoother, and then based on the supplemented target frames and the trained convolutional neural network model, a rendering image of the supplemented target frames is obtained, making the rendered animation smoother. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0054] Figure 1 A method step diagram provided for an embodiment of the present invention;
[0055] Figure 2 A system structure block diagram provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0056] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings.
[0057] In the description of the present invention, it should be understood that the terms "first" and "second" are only used for descriptive purposes, and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, "multiple" means two or more, unless otherwise clearly and specifically defined. In addition, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0058] Example embodiments will be described more fully below with reference to the accompanying drawings, but the example embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. On the contrary, the purpose of providing these embodiments is to make the present disclosure thorough and complete and to enable those skilled in the art to fully understand the scope of the present disclosure.
[0059] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0060] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0061] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a", "an" and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "comprising" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded.
[0062] See also Figure 1-Figure 2 , an animation rendering optimization method, comprising the following steps:
[0063] S1. Obtain the 3D scene setting, camera setting and light source setting information corresponding to the animation, wherein the 3D scene setting includes the 3D models of all targets that will appear in the animation, such as the environment, characters, buildings and other objects; the camera setting includes the angle, range, focus and other parameters of the camera when shooting the 3D scene.
[0064] S2. Obtain target key frames of each target in the three-dimensional scene setting in the animation, wherein the target key frame is a state or posture set at a specific time point in the animation, such as a character's action, an object's position, rotation, etc.
[0065] S3. Setting texture and material for each target in the three-dimensional scene setting. When setting texture, an image or texture map can be mapped to the surface of the three-dimensional model corresponding to the target through texture mapping to enhance details. When setting material, material properties of the three-dimensional model corresponding to the target can be set, such as reflection, refraction, transparency, gloss, etc., so as to obtain a realistic surface effect during rendering.
[0066] S4. Classify the targets according to their types to obtain multiple target groups, among which targets of the same category can be divided into one target group according to the target category as needed. The specific category size can be customized, such as trees can be divided into one target group, or pine trees can be divided into one target group and willow trees can be divided into one target group. Target groups can also be divided according to different individuals, such as person A can be divided into one target group and person B can be divided into another target group.
[0067] S5. Uniformly extract a set number of light source settings from the light source settings to obtain a light source test setting, wherein there are several light source settings in the animation, and the type, position, and intensity of the light source corresponding to each moment in the animation can be set as needed. The number of light source settings corresponding to the moment is the number of light source settings, the type, position, and intensity of the light source corresponding to the moment is set, and the light source settings are arranged in order of the corresponding moments, and a light source setting is extracted from each light source setting at a fixed interval to obtain a light source test setting, wherein the size of the fixed interval is set according to the number of light source test settings and the number of light source settings that need to be extracted, and the target key frames corresponding to each target group are uniformly extracted from the target key frames to obtain the target test key frames. The same is true when extracting, and the target key frames corresponding to each target group are arranged in order of the corresponding moments and then uniformly extracted;
[0068] Uniformly extracting a set number of light source settings from the light source settings to obtain a light source test setting includes the following steps:
[0069] (1) According to the type of light source, the light source setting is divided into ambient light source, parallel light source, and point light source;
[0070] (2) Setting the target positive direction, calculating the angle between the target positive direction and the illumination direction of the parallel light source, and the angle between the ray emitted by the target to the point light source and the target positive direction in each target key frame, and obtaining the target relative illumination angle, where the target relative illumination angle is composed of the horizontal angle and the pitch angle;
[0071] (3) obtaining a target relative illumination angle interval based on the target relative illumination angle, wherein the target relative illumination angle interval is a minimum interval including all obtained target relative illumination angles, and the target relative illumination angle interval is evenly divided into a plurality of parts to obtain a plurality of target relative illumination angle sub-intervals;
[0072] (4) Calculating the distance between the target and the point light source in each target key frame to obtain the light source distance, obtaining the light source distance interval based on the light source distance, wherein the light source distance interval is the minimum interval containing all the obtained light source distances, and the light source distance interval is evenly divided into multiple parts to obtain multiple light source distance sub-intervals;
[0073] (5) obtaining the illumination intensity of the light source, obtaining an illumination intensity interval based on the illumination intensity, wherein the illumination intensity interval is a minimum interval including all obtained illumination intensities, and dividing the illumination intensity interval into multiple parts to obtain multiple illumination intensity sub-intervals;
[0074] (6) When the type of light source is ambient light source, the light intensity corresponding to the endpoint of each light intensity sub-interval corresponds to a light source test setting; when the type of light source is parallel light source and point light source, the distance corresponding to the endpoint of each light source distance sub-interval, the angle corresponding to the endpoint of each target relative light angle sub-interval, and the light intensity corresponding to the endpoint of each light intensity sub-interval correspond to a light source test setting.
[0075] S6, rendering the target key frames of each target group under each light source test setting respectively to obtain a corresponding rendering effect diagram, including the following steps:
[0076] (1) performing illumination rendering on the target key frames of each target group under each light source test setting respectively, calculating the light performance effect of each location of the target in the target key frame under the corresponding light source test setting, wherein the light performance effect of each location of the target is the display effect of the target under the corresponding light, and obtaining the corresponding illumination rendering image;
[0077] (2) performing shadow rendering on the target key frames of each target group under each light source test setting, respectively, calculating the shadow performance effect of each target in the target key frame under the corresponding light source test setting, and obtaining the corresponding shadow rendering image;
[0078] (3) The rendering effect diagram includes the lighting rendering diagram and shadow rendering diagram of the target key frames of the same target group under the same light source test settings.
[0079] S7, based on the camera settings and the target key frame, filter out the target key frame in the camera field of view to obtain a valid frame, retrieve the rendering effect graph corresponding to the valid target key frame in the rendering effect graph, and obtain a valid rendering graph corresponding to the valid frame;
[0080] S8, calculating the valid rendering image corresponding to the time between the time corresponding to the adjacent valid rendering images, wherein the target key frame, the rendering effect image, the valid frame, and the valid rendering image are arranged in the order of the corresponding time, including the following steps:
[0081] (1) Obtain adjacent valid rendering images and corresponding moments, and calculate the time difference between the moments corresponding to the adjacent valid rendering images;
[0082] (2) Obtaining the number of frames required for the animation, and based on the number of frames required for the animation and the time difference, calculating the number of valid renderings that need to be inserted between adjacent valid renderings and the time corresponding to the valid renderings that need to be inserted, and obtaining the difference time;
[0083] (3) Calculate the effective rendering image at the difference moment between two adjacent effective rendering images based on the difference algorithm.
[0084] In another embodiment, calculating the valid rendering images corresponding to the moments between the moments corresponding to adjacent valid rendering images comprises the following steps:
[0085] (1) Based on the target relative illumination angle and the corresponding effective illumination rendering image and effective shadow rendering image, the distance of the point light source illumination and the corresponding effective illumination rendering image and effective shadow rendering image, respectively, a convolutional neural network model is trained to obtain a rendering prediction model that outputs a predicted effective illumination rendering image and effective shadow rendering image based on the input target relative illumination angle and the distance of the point light source illumination. The rendering prediction model includes a lighting rendering prediction model for predicting an effective lighting rendering image and a shadow rendering prediction model for predicting an effective shadow rendering image. The specific steps are as follows:
[0086] 1.1. Obtain illumination of the target at the endpoint of the illumination angle sub-interval of each target group at the parallel light source relative to the illumination angle, respectively, and obtain the illumination rendering image and shadow rendering image of the corresponding target under the set standard illumination intensity, and obtain the first effective illumination rendering image and the first effective shadow rendering image;
[0087] 1.2. Based on the target relative illumination angle when the light source is parallel and the corresponding first effective illumination rendering image, a first convolutional neural network model is trained to obtain a first illumination rendering prediction model that outputs a predicted effective illumination rendering image according to the input target relative illumination angle;
[0088] 1.3. Based on the target relative illumination angle of the parallel light source and the corresponding first effective shadow rendering image, a second convolutional neural network model is trained to obtain a first shadow rendering prediction model that outputs a predicted effective shadow rendering image according to the input target relative illumination angle;
[0089] 1.4. Obtain the illumination of the point light source of the target relative to the illumination angle at the endpoint of the illumination angle sub-interval of each target group respectively, and obtain the illumination rendering image and shadow rendering image of the corresponding target under the set standard illumination intensity and the set standard illumination distance, and obtain the second effective illumination rendering image and the second effective shadow rendering image, wherein the set standard illumination distance is the set standard distance from the point light source to the target;
[0090] 1.5. Based on the target relative illumination angle of the point light source and the corresponding second effective illumination rendering image, a third convolutional neural network model is trained to obtain a second illumination rendering prediction model that outputs a predicted effective illumination rendering image according to the input target relative illumination angle;
[0091] 1.6. Based on the target relative illumination angle when the light source is point light and the corresponding second effective shadow rendering image, a fourth convolutional neural network model is trained to obtain a second shadow rendering prediction model that outputs a predicted effective shadow rendering image according to the input target relative illumination angle;
[0092] 1.7. Obtain the illumination at the corresponding distance from the point light source to the endpoint of the sub-interval respectively, and obtain the illumination rendering image and shadow rendering image of the same target key frame under the set standard illumination intensity to obtain the third effective illumination rendering image and the third effective shadow rendering image;
[0093] 1.8. Based on the distance of the point light source illumination and the corresponding third effective illumination rendering image, a fifth convolutional neural network model is trained to obtain a third illumination rendering prediction model that outputs a predicted effective illumination rendering image according to the input distance of the point light source illumination;
[0094] 1.9. Based on the distance of the point light source illumination and the corresponding third effective shadow rendering image, a sixth convolutional neural network model is trained to obtain a third shadow rendering prediction model that outputs a predicted effective shadow rendering image according to the input distance of the point light source illumination;
[0095] 1.10. A first lighting rendering prediction model, a first shadow rendering prediction model, a second lighting rendering prediction model, a second shadow rendering prediction model, a third lighting rendering prediction model and a third shadow rendering prediction model constitute a rendering prediction model.
[0096] The rendering prediction model is used to output the predicted effective lighting rendering map and effective shadow rendering map according to the input target relative lighting angle, and output the predicted effective lighting rendering map and effective shadow rendering map according to the input point light source lighting distance, including the following steps:
[0097] (1) Retrieve the target frame and corresponding target group of the target to be rendered;
[0098] (2) Determine the light source type;
[0099] (3) If the light source type is a parallel light source, the angle between the target positive direction of the target in the target frame and the illumination direction of the parallel light source is calculated to obtain the target relative illumination angle;
[0100] (4) If the light source type is a point light source, the angle between the ray emitted by the target to the point light source in the target frame and the positive direction of the target is calculated to obtain the relative illumination angle of the target, and the distance between the target and the point light source in the target frame is calculated;
[0101] (5) Selecting a rendering prediction model corresponding to a target group corresponding to a target frame, and selecting a corresponding illumination rendering prediction model or a shadow rendering prediction model from the corresponding rendering prediction model according to the light source type, such as the first illumination rendering prediction model, the first shadow rendering prediction model, the second illumination rendering prediction model, the second shadow rendering prediction model, the third illumination rendering prediction model, or the third shadow rendering prediction model, and inputting the obtained target relative illumination angle or the obtained distance between the target and the point light source in the target frame; wherein, when the light source type is a parallel light source: inputting the obtained target relative illumination angle into the first illumination rendering prediction model to obtain a predicted effective illumination rendering Figure; input the obtained target relative illumination angle into the first shadow rendering prediction model to obtain a predicted effective shadow rendering figure; when the light source type is a point light source: input the obtained target relative illumination angle into the second illumination rendering prediction model to obtain a predicted effective illumination rendering figure; input the obtained target relative illumination angle into the second shadow rendering prediction model to obtain a predicted effective shadow rendering figure; input the obtained distance between the target and the point light source illumination in the target frame into the third illumination rendering prediction model to obtain a predicted effective illumination rendering figure; input the obtained distance between the target and the point light source illumination in the target frame into the third shadow rendering prediction model to obtain a predicted effective shadow rendering figure.
[0102] S9, merging the valid rendering images of each target group with the same corresponding time to obtain valid rendering frames, and arranging the valid rendering frames in order of corresponding time to obtain an animation.
[0103] During the merging process, the effects of other targets on the lighting and shadow effects of the target are taken into account, and the effective lighting rendering and effective shadow rendering of the target are adjusted. For example, when target 1 is between target 2 and the light source, the projection of target 1 illuminated by the light source on target 2 is calculated, and the effective shadow rendering of target 2 is adjusted based on the projection.
[0104] The method also includes supplementing a target frame between adjacent target key frames based on a difference algorithm, wherein the target frame is a state or posture of the target between two adjacent target key frames in the animation.
[0105] In one embodiment, the effective rendering image or target frame inserted at each time can be calculated by a linear interpolation method, and the effective rendering image or target frame is inserted between the effective rendering images or target key frames corresponding to time t1 and time t2. The formula is:
[0106] P(t)=(1-α)·P(t1)+α·P(t2);
[0107] Where P(t) is the interpolation result at time t, such as position, rotation, scale, etc. P(t1) and P(t2) are the attribute values of the effective rendering or target keyframe at time t1 and t2, respectively. α is a normalized time parameter, which indicates the ratio of the current interpolation. The calculation formula is:
[0108] The present invention also provides an animation rendering optimization system, including a three-dimensional scene construction module, a key frame setting module, a model texture material setting module, a target classification module, a test rendering module, a rendering prediction module, and a rendering merging output module;
[0109] The 3D scene construction module is used to obtain or construct the 3D scene setting, camera setting and light source setting information corresponding to the animation;
[0110] The key frame setting module is used to set the target key frame of each target in the three-dimensional scene setting in the animation;
[0111] The model texture material setting module is used to set the texture and material of each target in the three-dimensional scene setting;
[0112] The target classification module is used to classify targets according to their types to obtain multiple target groups;
[0113] The test rendering module is used to uniformly extract a set number of light source settings from the light source settings to obtain a light source test setting; uniformly extract the target key frames corresponding to each target group from the target key frames to obtain the target test key frames; render the target key frames of each target group under each light source test setting to obtain the corresponding rendering effect graph; based on the camera settings and the target key frames, filter out the target key frames within the camera field of view to obtain the valid frames, retrieve the rendering effect graph corresponding to the valid target key frames in the rendering effect graph, and obtain the valid rendering graph corresponding to the valid frame;
[0114] The rendering prediction module is used to calculate the valid rendering images corresponding to the moments between the moments corresponding to the adjacent valid rendering images;
[0115] The rendering merging output module is used to merge the valid rendering images of each target group with the same corresponding time to obtain a valid rendering frame, and arrange the valid rendering frames in the corresponding time sequence to obtain an animation.
[0116] The above description is only by way of illustration of certain exemplary embodiments of the present invention. It is undoubted that those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the above drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.
Claims
1. An animation rendering optimization method, characterized in that: The following steps are involved: Get the 3D scene settings, camera settings, and light source settings information corresponding to the animation; Get the target key frame of each target in the animation in the three-dimensional scene setting; Set textures and materials for each target in the 3D scene setting; Classify the targets according to their types to obtain multiple target groups; Uniformly extracting a set number of light source settings from the light source settings to obtain light source test settings, and uniformly extracting target key frames corresponding to each target group from the target key frames to obtain target test key frames; Render the target key frames of each target group under each light source test setting respectively to obtain the corresponding rendering effect graph; Based on the camera settings and the target keyframes, the target keyframes within the camera field of view are screened out to obtain valid frames, and the rendering effect graphs corresponding to the valid target keyframes are retrieved in the rendering effect graphs to obtain valid rendering graphs corresponding to the valid frames; Calculate the valid rendering images corresponding to the moments between the moments corresponding to adjacent valid rendering images; The valid rendering images of each target group with the same corresponding time are merged to obtain a valid rendering frame, and the valid rendering frames are arranged in order of corresponding time to obtain an animation.
2. The animation rendering optimization method according to claim 1, characterized in that: The step of uniformly extracting a set number of light source settings from the light source settings to obtain a light source test setting comprises the following steps: According to the type of light source, the light source settings are divided into ambient light source, parallel light source, and point light source; Set the target positive direction, calculate the angle between the target positive direction and the illumination direction of the parallel light source, and the angle between the ray emitted by the target to the point light source and the target positive direction in each target key frame, and obtain the target relative illumination angle; Obtaining a target relative illumination angle interval based on the target relative illumination angle, and dividing the target relative illumination angle interval into multiple parts to obtain multiple target relative illumination angle sub-intervals; Calculate the distance between the target and the point light source in each target key frame to obtain the light source distance, obtain the light source distance interval based on the light source distance, and divide the light source distance interval into multiple parts to obtain multiple light source distance sub-intervals; Obtaining the light intensity of the light source, obtaining a light intensity interval based on the light intensity, and dividing the light intensity interval into multiple parts to obtain multiple light intensity sub-intervals; When the type of light source is ambient light source, the light intensity corresponding to the endpoint of each light intensity sub-interval corresponds to a light source test setting; when the type of light source is parallel light source and point light source, the distance corresponding to the endpoint of each light source distance sub-interval, the angle corresponding to the endpoint of each target relative light angle sub-interval, and the light intensity corresponding to the endpoint of each light intensity sub-interval correspond to a light source test setting.
3. The animation rendering optimization method according to claim 2, characterized in that: The method of rendering the target key frames of each target group under each light source test setting to obtain a corresponding rendering effect diagram comprises the following steps: Perform illumination rendering on the target key frames of each target group under each light source test setting respectively, calculate the light performance effect of each position of the target in the target key frame under the corresponding light source test setting, and obtain the corresponding illumination rendering image; Perform shadow rendering on the target key frames of each target group under each light source test setting respectively, calculate the shadow performance effect of each position of the target in the target key frame under the corresponding light source test setting, and obtain the corresponding shadow rendering image; The rendering effect graph includes a lighting rendering graph and a shadow rendering graph of target key frames of the same target group under the same light source test setting.
4. The animation rendering optimization method according to claim 3, characterized in that: The step of calculating the effective rendering images corresponding to the moments between the moments corresponding to adjacent effective rendering images comprises the following steps: Obtain adjacent valid rendering images and corresponding times, and calculate the time difference between the times corresponding to the adjacent valid rendering images; Obtaining the number of frames required for the animation, and based on the number of frames required for the animation and the time difference, calculating the number of valid renderings that need to be inserted between the adjacent valid renderings and the time corresponding to the valid renderings that need to be inserted, to obtain the difference time; The effective rendering image at the difference moment between two adjacent effective rendering images is calculated based on the difference algorithm.
5. The animation rendering optimization method according to claim 3, characterized in that: The method further includes supplementing target frames between adjacent target key frames based on a difference algorithm.
6. The method for optimizing animation rendering according to claim 5, characterized in that: The step of calculating the effective rendering images corresponding to the moments between the moments corresponding to adjacent effective rendering images comprises the following steps: A convolutional neural network model is trained based on the target relative illumination angle and the corresponding effective illumination rendering image and the effective shadow rendering image, the distance of the point light source illumination and the corresponding effective illumination rendering image and the effective shadow rendering image, respectively, to obtain a rendering prediction model that outputs a predicted effective illumination rendering image and an effective shadow rendering image according to the input target relative illumination angle and the distance of the point light source illumination, wherein the rendering prediction model includes a illumination rendering prediction model for predicting an effective illumination rendering image, and a shadow rendering prediction model for predicting an effective shadow rendering image.
7. The animation rendering optimization method according to claim 5, characterized in that: The rendering prediction model is used to output a predicted effective lighting rendering image and an effective shadow rendering image according to an input target relative lighting angle, and output a predicted effective lighting rendering image and an effective shadow rendering image according to an input point light source lighting distance, and includes the following steps: Retrieve the target frame and corresponding target group of the target to be rendered; Determine the type of light source; If the light source type is a parallel light source, the angle between the target positive direction of the target in the target frame and the illumination direction of the parallel light source is calculated to obtain the target relative illumination angle; If the light source type is a point light source, the angle between the ray emitted by the target to the point light source in the target frame and the positive direction of the target is calculated to obtain the target relative illumination angle, and the distance between the target and the point light source in the target frame is calculated; Select a rendering prediction model corresponding to the target group corresponding to the target frame, and select a corresponding lighting rendering prediction model or a shadow rendering prediction model from the corresponding rendering prediction model according to the light source type, and output the predicted effective lighting rendering image and effective shadow rendering image according to the input target relative lighting angle or the distance of the point light source.
8. An animation rendering optimization system, used to execute an animation rendering optimization method according to any one of claims 1 to 7, characterized in that: It includes a 3D scene construction module, a key frame setting module, a model texture material setting module, a target classification module, a test rendering module, a rendering prediction module, and a rendering merging output module; The three-dimensional scene construction module is used to obtain or construct three-dimensional scene settings, camera settings and light source settings information corresponding to the animation; The key frame setting module is used to set the target key frame of each target in the three-dimensional scene setting in the animation; The model texture material setting module is used to set the texture and material of each target in the three-dimensional scene setting; The target classification module is used to classify targets according to their types to obtain multiple target groups; The test rendering module is used to uniformly extract a set number of light source settings from the light source settings to obtain light source test settings; uniformly extract target key frames corresponding to each target group from the target key frames to obtain target test key frames; Render the target key frames of each target group under each light source test setting respectively to obtain the corresponding rendering effect graph; based on the camera settings and the target key frames, filter out the target key frames within the camera field of view to obtain the valid frames, retrieve the rendering effect graph corresponding to the valid target key frames in the rendering effect graph, and obtain the valid rendering graph corresponding to the valid frames; The rendering prediction module is used to calculate the valid rendering images corresponding to the moments between the moments corresponding to adjacent valid rendering images; The rendering merging and outputting module is used to merge the valid rendering images of each target group with the same corresponding time to obtain a valid rendering frame, and arrange the valid rendering frames in the order of the corresponding time to obtain an animation.