Animation scene light and shadow dynamic rendering method and system
By establishing the relationship between light and shadow and dynamic response rules between elements in anime scenes, and optimizing the light and shadow parameters, the problem of unrealistic and inconsistent light and shadow effects in anime scenes was solved, achieving efficient and natural light and shadow rendering effects and a smooth visual experience.
Patent Information
- Application Number
- CN202511435227.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2045-10-09
AI Technical Summary
Existing methods for rendering lighting and shadows in anime scenes fail to adequately consider the interplay between static structural elements and dynamic character elements, resulting in a lack of realism and coherence in lighting and shadow effects. Furthermore, these methods are difficult to dynamically adjust based on the atmosphere, leading to inefficiency and inconsistent lighting and shadow effects.
Establish the relationship between light and shadow between scene elements, generate dynamic light and shadow response rules, and optimize light and shadow parameters through multiple rounds of iteration to achieve dynamic adaptive adjustment of light and shadow effects. Generate inter-frame light and shadow transition parameters to ensure smooth transition.
It achieves dynamic adaptive adjustment of lighting and shadow effects, improves rendering efficiency, ensures that the lighting and shadow effects match the scene atmosphere, eliminates lighting and shadow interference, and provides a smooth visual experience.
Smart Images

Figure CN121259162A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of animation production, in particular to an animation scene light and shadow dynamic rendering method and system. BACKGROUND
[0002] In the field of animation production, scene light and shadow rendering is a key link to create a realistic atmosphere and enhance visual effects. However, the existing animation scene light and shadow rendering methods have many limitations. Traditional light and shadow rendering methods often handle each scene element in isolation, without fully considering the complex light and shadow interaction relationship between scene static structural elements (such as buildings, terrain, etc.) and scene dynamic role elements (such as characters, animals, etc.). For example, when rendering a scene containing a character moving in front of a building, the existing method may only simply set light and shadow parameters for the character and the building, without considering the influence of the light and shadow changes caused by the character's action on the surface light and shadow of the building, and the blocking and reflection of the building structure on the light and shadow around the character, resulting in a lack of realism and coherence in the light and shadow effect.
[0003] At the same time, the existing light and shadow rendering methods are difficult to dynamically adjust according to the atmosphere type of the animation scene. Different atmosphere types (such as warm, tense, mysterious, etc.) require different light and shadow effects to highlight, but traditional methods lack effective rules to define how to accurately adjust light and shadow parameters when scene element state changes and atmosphere type switches. This makes it necessary to manually adjust a large number of parameters during production, which is not only inefficient, but also difficult to ensure the consistency and accuracy of the light and shadow effect. In addition, in terms of inter-frame light and shadow transition, the existing technology often cannot achieve smooth connection, resulting in light and shadow jumps in the animation when playing, affecting the visual experience of the audience. SUMMARY
[0004] In view of the above-mentioned problems, in combination with the first aspect of the present application, the embodiments of the present application provide an animation scene light and shadow dynamic rendering method, which comprises: establishing a light and shadow association relationship between each scene element in the animation scene to obtain a scene element light and shadow association graph, the scene elements including scene static structural elements and scene dynamic role elements, the light and shadow association relationship being used to describe the association manner of light and shadow interaction between different scene elements, and the scene element light and shadow association graph containing hierarchical division information of the scene elements and light and shadow association weights between different levels; based on the scene element light and shadow association graph, combining the possible atmosphere types of the animation scene, generating a light and shadow dynamic response rule, the light and shadow dynamic response rule being used to define the corresponding light and shadow adjustment manner when the scene element state changes and the atmosphere type switches; According to the light and shadow dynamic response rule, scene element state data of a current frame of the animation scene and a current atmosphere type identifier are combined to generate an initial light and shadow rendering scheme, the scene element state data including position distribution information of scene static structure elements and action posture information of scene dynamic role elements, and the initial light and shadow rendering scheme including basic light and shadow parameters and atmosphere adaptation parameters of each scene element; Based on the scene element light and shadow association graph, interaction influences between light and shadow effects corresponding to each scene element in the initial light and shadow rendering scheme are analyzed, including direct light and shadow interference and indirect light and shadow interference, to obtain a light and shadow interaction influence result, the light and shadow interaction influence result including an interference source identifier, an interfered element identifier, and an interference transmission path. According to the light and shadow interaction influence result, a multi-round iteration adjustment mode is used to optimize light and shadow parameters in the initial light and shadow rendering scheme to generate a final light and shadow rendering scheme, and the final light and shadow rendering scheme is applied to rendering processing of the current frame of the animation scene. Key light and shadow parameters in the final light and shadow rendering scheme of the current frame are extracted, and corresponding key light and shadow parameters in a previous frame rendering scheme are analyzed for continuity to generate inter-frame light and shadow transition parameters, the inter-frame light and shadow transition parameters being used for light and shadow smooth connection in next frame rendering.
[0005] In still another aspect, an embodiment of the present application further provides an animation scene light and shadow dynamic rendering system, characterized in that it comprises: a processor; a machine readable storage medium for storing machine executable instructions of the processor; wherein the processor is configured to execute the above-mentioned animation scene light and shadow dynamic rendering method by executing the machine executable instructions.
[0006] In still another aspect, an embodiment of the present application further provides a computer program product, the computer program product comprising machine executable instructions stored in a computer readable storage medium, a processor of a computer device reading the machine executable instructions from the computer readable storage medium, and the processor executing the machine executable instructions to enable the computer device to execute the above-mentioned animation scene light and shadow dynamic rendering method.
[0007] Based on the above aspects, by establishing the light and shadow correlation relationship between each scene element in the animation scene, a scene element light and shadow correlation graph containing hierarchical division information and light and shadow correlation weights between different levels is obtained, which can comprehensively and accurately describe the correlation mode of the mutual influence of light and shadow between different scene elements. The light and shadow dynamic response rule generated based on the scene element light and shadow correlation graph can define the corresponding light and shadow adjustment mode of the scene element state change and the atmosphere type switching according to the possible atmosphere types of the animation scene, realize the dynamic adaptive adjustment of the light and shadow effect, and greatly improve the rendering efficiency without manual intervention, and ensure the high consistency of the light and shadow effect and the scene atmosphere. According to the initial light and shadow rendering scheme generated based on the light and shadow dynamic response rule, combined with the analysis result of the interaction of the light and shadow effect of each scene element in the initial scheme, the light and shadow parameters are optimized by using the multi-round iteration adjustment mode, which can eliminate direct light and shadow interference and indirect light and shadow interference, generate a more accurate and reasonable final light and shadow rendering scheme, and make the light and shadow effect of the animation scene more realistic and natural. Finally, by extracting the key light and shadow parameters in the final light and shadow rendering scheme of the current frame and performing continuity analysis on the corresponding key light and shadow parameters in the rendering scheme of the previous frame, inter-frame light and shadow transition parameters are generated, the smooth connection of the light and shadow in the next frame rendering is realized, and a more smooth and comfortable visual experience is brought to the audience. BRIEF DESCRIPTION OF DRAWINGS
[0008] Figure 1 is the execution flow diagram of the animation scene light and shadow dynamic rendering method provided by the embodiment of the application. DETAILED DESCRIPTION
[0009] The application will be specifically described below in conjunction with the drawings of the specification, Figure 1 is the flow diagram of the animation scene light and shadow dynamic rendering method provided by an embodiment of the application, and the animation scene light and shadow dynamic rendering method will be described in detail below.
[0010] Step S110: Establish the light and shadow correlation relationship between each scene element in the animation scene to obtain a scene element light and shadow correlation graph, wherein the scene elements include scene static structure elements and scene dynamic role elements, the light and shadow correlation relationship is used to describe the correlation mode of the mutual influence of light and shadow between different scene elements, and the scene element light and shadow correlation graph contains hierarchical division information of the scene elements and light and shadow correlation weights between different levels.
[0011] In this embodiment, a general cartoon indoor scene is taken as an example for illustration. There are various scene elements in this scene, including fixed structural objects and movable character objects. The fixed structural objects include the basic framework part constituting the scene space, the support part for placing articles, and the device part providing basic lighting; the movable character objects include the core character performing the main activity in the scene, the secondary character performing the auxiliary activity, and other characters appearing temporarily. Establishing the light-shadow association relationship aims to clarify the rules of light-shadow action between these different types of elements, such as the illumination range and intensity variation of the lighting device on the surrounding structural objects, and the shadow pattern variation of the character objects on the ground during movement. By constructing the scene element light-shadow association graph, the hierarchical division of the elements and the weight relationship of the light-shadow influence between different levels of elements can be systematically presented.
[0012] Step S111: classifying the scene elements in the cartoon scene to distinguish between scene static structural elements and scene dynamic character elements, obtaining a scene element classification result, the scene static structural elements including architectural components, natural landscape elements, prop elements, the scene dynamic character elements including main character elements, secondary character elements, and temporarily appearing character elements.
[0013] In the above general cartoon indoor scene, the classification operation of the scene elements is first performed. In terms of scene static structural elements, architectural components include the top structure constituting the scene space boundary, the surrounding support structure, the bottom support structure, and the transition structure connecting the parts; prop elements include multi-layer storage structures for placing articles, seats and article placement planes for characters to use, fixed and movable lamps providing lighting functions, and small decorative arrangements and functional tool articles; natural landscape elements are not involved because the scene is an indoor environment. In terms of scene dynamic character elements, the main character elements are set as the characters performing the core task in the scene, the secondary character elements are the characters performing the auxiliary task in the scene, and the temporarily appearing character elements are the characters appearing temporarily in the scene and not affecting the main plot. In the classification process, each element is assigned a unique identification code, and the coding rule includes the feature prefix of the element type and the sequential serial number, for example, the code of the architectural component starts with a specific letter combination, and the code of the main character element starts with another specific letter combination, different prefixes are used to distinguish the large categories of elements, and the serial numbers are sequentially assigned according to the order of the elements appearing in the scene.
[0014] Step S112: Hierarchical division is performed on the scene elements in the scene element classification result, to divide the scene elements into core scene elements, secondary scene elements and background scene elements, the core scene elements are elements corresponding to visual focal points in the picture, the secondary scene elements are elements for assisting the core scene elements in expression, and the background scene elements are elements for constructing the spatial sense of the scene; the light-shadow correlation weight corresponding to the scene elements in different levels is determined, the light-shadow correlation weight of the core scene elements is greater than that of the secondary scene elements, and the light-shadow correlation weight of the secondary scene elements is greater than that of the background scene elements.
[0015] After the element classification is completed, the scene elements in the classification result are hierarchically divided. The core scene elements are selected from elements in the picture as visual focal points, that is, the main role elements performing the core task and the prop elements directly interacting with them, which occupy a prominent position in the picture and are the core of the plot expression; the secondary scene elements include auxiliary prop elements around the main role elements and secondary role elements performing auxiliary tasks, which constitute the direct environment of the core scene elements and are used to enrich the picture level and plot content; the background scene elements cover the boundary building components of the scene space, the decorative prop elements in the distance and the lighting devices providing the overall environmental atmosphere, which are used to construct the overall spatial sense and environmental keynote of the scene. The light-shadow correlation weight is set according to the level of the elements, the light-shadow correlation weight of the core scene elements is set to the highest level, the light-shadow correlation weight of the secondary scene elements is set to the middle level, and the light-shadow correlation weight of the background scene elements is set to the lowest level. In specific setting, the weight value interval of the core scene elements is higher than that of the secondary scene elements, and the weight value interval of the secondary scene elements is higher than that of the background scene elements, so as to distinguish the importance of the elements in different levels in the mutual influence of light and shadow through different weight intervals.
[0016] Step S113: Extract the light-shadow attribute of each scene element, the light-shadow attribute including the reflection characteristic of the scene element to light and shadow, the absorption characteristic of the scene element to light and shadow, and the self-luminous characteristic of the scene element, the reflection characteristic including the diffuse reflection ratio and the specular reflection ratio, the absorption characteristic including the absorption ratio of different wavelengths of light, and the self-luminous characteristic including the self-luminous intensity and the luminous color range.
[0017] After the classification and hierarchy division of the scene elements are completed, the light and shadow properties of each scene element are extracted. In terms of reflection characteristics, for the bottom support structure in the building component, if the surface is rough, the diffuse reflection ratio is set to a higher value and the specular reflection ratio is set to a lower value; if the surface is smooth, the diffuse reflection ratio is set to a lower value and the specular reflection ratio is set to a higher value. For the seat in the prop element, if the surface is cloth material, the diffuse reflection ratio is higher and the specular reflection ratio is lower; if the surface is metal material, the specular reflection ratio is higher and the diffuse reflection ratio is lower. The clothing materials of the main role elements are different, and the reflection characteristics are also different, for example, the diffuse reflection ratio of cotton clothing is high, and the specular reflection ratio of silk clothing is relatively high. In terms of absorption characteristics, the absorption ratios of different scene elements are different for different wavelengths of light, for example, the red object plane has a higher absorption ratio for blue wavelength light and a lower absorption ratio for red wavelength light; the green decorative arrangement has a high absorption ratio for red wavelength light and a low absorption ratio for green wavelength light. The light-emitting characteristics mainly target the lighting device type prop elements and the role elements with self-luminous ability. The self-luminous intensity is set to different ranges according to the types of the elements, and the light-emitting color range is set to include a range of color combinations according to the design of the elements, for example, a fixed lamp may emit warm yellow light, and its light-emitting color range is concentrated in the yellow wavelength region, while some main role elements with special abilities may emit blue light, and the light-emitting color range is concentrated in the blue wavelength region.
[0018] Step S114: analyze the spatial position relationship between each scene element and other scene elements, determine the light and shadow propagation path between different scene elements according to the spatial position relationship, if there is an occlusion scene element, mark the light and shadow propagation path as a blocked path, and record the identification and occlusion degree of the occlusion scene element, wherein the spatial position relationship includes distance interval, relative angle, and occlusion relationship, and the light and shadow propagation path is used to describe the path direction of the light and shadow from one scene element to another scene element.
[0019] After extracting the light shadow attribute, the spatial position relationship between each scene element and other scene elements is analyzed. The analysis of the spatial position relationship includes three aspects of distance interval, relative angle and occlusion relationship. The distance interval refers to the straight-line distance between two scene elements, which is obtained by calculating the modulus of the coordinate difference value of each element in the scene coordinate system. The relative angle refers to the angle between the horizontal direction and the vertical direction of one scene element relative to the reference point, which is obtained by calculating the arctangent value of the coordinate difference value. The occlusion relationship is to determine whether there is other scene element blocking the light shadow propagation between two scene elements, which is determined by checking whether the geometric model of other elements intersects in the direction of the line connecting the two elements. According to the spatial position relationship, the light shadow propagation path is determined, and the direction of the light shadow propagation path is from the light shadow emitting element to the light shadow receiving element. When there is an occlusion scene element between two scene elements, the light shadow propagation path is marked as a blocked path, and the identification and occlusion degree of the occlusion scene element are recorded. The occlusion degree is measured by the ratio of the projection area of the occlusion element on the propagation path to the total path cross-sectional area. The larger the ratio is, the higher the occlusion degree is.
[0020] Step S115: According to the light shadow attribute of each scene element, the light shadow propagation path between different scene elements and the hierarchical correlation weight of the scene element, the light shadow correlation degree between different scene elements is calculated, which is used to quantify the degree of mutual influence of light shadow between different scene elements. In the calculation process, the basis correlation value is first determined according to the light shadow attribute, then the basis correlation value is corrected according to the smoothness of the light shadow propagation path, and finally the final light shadow correlation degree is obtained combined with the hierarchical correlation weight.
[0021] After obtaining the light and shadow properties, light and shadow propagation paths and hierarchical correlation weights of the scene elements, the light and shadow correlation degrees between different scene elements are calculated. First, the basic correlation value is determined according to the light and shadow properties. The calculation of the basic correlation value considers the diffuse reflection ratio and the specular reflection ratio in the reflection characteristic, the absorption ratio of different wavelengths of light in the absorption characteristic, and the self-luminous intensity and luminous color range in the luminous characteristic. For the element with the luminous characteristic, the basic correlation value between the element and the receiving light and shadow element is determined according to the matching degree of the luminous intensity and the luminous color range with the absorption characteristic of the receiving element; for the element without the luminous characteristic but with the reflection characteristic, the basic correlation value is determined according to the reflection ratio and the positional relationship of the receiving element. Then, the basic correlation value is corrected according to the smoothness of the light and shadow propagation path. If the propagation path is a smooth path, the correction coefficient is greater than 1; if it is a blocked path, a correction coefficient less than 1 is set according to the blocking degree. The higher the blocking degree, the smaller the correction coefficient. The basic correlation value is multiplied by the correction coefficient to obtain the corrected correlation value. Finally, the corrected correlation value is multiplied by the proportional coefficient of the hierarchical correlation weight to obtain the final light and shadow correlation degree. The higher the hierarchical correlation weight of the element, the greater the proportional coefficient, so that the final light and shadow correlation degree can reflect the difference in the light and shadow influence degree between elements of different levels.
[0022] Step S116: Based on the light and shadow correlation degrees between different scene elements, a scene element light and shadow correlation graph is constructed. The scene element light and shadow correlation graph takes scene elements as nodes, the node attributes include scene element types, hierarchical identifiers and light and shadow properties, the light and shadow correlation degrees are taken as the attributes of the connecting edges between nodes, and the smoothness of the light and shadow propagation path and the blocking element identifier are also marked. At the same time, a hierarchical index is added to the scene element light and shadow correlation graph.
[0023] Based on the calculated light and shadow correlation degrees between different scene elements, a scene element light and shadow correlation graph is constructed. The scene element light and shadow correlation graph takes scene elements as nodes, the attributes of each node include the type, hierarchical identifier and light and shadow properties of the scene element. The type is the building component, prop element, main role element and the like obtained by classification, the hierarchical identifier is the identifier of the core, secondary or background level, and the light and shadow properties include reflection, absorption, luminous and other characteristic parameters. The connecting edges between nodes represent the light and shadow correlation relationship between scene elements, and the attributes of the connecting edges mainly take the light and shadow correlation degree as the parameter, and mark the smoothness of the light and shadow propagation path (smooth or blocked) and the blocking element identifier when blocked. In addition, a hierarchical index is added to the scene element light and shadow correlation graph. The hierarchical index is arranged in the order of core scene elements, secondary scene elements and background scene elements, and each level contains all nodes of the level. Through the hierarchical index, different levels of scene elements and their correlation relationships can be quickly located, which is convenient for subsequent query and application of the graph.
[0024] Step S120: Based on the scene element light shadow correlation graph, combined with the possible atmosphere types of the animation scene, a light shadow dynamic response rule is generated, which is used to define the corresponding light shadow adjustment mode when the scene element state changes and the atmosphere type switches.
[0025] After the scene element light shadow correlation graph is constructed, based on the graph, combined with the possible atmosphere types of the animation scene, a light shadow dynamic response rule is generated. The atmosphere type is a different situation mode set according to the plot requirements and emotional expression of the scene, and different atmosphere types correspond to different overall light shadow effects. The light shadow dynamic response rule is a rule set that specifies how to adjust the light shadow parameters of each scene element when the state of the scene element changes or the atmosphere type switches. Through the rule, the dynamic matching of light shadow effect and scene plot and atmosphere can be realized.
[0026] Step S121: Define the possible atmosphere types of the animation scene, each atmosphere type corresponding to a set of reference light shadow characteristics, including overall light intensity range, main color range, light shadow contrast range and shadow softness parameter.
[0027] First, define the possible atmosphere types of the animation scene. According to the common plot requirements of general animation indoor scenes, set multiple different atmosphere types, such as daily activity atmosphere, tense atmosphere, warm atmosphere, mysterious atmosphere, etc. Each atmosphere type corresponds to a set of reference light shadow characteristics. The overall light intensity range specifies the light intensity interval of the scene as a whole under this atmosphere. The light intensity range of different atmosphere types is different, for example, the light intensity range of the daily activity atmosphere is at a moderate level, and the light intensity range of the tense atmosphere may be lower and fluctuate more. The main color range specifies the main color interval of the scene light under this atmosphere, for example, the main color range of the warm atmosphere may be concentrated in the warm color system, and the main color range of the mysterious atmosphere may be concentrated in the cold color system. The light shadow contrast range specifies the luminance difference interval of the bright and dark regions in the scene. The contrast range of the daily activity atmosphere is moderate, and the contrast range of the tense atmosphere may be larger to enhance the dramatic effect. The shadow softness parameter specifies the blur degree of the shadow edge in the scene. The shadow softness parameter of the warm atmosphere is higher, and the shadow edge is more blurred. The shadow softness parameter of the tense atmosphere is lower, and the shadow edge is more sharp.
[0028] Step S122: Extract the node attribute information of each scene element and the light shadow correlation degree information of the connection edge between the nodes in the scene element light shadow correlation graph. The node attribute information includes scene element type, level identifier, light shadow attribute, and connection edge information includes light shadow correlation degree and propagation path state.
[0029] From the constructed scene element light shadow association graph, relevant information is extracted, including node attribute information of each scene element and light shadow association degree information of the connection edge between nodes. In the extraction process of node attribute information, the scene element type is directly obtained from the node attribute, that is, the classification types such as building component, prop element, main role element, etc.; the level identifier obtains the level information of the core, secondary or background; and the light shadow attribute extracts the specific parameter values of the reflection characteristic, absorption characteristic and luminous characteristic. In the extraction of connection edge information, the light shadow association degree directly obtains the value calculated before; the propagation path state obtains the state identifier of unobstructed or obstructed, and if it is an obstructed state, the identifier information of the shielding element is also extracted. The extracted information is sorted according to the identifier of the scene element to form a structured data set, which is convenient for subsequent analysis of the light influence mode of the scene element under different atmosphere types.
[0030] Step S123: analyze the state change types that the scene dynamic role element may appear, including position change of the scene dynamic role element, action posture change of the scene dynamic role element, appearance form change of the scene dynamic role element, the position change includes short distance movement and long distance movement, the action posture change includes limb action change and facial expression change, and the appearance form change includes clothing color change and carrying prop change.
[0031] The state change types that the scene dynamic role element may appear are analyzed. The position change refers to the change of the spatial position of the role in the scene, the short distance movement refers to the position adjustment of the role in a small range, for example, the body of the main role moves forward and backward on the seat; the long distance movement refers to the position transfer of the role in a large range in the scene, for example, from one area of the scene to another area. The action posture change refers to the change of the body posture and action of the role, the limb action change includes the action of the arms, legs, trunk and other parts, for example, the action of the main role lifting the hand to take something; the facial expression change includes the form change of the facial features, for example, the expressions of the main role such as surprise and smile. The appearance form change refers to the change of the external image characteristics of the role, the clothing color change refers to the change of the color of the clothing worn by the role, which may be due to the need of the plot or the influence of the environment; the carrying prop change refers to the change of the type or state of the prop carried by the role, for example, from empty hands to holding a certain prop, or from the closed state of the prop to the open state.
[0032] Step S124: For each state change type of the scene dynamic role element, the affected scene element range corresponding to the state change type is determined in combination with the node attribute information and the light and shadow correlation degree information in the scene element light and shadow correlation graph, and the affected scene element is filtered from high to low according to the light and shadow correlation degree information, and the filtering process continues until the light and shadow correlation degree is lower than a preset correlation threshold. The affected scene element range includes scene elements directly affected by the state change and scene elements indirectly affected by the state change. The directly affected scene element is the scene element with the highest light and shadow correlation degree with the scene dynamic role element, and the indirectly affected scene element is the scene element with light and shadow correlation with the directly affected scene element.
[0033] For each state change type of the scene dynamic role element, the affected scene element range is determined in combination with the node attribute information and the light and shadow correlation degree information in the scene element light and shadow correlation graph. First, for the position change type, when the main role element moves a long distance, according to the new position after the movement, the scene elements within a certain range centered on the role are found in the scene element light and shadow correlation graph, which may be directly affected by the light and shadow change caused by the movement of the role. Then, the above elements are filtered from high to low according to the light and shadow correlation degree information, and a correlation threshold is preset, and the filtering is stopped when the light and shadow correlation degree is lower than the threshold. The directly affected scene element is the element with the highest light and shadow correlation degree with the scene dynamic role element, for example, the bottom support structure (ground) under the standing position after the movement of the role, which has the highest light and shadow correlation degree with the role and belongs to the directly affected element. The indirectly affected scene element is the element with light and shadow correlation with the directly affected scene element, for example, the furniture and the object plane around the ground, which have light and shadow correlation with the ground, and when the light and shadow of the ground changes due to the movement of the role, these elements will be indirectly affected.
[0034] Step S125: For each affected scene element in the affected scene element range, the corresponding light and shadow adjustment dimension of the affected scene element is determined in combination with the reference light and shadow characteristics of different atmosphere types, and the light and shadow adjustment dimension includes the illumination intensity adjustment of light and shadow, the illumination range adjustment of light and shadow, the color attribute adjustment of light and shadow, the contrast adjustment of light and shadow, and the softness adjustment of shadow.
[0035] For each affected scene element within the affected scene element range, the corresponding light and shadow adjustment dimension is determined in combination with the reference light and shadow characteristics of different atmosphere types. For example, under the daily activity atmosphere, when the main character element changes in body movement (such as lifting hands to take things), the directly affected prop element (such as the object on the object plane) needs to be adjusted in light and shadow. According to the reference light and shadow characteristics of the daily activity atmosphere, the overall illumination intensity range is moderate, the main color tone range is warm color system, the light and shadow contrast range is moderate, and the shadow softness parameter is moderate. Therefore, the light and shadow adjustment dimension of the prop element may include illumination intensity adjustment, so that the illumination intensity slightly increases under the influence of character action; illumination range adjustment, adjusting the illumination range of light and shadow according to the amplitude of character action; color attribute adjustment, making the color more consistent with the main color tone range of warm color system; contrast adjustment, keeping in the moderate contrast range; shadow softness adjustment, maintaining the moderate shadow softness parameter. For different atmosphere types and affected scene elements, the corresponding adjustment dimension combination needs to be determined according to the specific reference light and shadow characteristics.
[0036] Step S126: For each atmosphere type, a corresponding relationship between scene dynamic character element state change type and affected scene element light and shadow adjustment mode is established, the light and shadow adjustment mode including adjustment dimension, adjustment direction and adjustment basis, the adjustment basis being an adjustment amplitude coefficient determined based on scene element light and shadow correlation degree, the higher the light and shadow correlation degree, the larger the adjustment amplitude coefficient.
[0037] For each atmosphere type, a corresponding relationship between scene dynamic character element state change type and affected scene element light and shadow adjustment mode is established. For each atmosphere type, all scene dynamic character element state change types are traversed, and for each affected scene element under each state change type, its light and shadow adjustment mode is determined. The adjustment dimension is the illumination intensity, illumination range, color attribute, contrast, shadow softness and the like determined before; the adjustment direction is determined according to the type of state change and the demand of atmosphere type, for example, the character moves to a region with stronger illumination, the illumination intensity adjustment direction of the affected element is increase, and vice versa; the adjustment basis is set as an adjustment amplitude coefficient determined based on scene element light and shadow correlation degree, the higher the light and shadow correlation degree of the affected scene element, the larger the adjustment amplitude coefficient, i.e. the larger the adjustment amount of light and shadow parameters. The above corresponding relationship is arranged into rule entries, each rule entry containing atmosphere type, state change type, affected scene element identifier, adjustment dimension, adjustment direction and adjustment amplitude coefficient, forming a complete light and shadow dynamic response rule set.
[0038] Step S130: According to the light and shadow dynamic response rule, the scene element state data of the current frame of the animation scene and the current atmosphere type identifier are combined to generate an initial light and shadow rendering scheme, the scene element state data includes the position distribution information of the scene static structure elements and the action posture information of the scene dynamic role elements, and the initial light and shadow rendering scheme includes the basic light and shadow parameters of each scene element and the atmosphere adaptation parameters.
[0039] According to the generated light and shadow dynamic response rule, the scene element state data of the current frame of the animation scene and the current atmosphere type identifier are combined to generate an initial light and shadow rendering scheme. The scene element state data provides specific state information of each scene element in the current frame, including the position distribution of the scene static structure elements and the action posture of the scene dynamic role elements, and the current atmosphere type identifier indicates the atmosphere type to be adopted in the current scene. By matching the above information with the light and shadow dynamic response rule, the light and shadow parameters of each scene element under the current state and atmosphere are determined, and an initial light and shadow rendering scheme is generated, which includes the basic light and shadow parameters of each scene element and the atmosphere adaptation parameters for adapting to the current atmosphere.
[0040] Step S131: Analyzing the scene element state data of the current frame of the animation scene, extracting the position distribution information of the scene static structure elements and the action posture information of the scene dynamic role elements, the position distribution information including the spatial coordinates and relative layout relationship of each scene static structure element, and the action posture information including the limb angle, joint position and motion trend of the scene dynamic role elements.
[0041] The scene element state data of the current frame of the animation scene is analyzed, which is stored in a structured format and includes the current state information of all elements in the scene. For the scene static structure elements, the position distribution information is extracted, which is represented by the spatial coordinates of each element in the three-dimensional coordinate system of the scene, and each element has a set of unique coordinate values to determine its position. At the same time, the relative layout relationship between elements is extracted, which is calculated by the difference between the coordinates of each element, such as the vertical distance between the top structure and the bottom support structure in the building component, and the relative position between the storage structure and the seat in the prop element. For the scene dynamic role elements, the action posture information is extracted, the limb angle is represented by the angle between each limb part and the trunk, such as the horizontal and vertical angles between the arm and the trunk; the joint position is represented by the coordinates of the joint in the three-dimensional coordinate system, such as the coordinates of the shoulder joint, elbow joint, knee joint, etc.; and the motion trend is calculated according to the change of joint position in continuous multiple frames, which is used to judge the direction and speed of the role action.
[0042] Step S132: According to the scene element state data of the current frame, compare the scene element state data of the previous frame to determine whether the scene dynamic role element has a state change. If the scene dynamic role element has a state change, determine the state change type corresponding to the specific manifestation of the state change. If the scene dynamic role element does not have a state change, use the corresponding state change type of the previous frame and mark it as no change.
[0043] Compare the scene element state data of the current frame with the scene element state data of the previous frame, and focus on comparing the state information of the scene dynamic role element. During the comparison process, first compare the action posture information of the main role element, check whether the limb angle, joint position has changed, and whether the movement trend exists; then compare the position distribution information and action posture information of the secondary role element and the temporarily appearing role element. If the position distribution, action posture and other information of the scene dynamic role element changes compared with the previous frame, it is determined that there is a state change. According to the specific manifestation of the state change, determine the corresponding state change type, for example, if the joint position of the main role element moves in a large range and the spatial coordinate changes greatly, it is determined as long distance movement in position movement change; if only the limb angle changes and the position coordinate changes little, it is determined as limb movement change in action posture change. If the state information of the scene dynamic role element does not change compared with the previous frame, use the corresponding state change type of the previous frame and mark it as no change in the current frame.
[0044] Step S133: Obtain the current atmosphere type identifier of the current frame of the animation scene, and according to the current atmosphere type identifier, retrieve the light and shadow adjustment rule subset under the corresponding atmosphere type from the light and shadow dynamic response rule. The rule subset includes the affected scene element range and light and shadow adjustment mode corresponding to all state change types under the atmosphere type.
[0045] Obtain the current atmosphere type identifier of the current frame of the animation scene, which is determined by the plot development of the scene, for example, if the current frame plot is daily reading, the atmosphere type identifier is daily activity atmosphere. According to the identifier, query in the light and shadow dynamic response rule to find all rule entries corresponding to the atmosphere type, which constitute a light and shadow adjustment rule subset. The light and shadow adjustment rule subset includes the affected scene element range and light and shadow adjustment mode corresponding to all possible scene dynamic role element state change types under the atmosphere type, for example, under the daily activity atmosphere, the affected scene element range corresponding to the short distance movement state change type of the main role element includes surrounding furniture and object placing plane, and the light and shadow adjustment mode includes small amplitude adjustment of illumination intensity, local adjustment of illumination range, etc.
[0046] Step S134: According to the determined state change type, find the corresponding affected scene element range and the light and shadow adjustment dimension, adjustment direction and adjustment amplitude coefficient of each affected scene element from the rule subset.
[0047] According to the previously determined state change type of the scene dynamic role element, search in the retrieved light and shadow adjustment rule subset. In the search process, use the state change type as the index to match the corresponding rule entry in the rule subset. After finding the matched rule entry, extract the affected scene element range, i.e. all scene elements that need to be adjusted in light and shadow under this state change type. At the same time, extract the light and shadow adjustment dimension (such as illumination intensity, color attribute, etc.), adjustment direction (increase or decrease, bias to a certain color, etc.) and adjustment amplitude coefficient of each affected scene element. The adjustment amplitude coefficient is determined according to the light and shadow correlation degree of the scene element. The higher the correlation degree, the larger the coefficient. For example, if the state change type is the change of the main role element's limb movement (lifting hands to take something), find the corresponding affected scene element from the rule subset, which is a specific object on the object plane. Its light and shadow adjustment dimension is illumination intensity and shadow softness, the adjustment direction is to increase the illumination intensity and improve the shadow softness, and the adjustment amplitude coefficient is determined according to the light and shadow correlation degree of the object and the main role element.
[0048] Step S135: For each affected scene element, first determine the basic light and shadow parameter of the affected scene element according to the light and shadow attribute of the affected scene element and the reference light and shadow characteristics of the current atmosphere type. The basic light and shadow parameter includes basic illumination intensity, basic illumination range, basic color attribute, basic contrast, and basic shadow softness.
[0049] For each affected scene element, determine its base lighting parameters. First, obtain the lighting properties of the affected scene element, including reflection characteristics, absorption characteristics, and emission characteristics (if any). Then, combine the reference lighting characteristics of the current atmosphere type, such as the overall lighting intensity range, the dominant color range, etc. The determination of the base illumination intensity: for an affected scene element that does not emit light itself, calculate the base illumination intensity based on the overall lighting intensity range of the current atmosphere type and the reflection characteristics of the element. The higher the reflection ratio, the higher the base illumination intensity. For an element that emits light itself, adjust the base illumination intensity based on the self-emission intensity in its emission characteristics and the overall lighting intensity range of the atmosphere type, ensuring that it does not exceed the lighting range of the atmosphere type. The base illumination range is determined based on the size of the element and its position in the scene. The larger the size and the more central the position, the larger the illumination range. The base color property is determined based on the dominant color range of the atmosphere type and the absorption characteristics of the element. The lower the absorption ratio of the element to the wavelength of light within the dominant color range, the closer the base color property to the dominant color. The base contrast refers to the lighting contrast range of the atmosphere type, combined with the reflection and absorption characteristics of the element. The greater the difference between reflection and absorption, the higher the contrast. The base shadow softness directly adopts the shadow softness parameter of the current atmosphere type.
[0050] Step S136: Combine the position distribution information of the scene static structure elements, analyze the spatial position relationship between the affected scene element and other surrounding scene elements. If there is a shielding relationship, preliminarily correct the base lighting parameters according to the shielding degree, and reduce the base illumination intensity when there is shielding.
[0051] Combine the position distribution information of the scene static structure elements, analyze the spatial position relationship between the affected scene element and other surrounding scene elements. By comparing the spatial coordinates and geometric sizes of each element, determine whether there is a shielding relationship, i.e., whether the surrounding other scene elements are located between the affected scene element and the light source. If there is a shielding relationship, preliminarily correct the base lighting parameters according to the shielding degree obtained by previous analysis. For the base illumination intensity, the higher the shielding degree, the more the corrected illumination intensity is reduced, and the reduction amplitude is proportional to the shielding degree. For example, if the affected scene element is partially shielded by a scene element with a medium shielding degree, multiply its base illumination intensity by a medium correction coefficient (less than 1) to obtain the preliminarily corrected illumination intensity. For the illumination range, if there is shielding, trim the illumination range of the affected scene element according to the position and size of the shielding element, and remove the shielded area.
[0052] Step S137: Adjust the preliminary corrected basic light and shadow parameter according to the adjustment amplitude coefficient and adjustment direction corresponding to the affected scene element, to obtain the initial light and shadow parameter corresponding to the affected scene element, which includes initial irradiation intensity parameter, initial irradiation range parameter, initial color attribute parameter, initial contrast parameter, and initial shadow softness parameter.
[0053] The preliminary corrected basic light and shadow parameter is adjusted according to the adjustment amplitude coefficient and adjustment direction corresponding to the affected scene element. For the initial irradiation intensity parameter, if the adjustment direction is increase, the preliminary corrected irradiation intensity is added by the product of the adjustment amplitude coefficient and the basic irradiation intensity; if the adjustment direction is decrease, the product is subtracted. For the initial irradiation range parameter, the change amount of the irradiation range is calculated according to the adjustment direction (expansion or contraction) and the adjustment amplitude coefficient, for example, the adjustment amplitude coefficient is multiplied by the basic irradiation range to obtain the change amount, which is added (expanded) or subtracted (contracted) from the preliminary corrected irradiation range. The adjustment of the initial color attribute parameter is that the preliminary corrected color attribute is offset within the dominant color range according to the adjustment direction (towards a certain color) and the adjustment amplitude coefficient, the greater the adjustment amplitude coefficient, the greater the offset. The adjustment of the initial contrast parameter is similar, the preliminary corrected contrast is increased or decreased according to the adjustment direction and the adjustment amplitude coefficient. The initial shadow softness parameter is adjusted according to the adjustment direction and the adjustment amplitude coefficient on the basis of the atmosphere type reference shadow softness parameter, to obtain the final initial light and shadow parameter.
[0054] Step S138: Integrate the identification information and corresponding initial light and shadow parameter of all affected scene elements to generate an initial light and shadow rendering scheme, which also contains parameter adjustment basis description, which specifies the light and shadow dynamic response rule item corresponding to each initial light and shadow parameter adjustment and scene element light and shadow association graph node reference.
[0055] The identification information and corresponding initial light and shadow parameter of all affected scene elements are integrated and arranged in order of type and level of the scene elements. A parameter record is created for each affected scene element, including element identification, initial irradiation intensity parameter, initial irradiation range parameter, initial color attribute parameter, initial contrast parameter, and initial shadow softness parameter. At the same time, parameter adjustment basis description is generated, which specifies the light and shadow dynamic response rule item number corresponding to each initial light and shadow parameter adjustment, and the node identification referenced in the scene element light and shadow association graph, for example, the irradiation intensity adjustment of a certain element is based on the Xth rule in the rule set, which references the association relationship between node A and node B in the graph. The above information is combined to form a complete initial light and shadow rendering scheme.
[0056] Step S140: Based on the scene element light shadow correlation graph, the interaction influence between the light shadow effects corresponding to each scene element in the initial light shadow rendering scheme is analyzed, including direct light shadow interference and indirect light shadow interference, to obtain a light shadow interaction influence result, which includes an interference source identifier, a disturbed element identifier, and an interference transmission path.
[0057] Based on the scene element light shadow correlation graph, the interaction influence between the light shadow effects corresponding to each scene element in the initial light shadow rendering scheme is analyzed. The interaction influence includes two types of direct light shadow interference and indirect light shadow interference. The direct light shadow interference is the interference generated by the direct action of the light shadow effect of one scene element on another element, and the indirect light shadow interference is the interference generated after transmission through an intermediate element. By analyzing these interferences, the interference source, the disturbed element, and the interference transmission path are determined to form a light shadow interaction influence result.
[0058] Step S141: Extract the initial light shadow parameters corresponding to each affected scene element from the initial light shadow rendering scheme, and simulate to generate the initial light shadow effect of each affected scene element in the current frame scene according to the initial light shadow parameters, including the distribution range, intensity decay law, and color change trend of the light shadow emitted or reflected by the affected scene element in space.
[0059] The initial light shadow parameters corresponding to each affected scene element are extracted from the initial light shadow rendering scheme, including initial illumination intensity, initial illumination range, initial color attribute, etc. According to these initial light shadow parameters, the initial light shadow effect of each affected scene element is simulated using light shadow simulation algorithms. For the affected scene elements that emit light themselves (such as lamps), the distribution range of the light shadow emitted by them in space is simulated, which is determined according to the initial illumination range parameter and presented as a specific shape region centered on the light source. The intensity decay law is calculated according to the initial illumination intensity and the distance from the light source. The farther the distance, the more the intensity decays, and the decay law conforms to a specific physical model. The color change trend is simulated according to the initial color attribute parameter and the interaction with air or other media during light propagation, which may have slight color shift. For the affected scene elements that do not emit light but reflect light (such as furniture and character costumes), the reflected light shadow effect is simulated, and the distribution range, intensity decay, and color change of the reflection are determined according to the reflection characteristic parameters and the parameters of the incident light shadow.
[0060] Step S142: Based on the scene element light shadow association graph, find the corresponding associated scene elements of each affected scene element. The associated scene elements refer to the scene elements that have a light shadow association relationship with the affected scene element. According to the light shadow association degree from high to low, a list of associated scene elements is obtained, and the light shadow propagation path information between the associated scene elements is extracted, including the path unobstructed state and the occlusion element identifier.
[0061] Based on the scene element light shadow association graph, find the corresponding associated scene elements of each affected scene element. The associated scene elements refer to the scene elements that have a light shadow association relationship with the affected scene element. In the finding process, the affected scene element is taken as the center node, and all nodes connected to the node through the connection edge in the graph are traversed. These nodes are the associated scene elements. Then, according to the light shadow association degree attribute on the connection edge, the associated scene elements are sorted from high to low to form a list of associated scene elements. At the same time, the light shadow propagation path information between each associated scene element and the affected scene element is extracted, including the unobstructed state of the path (unobstructed or obstructed) and the occlusion element identifier. The above information is stored together with the list of associated scene elements for subsequent light shadow interference analysis.
[0062] Step S143: Analyze the direct light shadow interference of the initial light shadow effect of each affected scene element on its associated scene elements. The direct light shadow interference refers to the interference caused by the direct action of the light shadow of the affected scene element on the associated scene elements. The direct light shadow interference specifically includes the intensity change, color change, contrast change and shadow shape change of the original light shadow effect of the associated scene elements caused by the initial light shadow effect. For each change, record the specific performance and impact range.
[0063] The direct light and shadow interference of the initial light and shadow effect of each affected scene element on its associated scene element is analyzed. For each affected scene element, the elements in its associated scene element list are checked in turn. When the initial light and shadow effect of the affected scene element directly acts on the associated scene element, it causes the original light and shadow effect of the associated scene element to change. The intensity change is manifested as an increase or decrease in the light intensity received by the associated scene element, for example, the affected scene element is a light emitting lamp, and its initial light and shadow effect irradiates the associated seat, causing the light intensity of the seat to increase. The color change is manifested as the color of the associated scene element changing due to the color attribute of the incident light and shadow, for example, a red light source irradiates a white seat, causing the surface of the seat to present a red tone. The contrast change is manifested as an increase or decrease in the difference between the bright part and the dark part of the associated scene element, for example, strong light irradiation makes the bright part of the associated element brighter and the dark part darker, resulting in an increase in contrast. The shadow morphology change is manifested as the shadow of the associated scene element changing in shape, size or edge definition due to the change in direction and intensity of the incident light and shadow. For each change, the specific performance of the change is recorded, such as the percentage of intensity increase, the specific color value of color change, the numerical value of contrast change, and the specific description of shadow morphology change, and the range of change influence, i.e. the affected area on the associated scene element.
[0064] Step S144: According to the hierarchical relationship and light and shadow propagation path in the scene element light and shadow association graph, indirect light and shadow interference is analyzed, which refers to the interference generated by the light and shadow of the affected scene element acting on the intermediate scene element first and then being transmitted to the target associated scene element through the intermediate scene element. The intermediate scene element is first determined, then the effect of the initial light and shadow effect on the intermediate scene element is simulated, and then the light and shadow influence of the target associated scene element is analyzed, and the transmission path of the indirect interference, the interference change of each transmission node and the light and shadow change of the final target associated scene element are recorded.
[0065] According to the hierarchical relationship and light and shadow propagation path in the light and shadow association graph of the scene elements, indirect light and shadow interference is analyzed. First, intermediate scene elements are determined, which are scene elements located between the affected scene elements and the target associated scene elements and having light and shadow association relationship with both. By querying the light and shadow association graph of the scene elements, the associated scene elements of the affected scene elements are found, and then the elements having association relationship with other associated scene elements are found from the associated scene elements, which are the intermediate scene elements. Then, the effect of the initial light and shadow on the intermediate scene elements is simulated, and the process is similar to the analysis of direct light and shadow interference, the irradiation intensity change, color mixing result and the like of the intermediate scene elements are calculated. Then, the light and shadow effect of the intermediate scene elements after being affected is taken as a new light and shadow source, the light and shadow influence of the intermediate scene elements on the target associated scene elements (i.e. the elements having association relationship with the intermediate scene elements and not the initial affected scene elements) is analyzed, and the change of the light and shadow parameters of the target associated scene elements is also calculated. The transmission path of the indirect interference is recorded, i.e. the element identification sequence of the affected scene elements→the intermediate scene elements→the target associated scene elements; the interference change of each transmission node (the intermediate scene elements) is recorded, such as the light and shadow parameter change of the intermediate scene elements; and the light and shadow change of the final target associated scene elements is recorded, such as the specific change of the irradiation intensity, color and the like.
[0066] Step S145: For each light and shadow interference, the interference degree is calculated, which is used to quantify the severity of the light and shadow interference. In the calculation process, the interference sensitivity is first determined according to the light and shadow attributes of the associated scene elements, different associated scene elements have different interference sensitivity to the light and shadow change, and the interference sensitivity of the core scene elements is higher than that of the background scene elements. Then, the interference degree value is obtained according to the product of the amplitude of the light and shadow change and the interference sensitivity, and the higher the interference degree value, the more serious the light and shadow interference.
[0067] For each light and shadow interference (including direct light and shadow interference and indirect light and shadow interference), the interference degree is calculated. First, the interference sensitivity is determined according to the light and shadow properties of the associated scene elements, which is the sensitivity of the associated scene elements to light and shadow changes, and the interference sensitivity of different types and levels of associated scene elements is different. The interference sensitivity of the core scene elements is set to the highest because they are the visual focus; the secondary scene elements are next; and the background scene elements are the lowest. At the same time, the material characteristics of the associated scene elements are considered, for example, the interference sensitivity of elements with high light-reflecting materials is higher than that of elements with low light-reflecting materials. The interference sensitivity is represented by a specific numerical range, and the numerical range of the interference sensitivity of the core scene elements is higher than that of the secondary and background scene elements. Then, the magnitude of the light and shadow change is calculated. For illumination intensity change, the magnitude is the ratio of the absolute value of the illumination intensity change to the reference illumination intensity; for color change, the magnitude is the difference value of the mixed color (such as the square root of the sum of the square of the RGB channel difference); for contrast change, the magnitude is the ratio of the absolute value of the contrast change to the reference contrast; for shadow change, the magnitude is the comprehensive evaluation index of the shadow form change (such as the area change rate, edge definition change, etc.). The total light and shadow change magnitude is obtained by weighted sum of each light and shadow change magnitude, and the weight is set according to the influence degree of each change on the visual effect. Finally, the total light and shadow change magnitude is multiplied by the interference sensitivity to obtain the interference degree value, and the higher the interference degree value, the more serious the influence of the light and shadow interference on the associated scene elements.
[0068] Step S146: record the interference source identifier, the interfered element identifier, the interference type, the interference transmission path, the interference specific performance and the interference degree value corresponding to each light and shadow interference.
[0069] The detailed information of each light and shadow interference is recorded, including the interference source identifier, i.e. the identifier of the affected scene element that generates the light and shadow interference; the interfered element identifier, i.e. the identifier of the associated scene element that is interfered; the interference type, marked as direct light and shadow interference or indirect light and shadow interference; the interference transmission path, for direct interference, the direct path from the interference source to the interfered element, for indirect interference, the path sequence containing intermediate elements; the interference specific performance, i.e. the specific change description recorded before, such as illumination intensity change, color mixing result, etc.; the interference degree value, i.e. the quantitative interference degree value calculated. The above information is stored in a structured record, and each record corresponds to one light and shadow interference.
[0070] Step S147: classify and arrange all light and shadow interference records, sort them from high to low according to the interference degree value, and group them according to the level identifier of the interfered element. The light and shadow interference records corresponding to the core scene elements are prioritized, and the light and shadow interaction influence result is generated, which also contains the scene element light and shadow association graph nodes referenced by the interference analysis and the initial light and shadow effect simulation basis.
[0071] All light and shadow interference records are sorted and arranged. First, the records are sorted in descending order of interference degree value, so that serious interference is placed first. Then, the records are grouped according to the hierarchical identification of the interfered elements, and the interference records of the core scene elements are grouped into one group, the interference records of the secondary scene elements are grouped into one group, and the interference records of the background scene elements are grouped into one group. In sorting, the light and shadow interference records corresponding to the core scene elements are given priority over other hierarchical records, that is, when the interference degree value of the core scene elements is similar to that of the secondary or background elements, the records of the core scene elements are placed first. Finally, a light and shadow interaction influence result is generated, which includes the sorted and grouped light and shadow interference records, as well as the scene element light and shadow association graph node identification (such as the involved element nodes and connection edges) cited in the interference analysis process and the initial light and shadow effect simulation basis (such as the used light and shadow simulation algorithm version, parameter setting, etc.).
[0072] Step S150: According to the light and shadow interaction influence result, the light and shadow parameters in the initial light and shadow rendering scheme are optimized by using a multi-round iterative adjustment method to generate a final light and shadow rendering scheme, and the final light and shadow rendering scheme is applied to the rendering processing of the current frame of the animation scene.
[0073] According to the light and shadow interaction influence result, the light and shadow parameters in the initial light and shadow rendering scheme are optimized by using a multi-round iterative adjustment method to reduce or eliminate light and shadow interference, to generate a final light and shadow rendering scheme, and to apply the scheme to the rendering processing of the current frame of the animation scene, to obtain a current frame image that meets the expected light and shadow effect.
[0074] Step S151: Analyze the light and shadow interaction influence result, extract all light and shadow interference records, sort them in descending order of interference degree value, and group them according to the hierarchical identification of the interfered elements. The light and shadow interference records corresponding to the core scene elements are given the first priority, the light and shadow interference records corresponding to the secondary scene elements are given the second priority, and the light and shadow interference records corresponding to the background scene elements are given the third priority. The first round of adjustment is determined to be the first priority of the first N light and shadow interference records with the highest interference degree value, and the value of N is set according to the complexity of the scene.
[0075] The light and shadow interaction result is analyzed, and the light and shadow interaction result is stored in a structured format, including all light and shadow interference records and related reference information. All light and shadow interference records are extracted, sorted in descending order of interference degree value, and a preliminary sorted list is obtained. Then, the sorted records are grouped according to the level identification of the interfered elements. The light and shadow interference records corresponding to the core scene elements are the first priority group, the secondary scene elements are the second priority group, and the background scene elements are the third priority group. Within each group, the records remain in order from high to low according to the interference degree value. The interference objects of the first round of adjustment are determined by selecting the top N light and shadow interference records with the highest interference degree value from the first priority group. The value of N is set according to the complexity of the scene. When the number of elements in the scene is large and the light and shadow relationship is complex, the value of N can be set larger to handle more serious interference; when the scene is simple, the value of N can be smaller.
[0076] Step S152: For each light and shadow interference record of the first round of adjustment, determine the interference source and the corresponding initial light and shadow parameters, analyze the specific parameter items in the initial light and shadow parameters that cause light and shadow interference, and determine the adjustment direction of the parameter items based on the interference degree value.
[0077] For each light and shadow interference record of the first round of adjustment, the interference source is first determined, i.e., the interference source identification in the record corresponds to the affected scene element. Then, the initial light and shadow parameters corresponding to the interference source are extracted from the initial light and shadow rendering scheme. Analyze the specific parameter items in these initial light and shadow parameters that cause light and shadow interference, for example, if the interference is caused by too high illumination intensity causing the interfered element to be too bright, the parameter item causing the interference is the initial illumination intensity; if the interference is caused by color deviation, the parameter item is the initial color attribute. The adjustment direction of the parameter item is determined based on the interference degree value. The higher the interference degree value, the more explicit the adjustment direction, for example, the adjustment direction for interference caused by too high illumination intensity is to reduce the initial illumination intensity; the adjustment direction for interference caused by red color deviation is to reduce the value of the red channel.
[0078] Step S153: Determine the adjustment amplitude of the parameter item according to the mapping relationship between the interference degree value and the parameter adjustment amplitude, which is established through pre-scene testing. The higher the interference degree value, the larger the adjustment amplitude. The adjustment amplitude does not exceed the range of the current atmosphere type reference light and shadow characteristics.
[0079] According to the mapping relationship between the interference degree value and the parameter adjustment amplitude, the adjustment amplitude of the parameter item is determined. The mapping relationship is established through pre-scene testing. When testing, the improvement effect of the parameter adjustment amplitude on the interference under different interference degree values is simulated, so as to determine the functional relationship between the two. Generally speaking, the higher the interference degree value, the larger the parameter adjustment amplitude, that is, the larger the adjustment amount. At the same time, the adjustment amplitude is limited by the reference light and shadow feature range of the current atmosphere type, for example, the adjustment amplitude of the initial irradiation intensity cannot make the adjusted irradiation intensity exceed the overall illumination intensity range of the current atmosphere type, so as to ensure that the adjusted light and shadow effect still meets the atmosphere requirements.
[0080] Step S154: Based on the determined adjustment direction and adjustment amplitude, the target parameter item in the initial light and shadow parameter of the interference source is adjusted to obtain the first round of adjusted light and shadow parameter, and the parameter values before and after adjustment, adjustment basis are recorded.
[0081] Based on the determined adjustment direction and adjustment amplitude, the target parameter item in the initial light and shadow parameter of the interference source is adjusted. For example, the target parameter item is the initial irradiation intensity, the adjustment direction is to reduce, and the adjustment amplitude is a specific value, then the initial irradiation intensity is reduced by the adjustment amplitude to obtain the adjusted irradiation intensity. For color attribute parameters, if the adjustment direction is to reduce the red channel value, and the adjustment amplitude is a specific value, then the red channel value is reduced by the adjustment amplitude. After adjustment, the parameter values before and after adjustment are recorded, such as the initial irradiation intensity before adjustment and the adjusted irradiation intensity; the adjustment basis is recorded, including the corresponding light and shadow interference record identifier, the interference degree value, the reference of the mapping relationship, etc.
[0082] Step S155: The first round of adjusted light and shadow parameter is substituted into the scene light and shadow effect simulation model, the light and shadow effect of the interference source is simulated again, the interference degree of the light and shadow effect on the original associated scene element is analyzed, if the adjusted interference degree value is lower than the preset interference threshold, the parameter adjustment of the interference source is completed; if the adjusted interference degree value is still higher than the preset interference threshold, the above adjustment step is repeated, and the repeating process continues until the interference degree value is lower than the preset interference threshold or the preset iteration number is reached. The preset iteration number is set according to the rendering efficiency requirement.
[0083] The first round of adjusted light and shadow parameters are substituted into the scene light and shadow effect simulation model, which is the same as the model used to simulate the initial light and shadow effect. The light and shadow effect of the interference source is simulated again, and the interference degree of the new light and shadow effect on the original associated scene elements (i.e. the disturbed elements in the light and shadow interference record) is analyzed. The calculation method is the same as before. A preset interference threshold is set according to the acceptable light and shadow interference degree. If the adjusted interference degree value is lower than the interference threshold, it is considered that the parameter adjustment of the interference source is complete. If it is still higher than the interference threshold, the adjustment process of steps S152 to S154 is repeated, that is, the parameter items are reanalyzed, the adjustment direction and amplitude are determined, and the adjustment is performed until the interference degree value is lower than the threshold or the preset iteration number is reached. The preset iteration number is set according to the rendering efficiency requirement. Too many times will increase the rendering time, and too few times may not be able to optimize sufficiently, so a balance between effect and efficiency needs to be struck.
[0084] Step S156: After completing the first round of adjustment, enter the second round of adjustment. The first M light and shadow interference records with the highest interference degree value in the second priority group (light and shadow interference records corresponding to secondary scene elements) are taken as the adjustment object. The value of M is set according to the remaining scene complexity. If the remaining interference is small and the scene complexity is reduced after the first round of adjustment, the value of M can be less than N. The same adjustment logic as the first round is used, that is, the interference source and parameters are determined, the adjustment direction and amplitude are analyzed, the adjustment is performed, and the effect is simulated and the interference degree is checked until the adjustment of the above M records is completed.
[0085] After completing the first round of adjustment, enter the second round of adjustment. The first M light and shadow interference records with the highest interference degree value in the second priority group (light and shadow interference records corresponding to secondary scene elements) are taken as the adjustment object. The value of M is set according to the remaining scene complexity. If the remaining interference is small and the scene complexity is reduced after the first round of adjustment, the value of M can be less than N. The same adjustment logic as the first round is used, that is, the interference source and parameters are determined, the adjustment direction and amplitude are analyzed, the adjustment is performed, and the effect is simulated and the interference degree is checked until the adjustment of the above M records is completed.
[0086] Step S157: The interference source parameter adjustment of all light and shadow interference records is completed in order according to the priority order. For the light and shadow interference records that still cannot reduce the interference degree value below the preset interference threshold after multiple iterations, it is analyzed whether there is a scene element light and shadow association graph construction deviation. If there is a scene element light and shadow association graph construction deviation, the light and shadow association degree or propagation path information in the scene element light and shadow association graph is corrected, and the interference analysis and parameter adjustment are performed again.
[0087] Adjust the interference source parameters corresponding to all light-shadow interference records in priority order (first priority -> second priority -> third priority). For the light-shadow interference records of the third priority group, the same adjustment method is adopted. During the adjustment process, for the light-shadow interference records that still cannot reduce the interference degree value below the preset interference threshold after multiple rounds of iteration (reach the preset number of iterations), analyze the reasons. One of the possible reasons is that there is a deviation in the construction of the scene element light-shadow association graph, such as inaccurate light-shadow association degree calculation or incorrect propagation path state marking. If it is judged that there is a deviation in the graph construction, the corresponding information in the scene element light-shadow association graph is corrected, such as recalculating the light-shadow association degree, correcting the unobstructed state of the propagation path, or identifying the obstructing elements. After correction, the light-shadow interference analysis (repeat steps S140 to S147) and parameter adjustment (repeat steps S151 to S156) are performed again.
[0088] Step S158: Collect the final light parameters corresponding to all adjusted interference sources. For the affected scene elements not involved in light interference, keep their initial light parameters unchanged.
[0089] Collect the final light parameters corresponding to all adjusted interference sources. These parameters are the light parameters that have been adjusted for multiple rounds of iteration and have an interference degree value below the preset threshold. For the affected scene elements not involved in light interference in the initial light rendering scheme (i.e., the affected elements not appearing in any light interference record), their initial light parameters do not need to be adjusted and remain unchanged.
[0090] Step S159: Integrate all final light parameters of the affected scene elements or the unchanged initial light parameters, and add a parameter adjustment summary table containing the adjustment times, before and after values, adjustment basis, and final interference degree value of each parameter to generate a final light rendering scheme. The final light rendering scheme also includes key simulation result screenshot reference identifiers in the iteration adjustment process.
[0091] Integrate all final light parameters of the affected scene elements (adjusted) or the unchanged initial light parameters, arrange them according to the same structure as the initial light rendering scheme, and include element identifiers and various light parameters. At the same time, add a parameter adjustment summary table that records the adjustment times (iteration times), initial value before adjustment, final value after adjustment, adjustment basis (such as corresponding light interference record identifier, adjustment round), and final interference degree value for each adjusted parameter item (unadjusted parameter items do not need to be included). Combine the above information to generate a final light rendering scheme. In addition, add key simulation result screenshot reference identifiers in the iteration adjustment process to the scheme. These screenshots record important changes in light effects during the adjustment process, and through the reference identifier, they can be linked to specific screenshot files.
[0092] For example, step S1510: analyze the final light shadow rendering scheme, extract the final light shadow parameters of each affected scene element, the extracted final light shadow parameters include illumination intensity, color attribute, contrast, shadow parameter and associated scene element identifier, and extract the parameter adjustment summary table and iteration adjustment basis in the final light shadow rendering scheme.
[0093] Analyze the final light shadow rendering scheme, which is stored in a structured format. Extract the final light shadow parameters of each affected scene element, including illumination intensity, color attribute, contrast, shadow parameter (such as shadow softness, shadow range, etc.) and associated scene element identifier, to ensure that each parameter is correctly associated with the element. At the same time, extract the parameter adjustment summary table in the scheme, which contains detailed historical information of parameter adjustment; extract the iteration adjustment basis, including the light shadow interaction effect result identifier cited in the adjustment process, scene element light shadow association graph correction record, etc.
[0094] Step S1511: import the scene model data of the current frame of the animation scene into the rendering engine, which contains the geometric model, material information and initial position information of all scene elements.
[0095] Import the scene model data of the current frame of the animation scene into the rendering engine, which is stored in a specific three-dimensional model format and contains the geometric model of all scene elements in the scene. The geometric model is composed of vertex, edge and face geometric information, which describes the shape of the element. Material information includes element surface material properties such as diffuse color, specular reflection coefficient and roughness, which affect the reflection and absorption of light and shadow. Initial position information includes the initial coordinates of each element in the rendering engine coordinate system, which is consistent with the spatial coordinates analyzed earlier. The rendering engine loads these data and constructs a three-dimensional model representation of the scene in memory.
[0096] Step S1512: according to the scene element identifier, bind the final light shadow parameters with the corresponding scene elements in the rendering engine, match the dimensions of the light shadow parameters with the parameter interface of the rendering engine during the binding process, and convert the RGB value of the color attribute to the color space format supported by the rendering engine.
[0097] According to the scene element identification, the extracted final light shadow parameter is bound to the corresponding scene element loaded in the rendering engine. The binding process is implemented through the API provided by the rendering engine, and the identification of each scene element is associated with the element object in the rendering engine, and then the final light shadow parameter is assigned to the corresponding light shadow attribute of the element object. In the binding process, it is ensured that the dimension of the light shadow parameter matches the parameter interface of the rendering engine, for example, the illumination intensity parameter interface of the rendering engine is a specific range of floating point type values, then the final illumination intensity parameter is converted to a value within the range. The RGB value of the color attribute needs to be converted to the color space format supported by the rendering engine, such as from standard RGB to linear RGB or other color space used by the rendering engine, and the conversion process follows the standard algorithm of color space conversion.
[0098] Step S1513: For the core scene element, the final light shadow parameter is loaded preferentially, and the rendering priority of the core scene element is set to the highest; for the building components and natural landscape elements in the scene static structure element, according to the illumination range and light shadow propagation path in the final light shadow parameter, the light shadow projection direction and projection range are set in the rendering engine, and if there is a shielding scene element, the shielding relationship is marked in the rendering engine; for the scene dynamic role element, according to the action posture association information in the final light shadow parameter, the reflection effect of light shadow on the surface of the scene dynamic role element is adjusted, the light intensity at the bending part of the body of the scene dynamic role element is attenuated according to the reflection characteristic parameter, and the light contrast of the facial expression change area of the scene dynamic role element is enhanced according to the parameter adjustment value.
[0099] For the core scene element, the final light shadow parameter is loaded preferentially in the rendering engine to ensure that the light shadow effect of the core element is correctly set first. At the same time, the rendering priority of the core scene element is set to the highest, so that the rendering engine processes these elements first when rendering the scene, ensuring that the light shadow effect of the visual focus is accurately presented.
[0100] For the building components and natural landscape elements (if any) in the scene static structure element, according to the illumination range and light shadow propagation path in the final light shadow parameter, the light shadow projection direction and projection range are set in the rendering engine. The light shadow projection direction is calculated according to the position of the light source and the position of the target element, and the projection range is set according to the final illumination range parameter. If there is a shielding scene element, the shielding relationship is marked in the rendering engine, and the light shadow is correctly shielded in the propagation process by enabling the occlusion culling function of the rendering engine or manually setting the occlusion body.
[0101] For scene dynamic role elements, according to the action posture correlation information (such as limb angle, joint position) in the final light and shadow parameters, the reflection effect of light and shadow on the surface thereof is adjusted. For the bending part of the limbs (such as the elbow and the knee), according to the diffuse reflection ratio and the specular reflection ratio in the reflection characteristic parameters, the light and shadow intensity is attenuated, the greater the bending angle, the more the attenuation, and the real light and shadow reflection effect is simulated. For the facial expression change area (such as the corners of the mouth and the eyebrows), according to the parameter adjustment value, the light and shadow contrast is enhanced, the expression change is more obvious, and the expressiveness of the role is enhanced.
[0102] Step S1514: loading the global illumination parameters corresponding to the scene atmosphere type of the current frame, the global illumination parameters including the ambient light intensity, the ambient light color and the main light source parameters, fusing the final light and shadow parameters and the global illumination parameters, in the fusion process, the final light and shadow parameters are given priority, and the global illumination parameters are auxiliary.
[0103] The global illumination parameters corresponding to the scene atmosphere type of the current frame are loaded, the parameters are determined when the atmosphere type is defined, including the ambient light intensity, the ambient light color and the main light source parameters (such as the main light source direction, the intensity and the color). The final light and shadow parameters and the global illumination parameters are fused, in the fusion process, the final light and shadow parameters are given priority, and the global illumination parameters are auxiliary, that is, the final light and shadow parameters are given priority, and the global illumination parameters are used to supplement the areas not covered by the final light and shadow parameters or adjust the overall light and shadow keynote in the scene. For example, the ambient light intensity is superimposed on the illumination intensity of each element, but the weight is small; the main light source parameters affect the overall shadow direction and intensity of the scene, and are used in combination with the final shadow parameters of the elements.
[0104] Step S1515: executing the light and shadow calculation process of the rendering engine, the light and shadow calculation process including ray tracing calculation, shadow generation calculation, color mixing calculation and light and shadow attenuation calculation, in the calculation process, the iterative adjustment basis in the final light and shadow rendering scheme is referenced, and thus the rendering result image of the current frame is generated.
[0105] The light and shadow calculation process of the rendering engine is executed, and the light and shadow calculation process includes multiple calculation steps. The ray tracing calculation simulates the process that the light ray starts from the light source, intersects with the surface of the scene element, reflects and refracts, and calculates the color value of each pixel point; the shadow generation calculation generates the shadow according to the light source position, the element geometry and the occlusion relationship; the color mixing calculation mixes the light source color and the element material color to obtain the final pixel color; and the light and shadow attenuation calculation calculates the attenuation of the light intensity according to the distance and the medium characteristics. In the calculation process, the iterative adjustment basis in the final light and shadow rendering scheme is referenced, such as the adjustment value in the parameter adjustment summary table, so that the optimized light and shadow parameters are used in the calculation. After the calculation is completed, the rendering engine generates the rendering result image of the current frame, and the rendering result image includes the optimized light and shadow effect of all scene elements.
[0106] Step S1516: Record the key data in the rendering process, store the key data in association with the final light and shadow rendering scheme, the inter-frame light and shadow coherence analysis report, form the complete rendering archive of the current frame, the key data includes rendering time consumption, rendering engine parameter setting and storage path of rendering result image.
[0107] Record the key data in the rendering process, including rendering time consumption (the time from starting rendering to generating image), rendering engine parameter setting (such as light tracing precision, sampling rate, etc.) and storage path of rendering result image (location in file system). Store the above key data in association with the final light and shadow rendering scheme and the subsequently generated inter-frame light and shadow coherence analysis report. The association is realized through the common current frame identifier. The above data collectively form the complete rendering archive of the current frame, facilitating subsequent review, modification or backtracking of the rendering process.
[0108] Step S160: Extract the key light and shadow parameters in the final light and shadow rendering scheme of the current frame, perform coherence analysis on the corresponding key light and shadow parameters in the rendering scheme of the previous frame, and generate inter-frame light and shadow transition parameters, which are used for smooth connection of light and shadow in the next frame rendering.
[0109] Extract the key light and shadow parameters in the final light and shadow rendering scheme of the current frame, perform coherence analysis on the corresponding key light and shadow parameters in the rendering scheme of the previous frame, and check whether the parameter change is smooth. If the change is too large, it may cause inter-frame light and shadow jumping, affecting the visual experience. According to the analysis result, generate inter-frame light and shadow transition parameters, which are used to guide the adjustment of light and shadow parameters in the next frame rendering, so that the light and shadow effect of the next frame smoothly connects with the current frame, avoiding abrupt changes.
[0110] Step S161: Define the types of key light and shadow parameters, including the illumination intensity of core scene elements, the color attribute of core scene elements, the overall contrast of the scene, the direction parameter of the main light source of the scene and the softness of core shadows.
[0111] Define the types of key light and shadow parameters, which are the parameters that have the greatest impact on visual effects and are most likely to change significantly between frames. The illumination intensity of core scene elements directly affects the brightness of the visual focus; the color attribute of core scene elements affects the color performance of the visual focus; the overall contrast of the scene affects the sense of hierarchy of the picture; the direction parameter of the main light source of the scene affects the direction of the shadow and the overall light and shadow layout; the softness of core shadows affects the visual texture of the shadow. Defining the above parameters as key light and shadow parameters facilitates the analysis of their inter-frame coherence.
[0112] Step S162: Extract the current values of each key light and shadow parameter from the final light and shadow rendering scheme of the current frame, and record the specific numerical value of each key light and shadow parameter, the corresponding scene element identifier and the parameter effective timestamp.
[0113] Extract the current value of each key light parameter from the final light rendering scheme of the current frame, such as the current illumination intensity value of the core scene element, the RGB value of the current color attribute, etc. Record the specific value of each key light parameter, ensuring accuracy to a certain number of decimal places; record the corresponding scene element identifier, such as the illumination intensity of which core scene element; record the parameter effective timestamp, i.e. the rendering time or frame number of the current frame, for time association with the previous frame.
[0114] Step S163: Extract the historical value of the same type of key light parameter from the previous frame rendering scheme, record the historical value of each key light parameter, the corresponding scene element identifier and the historical effective timestamp.
[0115] Extract the historical value of the same type of key light parameter from the previous frame rendering scheme, the extraction process is similar to the current frame, get the historical illumination intensity, historical color attribute, etc. Record the historical value of each key light parameter, the corresponding scene element identifier (which needs to be consistent with the element identifier of the current frame to ensure that it is the parameter of the same element) and the historical effective timestamp (the time or frame number of the previous frame).
[0116] Step S164: Calculate the parameter difference value of each key light parameter current value and historical value, the parameter difference value is calculated by the difference between the current value and the historical value. For color attribute parameters, calculate the parameter difference value for each of the RGB channels.
[0117] Calculate the parameter difference value of each key light parameter current value and historical value. For numerical parameters (such as illumination intensity, contrast, shadow softness), the parameter difference value is the current value minus the historical value. For color attribute parameters, calculate the parameter difference value for each of the RGB channels, i.e. the current red channel value minus the historical red channel value, the current green channel value minus the historical green channel value, and the current blue channel value minus the historical blue channel value, to get the difference value of the three channels. For the direction parameter of the main light source, if represented as an angle, the parameter difference value is the current angle minus the historical angle; if represented as a vector, calculate the difference value of each component by vector subtraction.
[0118] Step S165: Compare the parameter difference value of each key light parameter with the corresponding maximum allowed difference threshold value. If the absolute value of the parameter difference value is less than or equal to the maximum allowed difference threshold value, no transition parameter is generated; if the absolute value of the parameter difference value is greater than the maximum allowed difference threshold value, a transition parameter is generated.
[0119] A maximum allowed difference threshold corresponding to each key light and shadow parameter is set according to the sensitivity of the human eye to light and shadow changes, and changes exceeding the maximum allowed difference threshold will be obviously perceived as flickering. The parameter difference of each key light and shadow parameter is compared with the corresponding maximum allowed difference threshold. If the absolute value of the parameter difference is less than or equal to the maximum allowed difference threshold, the change is within an acceptable range, and no transition parameter needs to be generated; if it is greater than the maximum allowed difference threshold, a transition parameter needs to be generated to smooth the change.
[0120] Step S166: For the key light and shadow parameter that needs to generate a transition parameter, the parameter transition rate is calculated according to the frame interval number between the current frame and the previous frame. The parameter transition rate is calculated by the ratio of the parameter difference to the frame interval number. When the frame interval number is greater than 1, the parameter transition rate is calculated by the ratio of the parameter difference to the frame skipping number.
[0121] For the key light and shadow parameter that needs to generate a transition parameter, the parameter transition rate is calculated. The frame interval number is the frame number difference between the current frame and the previous frame, which is normally 1 (continuous frame). The parameter transition rate is the ratio of the parameter difference to the frame interval number, that is, the parameter adjustment amount per frame, which makes the parameter smoothly transition from the historical value to the current value within the frame interval number. When the frame interval number is greater than 1 (such as frame skipping), the frame skipping number is the frame interval number, and the parameter transition rate is also the ratio of the parameter difference to the frame skipping number, ensuring smooth transition in the case of frame skipping.
[0122] Step S167: Based on the parameter transition rate, generate the inter-frame light and shadow transition parameter, which includes the transition parameter type, the transition starting value, the transition target value, the transition rate, the transition frame number, and the transition effective scene element identifier. For color attribute parameters, generate the transition rate and the transition parameter for each channel of RGB respectively. For the scene main light source direction parameter, the inter-frame light and shadow transition parameter further includes an angle increment of direction change, which is calculated by the ratio of the difference between the current direction angle and the historical direction angle to the transition frame number.
[0123] Based on the parameter transition rate, generate the inter-frame light and shadow transition parameter. The transition parameter type indicates which key light and shadow parameter is transitioned; the transition starting value is the historical value of the previous frame; the transition target value is the current value of the current frame; the transition rate is the calculated adjustment amount per frame; the transition frame number is the frame interval number; and the transition effective scene element identifier is the scene element identifier corresponding to the key light and shadow parameter.
[0124] For color attribute parameters, since the parameter difference is calculated for each channel of RGB, the transition rate and the transition parameter are generated for each channel to ensure that the color components of each channel can smoothly transition.
[0125] For the scene main light source direction parameter, if the direction is represented by an angle, the inter-frame light transition parameter further comprises an angle increment of the direction change, which is calculated by the difference between the current direction angle and the historical direction angle divided by the number of transition frames, i.e. the angle of the direction change per frame, so as to make the light source direction rotate smoothly.
[0126] Step S168: integrate the continuity analysis results of all key light parameters, parameter differences, maximum allowed difference thresholds, and inter-frame light transition parameters corresponding to the transition parameters to be generated, to generate an inter-frame light continuity analysis report, wherein the inter-frame light transition parameters are the core content of the inter-frame light continuity analysis report, and are used to adjust the initial values of the key light parameters according to the inter-frame light transition parameters before performing the subsequent initial rendering scheme generation step when rendering the next frame.
[0127] Integrate the continuity analysis results of all key light parameters (including the judgment results of whether to generate transition parameters), parameter differences, maximum allowed difference thresholds, and inter-frame light transition parameters corresponding to the transition parameters to be generated, to generate an inter-frame light continuity analysis report, which is stored in the form of a document, and the inter-frame light transition parameters are the core content of the report. When rendering the next frame, first adjust the initial values of the key light parameters according to the inter-frame light transition parameters in the report, for example, set the transition starting value to the current value of the previous frame, gradually adjust to the transition target value according to the transition rate and the number of transition frames, and then perform the subsequent initial light rendering scheme generation step to ensure that the light effect of the next frame is smoothly connected with the current frame.
[0128] For example, the method further comprises: step S170: extracting the initial light parameters of each scene element and the reference light features of the current atmosphere type from the initial light rendering scheme; selecting representative test scene elements in the animation scene, wherein the test scene elements include at least one of core scene elements, secondary scene elements, and background scene elements; based on the initial light parameters of the test scene elements, performing local light effect simulation in the rendering engine to generate a local rendering image of the test scene elements, wherein the local rendering image only contains the test scene elements and the scene elements directly associated therewith.
[0129] The initial light and shadow parameters of each scene element and the reference light and shadow characteristics of the current atmosphere type are extracted from the initial light and shadow rendering scheme, and these data are the basis for simulating local light and shadow effects. Select representative test scene elements in the animation scene. In order to comprehensively evaluate the initial light and shadow rendering scheme, the test scene elements should include at least one core scene element, a secondary scene element and a background scene element, to ensure that elements of different levels can be tested. Based on the initial light and shadow parameters of the selected test scene elements, simulate the local light and shadow effect in the rendering engine. Only load the test scene elements and their directly associated scene elements (determined according to the scene element light and shadow association graph) during simulation to reduce the amount of calculation, generate a local rendering image containing only these elements, and use it for preliminary evaluation of the light and shadow effect.
[0130] Step S171: Analyze the light and shadow effect of the test scene element in the local rendering image, and determine whether the light and shadow effect of the test scene element meets the reference light and shadow characteristics of the current atmosphere type. The specific determination includes whether the illumination intensity of the test scene element is within the reference range, whether the color attribute matches the atmosphere dominant color, and whether the shadow effect meets the atmosphere corresponding shadow softness requirement. If the local rendering image meets the reference characteristics, select more test scene elements to repeat the local simulation and analysis steps; if the local rendering image does not meet the reference characteristics, analyze the reasons, and if the initial light and shadow parameter setting is deviated, adjust the corresponding initial light and shadow parameter; if the atmosphere type identification is wrong, reconfirm the atmosphere type of the current frame.
[0131] Analyze the light and shadow effect of the test scene element in the local rendering image, and compare it with the reference light and shadow characteristics of the current atmosphere type. Specifically, determine whether the illumination intensity of the test scene element is within the reference light intensity range, whether the RGB value of the color attribute is within the dominant color range, and whether the softness of the shadow meets the reference shadow softness parameter. If the local rendering image meets the reference characteristics, it means that the initial light and shadow parameters are set reasonably on the test element, and more test scene elements of other levels are selected to repeat the local simulation and analysis steps to further verify the scheme. If it does not meet the reference characteristics, analyze the reasons. If it is found that the initial light and shadow parameter setting is deviated (such as too high or too low illumination intensity), adjust the initial light and shadow parameter of the corresponding test scene element; if it is found that the atmosphere type identification is wrong (such as the current frame should be a warm atmosphere but is mistakenly identified as a tense atmosphere), reconfirm the atmosphere type of the current frame, and generate the initial light and shadow rendering scheme according to the correct atmosphere type.
[0132] Step S172: After completing the local effect analysis, the overall light and shadow effect of the scene is pre-simulated, the initial light and shadow parameters of all scene elements are imported into the rendering engine, and the overall pre-rendered image of the current frame is generated; the light and shadow distribution uniformity of the overall pre-rendered image is analyzed, the brightness average of different regions in the image is calculated through image analysis tools, and if the brightness average difference is greater than the set difference threshold, the initial light and shadow parameters of the background scene element are adjusted; the light and shadow transition naturalness between scene elements in the overall pre-rendered image is analyzed, whether there is an obvious fault in the light and shadow boundary between the core scene element and the secondary scene element, and the secondary scene element and the background scene element are observed, and if there is a fault, the initial light and shadow parameters of the adjacent scene elements are adjusted to increase the light and shadow parameter correlation of the transition area.
[0133] After completing the local effect analysis and adjusting, the overall light and shadow effect of the scene is pre-simulated. The initial light and shadow parameters of all scene elements are imported into the rendering engine, the complete scene model data is loaded, and the overall pre-rendered image of the current frame is generated, which contains the initial light and shadow effect of all elements in the scene. The light and shadow distribution uniformity of the overall pre-rendered image is analyzed, and the brightness average of different regions (such as the upper left corner, the center, the lower right corner, etc.) in the image is calculated using image analysis tools (such as image analysis plug-ins provided by the rendering engine). A difference threshold is set, and if the brightness average difference of different regions is greater than the threshold, it indicates that the light and shadow distribution is uneven, and the initial light and shadow parameters of the background scene element are adjusted, such as increasing the illumination intensity of the dark area background element or reducing the illumination intensity of the bright area background element, to balance the overall light and shadow distribution. The light and shadow transition naturalness between scene elements is analyzed, and the light and shadow boundary between the core scene element and the secondary scene element, and the secondary scene element and the background scene element is visually observed. If there is an obvious brightness or color mutation (fault), the initial light and shadow parameters of the adjacent scene elements are adjusted, for example, the illumination intensity of the edge of the core element is slowly attenuated and smoothly connected with the illumination intensity of the secondary element, and the light and shadow parameter correlation of the transition area is increased, such as gradually transitioning the color attribute of the transition area from the color of the core element to the color of the secondary element.
[0134] Step S173: The overall pre-rendered image and the final rendered image of the previous frame are analyzed for inter-frame pre-conciseness, the difference value of the key light and shadow parameters of the same scene elements in the two frames is calculated, and if the difference value exceeds the maximum allowed difference threshold, the initial light and shadow parameters are adjusted in advance; based on the results of the local effect analysis, the overall distribution analysis, the transition naturalness analysis, and the inter-frame pre-conciseness analysis, the initial light and shadow parameters in the initial light and shadow rendering scheme are corrected to generate a corrected initial light and shadow rendering scheme; the corrected initial light and shadow rendering scheme and the original initial light and shadow rendering scheme are compared for parameters, the corrected parameter items, the correction basis, and the effect difference description before and after correction are recorded, and an initial scheme correction report is formed.
[0135] The whole pre-rendered image is analyzed for inter-frame pre-coherence with the final rendered image of the previous frame, key light parameters (such as the irradiation intensity, color properties, etc. of the core scene elements) of the same scene elements in the two frames are extracted, and the parameter difference is calculated. If the difference exceeds the previously set maximum allowed difference threshold, it means that there may be a risk of inter-frame light and shadow jumping, and the initial light and shadow parameters of the current frame are adjusted in advance, for example, the key light parameters are adjusted in a certain amount towards the historical value, so that the difference is reduced to within the threshold. According to the results of local effect analysis, overall distribution analysis, transition naturalness analysis and inter-frame pre-coherence analysis, the rationality of each parameter in the initial light and shadow rendering scheme is comprehensively evaluated, the initial light and shadow parameters with problems are corrected, and the corrected initial light and shadow rendering scheme is generated. The corrected scheme and the original initial light and shadow rendering scheme are compared in terms of parameters, each corrected parameter item (such as which element and which light parameter), the correction basis (such as which analysis result), and the effect difference description before and after the correction (such as the description of the brightness change after adjusting the irradiation intensity) are recorded, and the initial scheme correction report is formed. The initial scheme correction report is used as a supplementary document of the initial light and shadow rendering scheme to trace the correction process.
[0136] It should be noted that, in order to simplify the expression of the disclosure of the present application, and to help the understanding of one or more embodiments of the present application, in the foregoing description of the embodiments of the present application, sometimes various features are incorporated into one embodiment, figure or description thereof.
Claims
1. A method for dynamic rendering of lighting and shadows in anime scenes, characterized in that, The method includes: Establish the light and shadow relationship between various scene elements in the animation scene to obtain the scene element light and shadow relationship map. The scene elements include static structural elements and dynamic character elements. The light and shadow relationship is used to describe the relationship between light and shadow of different scene elements. The scene element light and shadow relationship map contains the hierarchical division information of scene elements and the light and shadow relationship weight between different levels. Based on the scene element light and shadow association map, and combined with the possible atmosphere types of the animation scene, a light and shadow dynamic response rule is generated. The light and shadow dynamic response rule is used to define the light and shadow adjustment method corresponding to the change of scene element state and the switching of atmosphere type. Based on the dynamic light and shadow response rules, and combined with the scene element state data and current atmosphere type identifier of the current frame of the animation scene, an initial light and shadow rendering scheme is generated. The scene element state data includes the position distribution information of static structural elements of the scene and the action posture information of dynamic character elements of the scene. The initial light and shadow rendering scheme includes the basic light and shadow parameters and atmosphere adaptation parameters of each scene element. Based on the scene element light and shadow association map, the interaction between the light and shadow effects of each scene element in the initial light and shadow rendering scheme is analyzed, including direct light and shadow interference and indirect light and shadow interference, and the light and shadow interaction influence result is obtained. The light and shadow interaction influence result includes the interference source identifier, the interference element identifier and the interference transmission path. Based on the results of the light and shadow interaction, the light and shadow parameters in the initial light and shadow rendering scheme are optimized by a multi-round iterative adjustment method to generate the final light and shadow rendering scheme, and the final light and shadow rendering scheme is applied to the rendering processing of the current frame of the animation scene. Extract the key lighting and shadow parameters from the final lighting and shadow rendering scheme of the current frame, perform a coherence analysis with the corresponding key lighting and shadow parameters in the rendering scheme of the previous frame, and generate inter-frame lighting and shadow transition parameters. These inter-frame lighting and shadow transition parameters are used for smooth lighting and shadow transition in the next frame rendering.
2. The method for dynamic rendering of light and shadow in anime scenes according to claim 1, characterized in that, The process of establishing the light and shadow relationships between various scene elements in an animation scene to obtain a scene element light and shadow relationship map includes: The scene elements in the animation scene are classified and processed to distinguish between static structural elements and dynamic character elements, and the scene element classification results are obtained. The static structural elements include architectural components, natural landscape elements, and prop elements, while the dynamic character elements include main character elements, secondary character elements, and temporarily appearing character elements. The scene elements in the scene element classification results are hierarchically divided into core scene elements, secondary scene elements, and background scene elements. Core scene elements are the elements corresponding to the visual focus in the picture, secondary scene elements are the elements that assist the expression of core scene elements, and background scene elements are the elements that construct the sense of scene space. The light and shadow association weights corresponding to different levels of scene elements are determined. The light and shadow association weights of core scene elements are greater than those of secondary scene elements, and the light and shadow association weights of secondary scene elements are greater than those of background scene elements. Extract the light and shadow attributes of each scene element. The light and shadow attributes include the reflection characteristics of the scene element to light and shadow, the absorption characteristics of the scene element to light and shadow, and the luminescence characteristics of the scene element itself. The reflection characteristics include the diffuse reflection ratio and the specular reflection ratio. The absorption characteristics include the absorption ratio of light of different wavelengths. The luminescence characteristics include the self-luminescence intensity and the luminescence color range. Analyze the spatial positional relationship between each scene element and other scene elements, determine the light and shadow propagation path between different scene elements based on the spatial positional relationship, if there is an occluding scene element, mark the light and shadow propagation path as an obstructed path, and record the identifier of the occluding scene element and the degree of occlusion. The spatial positional relationship includes distance interval, relative angle, and occlusion relationship. The light and shadow propagation path is used to describe the path direction of light and shadow from one scene element to another scene element. Based on the light and shadow attributes of each scene element, the light and shadow propagation paths between different scene elements, and the hierarchical association weights of scene elements, the light and shadow association degree between different scene elements is calculated. The light and shadow association degree is used to quantify the degree of mutual influence between light and shadow of different scene elements. In the calculation process, the basic association value is first determined based on the light and shadow attributes, then the basic association value is corrected based on the smoothness of the light and shadow propagation path, and finally the final light and shadow association degree is obtained by combining the hierarchical association weights. Based on the light and shadow correlation between different scene elements, a scene element light and shadow correlation graph is constructed. The scene element light and shadow correlation graph uses scene elements as nodes. The node attributes include scene element type, level identifier, and light and shadow attributes. The light and shadow correlation is used as the attribute of the connecting edges between nodes. The connecting edges also indicate the unobstructed state of the light and shadow propagation path and the identifier of the occluding element. At the same time, a level index is added to the scene element light and shadow correlation graph.
3. The method for dynamic rendering of light and shadow in anime scenes according to claim 1, characterized in that, The generation of dynamic light and shadow response rules based on the scene element light and shadow correlation map, combined with the possible atmosphere types in the animation scene, includes: Define the possible atmosphere types in animation scenes. Each atmosphere type corresponds to a set of benchmark lighting and shadow features, which include the overall light intensity range, the main color range, the light and shadow contrast range, and the shadow softness parameter. Extract the node attribute information and the light and shadow correlation information of each scene element in the scene element light and shadow correlation graph. The node attribute information includes scene element type, level identifier, and light and shadow attributes. The connection edge information includes light and shadow correlation and propagation path status. The analysis includes the possible state change types of dynamic character elements in the scene, including the position movement change of dynamic character elements, the action posture change of dynamic character elements, and the appearance change of dynamic character elements. The position movement change includes short-distance movement and long-distance movement, the action posture change includes limb movement change and facial expression change, and the appearance change includes clothing color change and prop change. For each type of state change of dynamic character elements in a scene, the range of affected scene elements corresponding to the state change type is determined by combining the node attribute information and light and shadow correlation information in the scene element light and shadow correlation map. The affected scene elements are then filtered from high to low according to the light and shadow correlation information. The filtering process continues until the light and shadow correlation is lower than a preset correlation threshold. The range of affected scene elements includes scene elements that are directly affected by the state change and scene elements that are indirectly affected by the state change. The directly affected scene elements are those with the highest light and shadow correlation with the dynamic character elements in the scene, and the indirectly affected scene elements are those that have a light and shadow correlation with the directly affected scene elements. For each affected scene element within the range of affected scene elements, the corresponding light and shadow adjustment dimension is determined by combining the baseline light and shadow characteristics of different atmosphere types. The light and shadow adjustment dimension includes the adjustment of the illumination intensity of light and shadow, the adjustment of the illumination range of light and shadow, the adjustment of the color attributes of light and shadow, the adjustment of the contrast of light and shadow, and the adjustment of the softness of shadow. For each atmosphere type, a correspondence is established between the dynamic character element state change type and the lighting and shadow adjustment method of the affected scene elements. The lighting and shadow adjustment method includes adjustment dimension, adjustment direction and adjustment basis. The adjustment basis is an adjustment amplitude coefficient determined based on the lighting and shadow correlation of scene elements. The higher the lighting and shadow correlation, the larger the adjustment amplitude coefficient. The correspondence between state change types and lighting adjustment methods under all atmosphere types is integrated to generate dynamic lighting response rules. The dynamic lighting response rules are indexed by atmosphere type, and each index contains a list of state change types. Each state change type corresponds to a list of affected scene elements and the lighting adjustment method of each affected scene element. At the same time, the reference nodes of the scene element lighting association map corresponding to the lighting adjustment method are marked.
4. The method for dynamic rendering of light and shadow in anime scenes according to claim 1, characterized in that, The step of generating an initial lighting and shadow rendering scheme based on the dynamic lighting and shadow response rules, combined with the scene element state data of the current frame of the animation scene and the current atmosphere type identifier, includes: The current frame of the animation scene is analyzed to extract the position distribution information of static structural elements and the action posture information of dynamic character elements. The position distribution information includes the spatial coordinates and relative layout relationship of each static structural element, and the action posture information includes the limb angles, joint positions and movement trends of dynamic character elements. Based on the scene element state data of the current frame, compare it with the scene element state data of the previous frame to determine whether there is a state change in the scene dynamic character element. If there is a state change in the scene dynamic character element, determine the state change type corresponding to the state change based on the specific manifestation of the state change. If there is no state change in the scene dynamic character element, use the state change type corresponding to the previous frame and mark it as no change. Obtain the current atmosphere type identifier of the current frame of the animation scene, and retrieve the corresponding light and shadow adjustment rule subset from the light and shadow dynamic response rules based on the current atmosphere type. The rule subset includes the range of affected scene elements and light and shadow adjustment methods corresponding to all state change types under the atmosphere type. Based on the determined state change type, find the corresponding range of affected scene elements and the light and shadow adjustment dimension, adjustment direction and adjustment amplitude coefficient of each affected scene element from the rule subset; For each affected scene element, first determine the basic lighting parameters of the affected scene element based on its lighting attributes and the baseline lighting characteristics of the current atmosphere type. The basic lighting parameters include basic illumination intensity, basic illumination range, basic color attributes, basic contrast, and basic shadow softness. Based on the location distribution information of static structural elements in the scene, analyze the spatial relationship between the affected scene element and other surrounding scene elements. If there is an occlusion relationship, make preliminary corrections to the basic lighting and shadow parameters according to the degree of occlusion, and reduce the basic illumination intensity when there is occlusion. Based on the adjustment amplitude coefficient and adjustment direction corresponding to the affected scene element, the basic lighting and shadow parameters after preliminary correction are adjusted to obtain the initial lighting and shadow parameters corresponding to the affected scene element. The initial lighting and shadow parameters include initial illumination intensity parameters, initial illumination range parameters, initial color attribute parameters, initial contrast parameters, and initial shadow softness parameters. The identification information of all affected scene elements and their corresponding initial lighting and shadow parameters are integrated to generate an initial lighting and shadow rendering scheme. The initial lighting and shadow rendering scheme also includes a parameter adjustment basis description, which specifies the lighting and shadow dynamic response rule entries and scene element lighting and shadow association map node references corresponding to each initial lighting and shadow parameter adjustment.
5. The method for dynamic rendering of light and shadow in anime scenes according to claim 1, characterized in that, Based on the scene element light and shadow correlation map, the interaction between the light and shadow effects corresponding to each scene element in the initial light and shadow rendering scheme is analyzed, including direct and indirect light and shadow interference, to obtain the light and shadow interaction effect results, including: Extract the initial lighting and shadow parameters corresponding to each affected scene element from the initial lighting and shadow rendering scheme, and simulate and generate the initial lighting and shadow effect of each affected scene element in the current frame scene according to the initial lighting and shadow parameters. The initial lighting and shadow effect includes the spatial distribution range, intensity attenuation law and color change trend of the light and shadow emitted or reflected by the affected scene element. Based on the scene element light and shadow association map, find the associated scene elements corresponding to each affected scene element. The associated scene elements refer to scene elements that have a light and shadow association relationship with the affected scene element. Sort them from high to low according to the light and shadow association degree to obtain a list of associated scene elements. At the same time, extract the light and shadow propagation path information between the associated scene elements. The light and shadow propagation path information includes the path unobstructed status and the occlusion element identifier. Analyze the direct light and shadow interference caused by the initial lighting and shadow effects of each affected scene element to its associated scene elements. Direct light and shadow interference refers to the interference caused by the direct effect of the lighting and shadow effects of the affected scene elements on the associated scene elements. Specifically, direct light and shadow interference includes changes in intensity, color, contrast, and shadow shape of the original lighting and shadow effects of the associated scene elements caused by the initial lighting and shadow effects. For each change, record the specific manifestation and scope of the change. Based on the hierarchical relationship and light and shadow propagation path in the scene element light and shadow relationship map, we analyze indirect light and shadow interference. Indirect light and shadow interference refers to the interference caused by the light and shadow of the affected scene element first acting on the intermediate scene element, and then being transmitted to the target related scene element through the intermediate scene element. We first determine the intermediate scene element, then simulate the effect of the initial light and shadow effect on the intermediate scene element, and then analyze the effect of this effect on the light and shadow of the target related scene element. We record the transmission path of indirect interference, the interference change at each transmission node, and the final light and shadow change of the target related scene element. For each type of light and shadow interference, the interference level is calculated. The interference level is used to quantify the severity of the light and shadow interference. In the calculation process, the interference sensitivity is first determined based on the light and shadow attributes of the associated scene elements. Different associated scene elements have different interference sensitivities to changes in light and shadow. The interference sensitivity of core scene elements is higher than that of background scene elements. Then, the interference level value is obtained by multiplying the amplitude of the light and shadow change with the interference sensitivity. The higher the interference level value, the more severe the light and shadow interference. Record the interference source identifier, the identifier of the affected element, the type of interference, the transmission path of the interference, the specific manifestation of the interference, and the degree of interference for each type of light and shadow interference; All light and shadow interference records are classified and sorted from high to low according to the interference level value. They are also grouped according to the hierarchical identifier of the interfered elements. The light and shadow interference records corresponding to the core scene elements are sorted first. The light and shadow interaction effect results are generated. The light and shadow interaction effect results also include the scene element light and shadow association map nodes referenced in the interference analysis and the basis for the initial light and shadow effect simulation.
6. The method for dynamic rendering of light and shadow in anime scenes according to claim 1, characterized in that, The step of optimizing the lighting parameters in the initial lighting rendering scheme using a multi-round iterative adjustment method based on the lighting interaction results to generate the final lighting rendering scheme includes: The results of the light and shadow interaction are analyzed, all light and shadow interference records are extracted, sorted from high to low according to the interference level value, and grouped according to the hierarchical identifier of the interfered elements. The light and shadow interference records corresponding to the core scene elements are given the first priority, the light and shadow interference records corresponding to the secondary scene elements are given the second priority, and the light and shadow interference records corresponding to the background scene elements are given the third priority. The interference objects for the first round of adjustment are determined to be the top N light and shadow interference records with the highest interference level value in the first priority, and the value of N is set according to the scene complexity. For each light and shadow interference record in the first round of adjustments, the interference source and the corresponding initial light and shadow parameters are identified. The specific parameter items in the initial light and shadow parameters that cause light and shadow interference are analyzed, and the adjustment direction of the parameter item is determined in combination with the interference degree value. The adjustment range of the parameter is determined based on the mapping relationship between the interference level value and the parameter adjustment range. The mapping relationship is established through preliminary scene testing. The higher the interference level value, the greater the adjustment range. The adjustment range does not exceed the range of the baseline light and shadow characteristics of the current atmosphere type. Based on the determined adjustment direction and adjustment range, the target parameter item in the initial light and shadow parameters of the interference source is adjusted to obtain the light and shadow parameters after the first round of adjustment. At the same time, the parameter values before and after the adjustment and the basis for the adjustment are recorded. Substitute the adjusted lighting parameters from the first round into the scene lighting effect simulation model to re-simulate the lighting effect of the interference source. Analyze the degree of interference of this lighting effect on the original related scene elements. If the adjusted interference level is lower than the preset interference threshold, the parameter adjustment of the interference source is complete. If the adjusted interference level is still higher than the preset interference threshold, repeat the above adjustment steps. The process continues until the interference level is lower than the preset interference threshold or the preset number of iterations is reached. Set the preset number of iterations according to the rendering efficiency requirements. After completing the first round of adjustments, the second round of adjustments is initiated. The top M light and shadow interference records with the highest interference levels in the second priority are selected as the adjustment targets. The value of M is set according to the remaining scene complexity. The same adjustment logic as the first round is adopted to analyze the interference source parameters, determine the adjustment direction and magnitude, execute the adjustment, and analyze the effect. All light and shadow interference records are adjusted in order of priority. For light and shadow interference records that cannot reduce the interference level to below the preset interference threshold after multiple iterations, it is analyzed whether there is a deviation in the construction of the scene element light and shadow association map. If there is a deviation in the construction of the scene element light and shadow association map, the light and shadow association degree or propagation path information in the scene element light and shadow association map is corrected, and the interference analysis and parameter adjustment are carried out again. Collect the final lighting and shadow parameters corresponding to all adjusted interference sources. For affected scene elements that are not involved in lighting and shadow interference, keep their initial lighting and shadow parameters unchanged. The final lighting and shadow parameters of all affected scene elements or the initial lighting and shadow parameters that remain unchanged are integrated, and a parameter adjustment summary table is added. The parameter adjustment summary table contains the number of adjustments for each parameter, the values before and after the adjustment, the basis for the adjustment, and the final interference level value. The final lighting and shadow rendering scheme is generated, and the final lighting and shadow rendering scheme also includes screenshot references of key simulation results during the iterative adjustment process.
7. The method for dynamic rendering of light and shadow in anime scenes according to claim 1, characterized in that, The step of extracting key lighting parameters from the final lighting and shadow rendering scheme of the current frame and performing a coherence analysis with the corresponding key lighting and shadow parameters in the rendering scheme of the previous frame to generate inter-frame lighting and shadow transition parameters includes: Define the types of key lighting parameters, which include the illumination intensity of core scene elements, the color attributes of core scene elements, the overall contrast of the scene, the direction parameters of the main light source of the scene, and the softness of the core shadows; Extract the current values of each key lighting parameter from the final lighting and shadow rendering scheme of the current frame, and record the specific value of each key lighting parameter, the corresponding scene element identifier, and the parameter effective timestamp; Extract historical values of key lighting and shadow parameters of the same type from the previous frame rendering scheme, and record the historical value of each key lighting and shadow parameter, the corresponding scene element identifier, and the historical effective timestamp; Calculate the parameter difference between the current value and the historical value for each key lighting parameter. The parameter difference is calculated by the difference between the current value and the historical value. For color attribute parameters, the parameter difference is calculated separately for the three RGB channels. The parameter difference of each key lighting parameter is compared with the corresponding maximum allowable difference threshold. If the absolute value of the parameter difference is less than or equal to the maximum allowable difference threshold, no transition parameter is generated; if the absolute value of the parameter difference is greater than the maximum allowable difference threshold, a transition parameter is generated. For key lighting parameters that require transition parameters, the parameter transition rate is calculated based on the frame interval between the current frame and the previous frame. The parameter transition rate is calculated by the ratio of the parameter difference to the frame interval. When the frame interval is greater than 1, the parameter transition rate is calculated by the ratio of the parameter difference to the number of skipped frames. Based on the parameter transition rate, inter-frame lighting and shadow transition parameters are generated. The inter-frame lighting and shadow transition parameters include transition parameter type, transition start value, transition target value, transition rate, number of transition frames, and transition effective scene element identifier. For color attribute parameters, generate transition rate and transition parameters for each RGB channel separately; For the scene's main light source direction parameters, the inter-frame light and shadow transition parameters also include the angle increment of the direction change. The angle increment is calculated by the ratio of the difference between the current direction angle and the historical direction angle to the number of transition frames. The results of the coherence analysis of all key lighting parameters, parameter differences, maximum allowable difference thresholds, and inter-frame lighting transition parameters corresponding to the transition parameters to be generated are integrated to generate an inter-frame lighting coherence analysis report. The inter-frame lighting transition parameters are the core content of the inter-frame lighting coherence analysis report. When rendering the next frame, the initial values of key lighting parameters are first adjusted according to the inter-frame lighting transition parameters, and then the subsequent initial rendering scheme generation steps are executed.
8. The method for dynamic rendering of light and shadow in anime scenes according to claim 1, characterized in that, The step of applying the final lighting and shadow rendering scheme to the rendering process of the current frame of the animation scene includes: The final lighting and shadow rendering scheme is analyzed, and the final lighting and shadow parameters of each affected scene element are extracted. The extracted final lighting and shadow parameters include illumination intensity, color attributes, contrast, shadow parameters and associated scene element identifiers. At the same time, the parameter adjustment summary table and the basis for iterative adjustment in the final lighting and shadow rendering scheme are extracted. Import the scene model data of the current frame of the animation scene into the rendering engine. The scene model data includes the geometric model, material information and initial position information of all scene elements. Based on the scene element identifier, the final lighting and shadow parameters are bound to the corresponding scene elements in the rendering engine. During the binding process, the dimensions of the lighting and shadow parameters are matched with the parameter interface of the rendering engine, and the RGB values of the color attributes are converted into the color space format supported by the rendering engine. For core scene elements, load their final lighting and shadow parameters first, and set the rendering priority of core scene elements to the highest. For architectural components and natural landscape elements in the static structural elements of the scene, the lighting projection direction and projection range are set in the rendering engine according to the illumination range and light propagation path in their final lighting parameters. If there are occlusion scene elements, the occlusion relationship is marked in the rendering engine. For dynamic character elements in the scene, the reflection effect of light and shadow on the surface of the dynamic character elements is adjusted according to the action posture association information in the final light and shadow parameters. The light and shadow intensity at the bending part of the limbs of the dynamic character elements is attenuated according to the reflection characteristic parameters, and the light and shadow contrast in the area of facial expression change of the dynamic character elements is enhanced according to the parameter adjustment value. Load the global illumination parameters corresponding to the scene atmosphere type of the current frame. The global illumination parameters include ambient light intensity, ambient light color and main light source parameters. Then, blend the final lighting parameters with the global illumination parameters, with the final lighting parameters as the main parameter and the global illumination parameters as the auxiliary parameter during the blending process. The rendering engine executes the lighting and shadow calculation process, which includes ray tracing calculation, shadow generation calculation, color mixing calculation, and light and shadow attenuation calculation. During the calculation process, the iterative adjustment basis in the final lighting and shadow rendering scheme is referenced, thereby generating the rendering result image of the current frame. Record key data during the rendering process, and associate and store the key data with the final lighting and shadow rendering scheme and the inter-frame lighting and shadow coherence analysis report to form a complete rendering file for the current frame. The key data includes rendering time, rendering engine parameter settings, and the storage path of the rendered result image.
9. A dynamic rendering system for lighting and shadows in anime scenes, characterized in that, include: processor; A machine-readable storage medium for storing machine-executable instructions of the processor; The processor is configured to execute the animation scene lighting and shadow dynamic rendering method according to any one of claims 1 to 8 by executing the machine-executable instructions.
10. A computer program product, characterized in that, The computer program product includes machine-executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the machine-executable instructions from the computer-readable storage medium and executes the machine-executable instructions, causing the computer device to perform the animation scene lighting and shadow dynamic rendering method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Intelligent rendering method and system for realizing animation picture
CN119444944A
3D digital human mixed shadow generation method, system, medium and equipment
CN120235999A
Game scene rendering method and system
CN120502097A
Real-time light and shadow tracking and rendering system for virtual reality environment
CN120707715A
Method and system for distributed real-time rendering
US20250191271A1
Cited By
AIGC-based interactive intelligent content generation method and system
CN121810997A
An AIGC-based interactive intelligent content generation method and system
CN121810997B