Real-time dynamic lighting rendering optimization method based on unreal engine

By acquiring the rendered scene graph and AI context data in Unreal Engine, assigning shadow importance scores to mesh objects, and combining light source properties and GPU load for intelligent rendering optimization, the performance bottleneck of lighting and shadow rendering in Unreal Engine is solved, achieving efficient dynamic lighting and shadow effects.

CN120747334BActive Publication Date: 2026-05-29YOULIANG (WUHAN) NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
YOULIANG (WUHAN) NETWORK TECH CO LTD
Filing Date
2025-06-25
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies have performance bottlenecks in real-time dynamic lighting and shadow rendering, especially in complex scenes. Traditional shadow rendering methods cannot effectively balance efficiency and quality, resulting in frame rate drops and screen stuttering, and lack intelligent rendering strategies.

Method used

By acquiring rendering scene graphs, camera view frustums, and AI context data, shadow importance scores are assigned to mesh objects. Intelligent shadow projector selection and LOD application are performed by combining light source properties and GPU load, virtual shading generation is optimized, and finally, lighting contribution is accumulated to improve rendering efficiency.

Benefits of technology

It significantly reduces redundant calculations, improves rendering efficiency and frame rate stability, ensures high-quality dynamic lighting and shadow effects, and dynamically adjusts rendering strategies to adapt to real-time performance requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747334B_ABST
    Figure CN120747334B_ABST
Patent Text Reader

Abstract

The application discloses a real-time dynamic light rendering optimization method based on Unreal Engine, and relates to the field of light rendering. Firstly, based on a camera view cone and AI context data, shadow importance scores are assigned to each mesh object in a scene, and potential shadow casters are prioritized. Then, performance budget evaluation is performed in combination with the current frame rate and GPU load, and intelligent shadow projector selection and LOD application are performed on the sorted shadow caster list accordingly. Finally, these optimized rendering shadow batches are sent to the light perspective rendering and VSM page filling processes to generate movable light source optimized virtual shadow. This method significantly reduces unnecessary computational overhead, thereby greatly improving rendering efficiency and frame rate stability while ensuring high-quality dynamic light effects, effectively solving the core problem of balancing traditional performance and quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of lighting and shadow rendering, and more specifically, to a real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine. Background Technology

[0002] In the field of modern graphics rendering, especially in real-time interactive applications developed using advanced game engines such as Unreal Engine, dynamic lighting and shadow effects are crucial for building immersive and realistic virtual worlds. Precise and expressive lighting and shadows not only enhance visual realism but also provide players with important environmental cues and gameplay feedback. However, real-time dynamic lighting and shadow rendering, particularly shadow generation in complex scenes, is one of the most computationally expensive parts of the graphics rendering pipeline. With increasing scene complexity, the number of light sources, and the pursuit of higher visual quality, traditional shadow rendering methods often face significant performance bottlenecks, leading to frame rate drops, stuttering, and severely impacting the user experience. How to effectively optimize the performance of real-time dynamic lighting and shadow rendering while maintaining visual quality has become a critical issue that urgently needs to be addressed in the field of graphics technology.

[0003] Existing real-time shadow rendering solutions, such as traditional shadow mapping or cascaded shadow mapping, while achieving dynamic shadow effects, often struggle to balance efficiency and quality when handling large-scale, high-detail scenes. These methods typically require rendering the depth information of all potential shadow-casting objects for each light source, regardless of whether these objects significantly affect the final visible shadows, leading to a significant amount of redundant computation. For example, objects located outside the camera's view frustum, at extremely far distances, or occupying a negligible pixel area on the screen may contribute negligibly to shadows but still consume valuable GPU resources. Even advanced technologies like virtual texture shadows introduced in Unreal Engine, while improving resolution and detail, can still lead to performance imbalances due to processing unnecessary geometry without intelligent input management, preventing them from fully realizing their potential.

[0004] Therefore, existing solutions generally lack an intelligent mechanism that can dynamically adjust rendering strategies based on real-time performance and visual importance. Summary of the Invention

[0005] To address the aforementioned problems, according to one aspect of this application, a real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine is provided, comprising:

[0006] Acquire rendered scene graphs, camera view frustums, and AI context data. The rendered scene graphs contain transformation information, material information, and LOD information of all mesh objects in the game world.

[0007] Based on the camera view frustum and the AI ​​context data, a shadow importance score is assigned to each grid object to obtain a sorted list of shadow projections;

[0008] Based on the properties of the movable light source, the current frame rate, and the current GPU load, the sorted list of shadow projection objects is subjected to light source-object association and performance budget evaluation to obtain the list of projectors corresponding to the movable light source.

[0009] Intelligent shadow projector selection and LOD application are performed on the list of projectors corresponding to the movable light source to obtain a batch of shadows to be rendered for the movable light source;

[0010] The batch of shadows to be rendered for movable light sources is subjected to light perspective rendering and VSM page filling to obtain movable light source optimized virtual shading;

[0011] Get the scene G buffer for the current screen;

[0012] Based on the movable light source, virtual shading is optimized, and delayed illumination calculations are performed on each pixel in the scene G buffer to obtain the direct light contribution to the shadow.

[0013] The final rendered frame is obtained by accumulating the lighting contribution based on the direct light contribution to be shaded, Lumen global illumination and screen space reflection data, and game-defined post-processing parameters.

[0014] Compared to existing technologies, this application provides a real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine, addressing the performance bottleneck caused by processing a large number of redundant geometry in real-time dynamic lighting and shadow rendering, as well as the lack of intelligent dynamic adaptability in existing solutions. First, based on camera view frustum and AI context data, it assigns shadow importance scores to each mesh object in the scene, prioritizing potential shadow casters. Then, it performs a performance budget assessment based on the current frame rate and GPU load, and accordingly performs intelligent shadow caster selection and LOD application on the sorted list of shadow casters. In other words, the system no longer renders all shadows indiscriminately, but prioritizes the parts with the greatest impact on visual effects, dynamically adjusting rendering details based on real-time performance. Finally, these optimized shadow batches are sent to the light perspective rendering and VSM page fill process to generate movable light sources to optimize virtual shading, significantly reducing unnecessary computational overhead. This ensures high-quality dynamic lighting and shadow effects while greatly improving rendering efficiency and frame rate stability, effectively solving the core problem of balancing performance and quality in background technologies. Attached Figure Description

[0015] The above and other objects, features, and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain the application and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.

[0016] Figure 1 This is a flowchart of a real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to an embodiment of this application.

[0017] Figure 2 This is a data flow diagram of a real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to an embodiment of this application.

[0018] Figure 3 This is a flowchart of step S2 in the Unreal Engine-based real-time dynamic lighting and shadow rendering optimization method according to an embodiment of this application.

[0019] Figure 4 This is a flowchart of step S3 in the Unreal Engine-based real-time dynamic lighting and shadow rendering optimization method according to an embodiment of this application.

[0020] Figure 5 This is a flowchart of step S4 in the Unreal Engine-based real-time dynamic lighting and shadow rendering optimization method according to an embodiment of this application. Detailed Implementation

[0021] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0022] To address the problems mentioned above in the background technology, this application proposes a real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine. Figure 1 This is a flowchart of a real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to an embodiment of this application. Figure 2 This is a data flow diagram of a real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to an embodiment of this application. Figure 1 and Figure 2As shown, the real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to an embodiment of this application includes: S1, acquiring a rendering scene map, camera frustum, and AI context data, wherein the rendering scene map contains transformation information, material information, and LOD information of all mesh objects in the game world; S2, assigning shadow importance scores to each mesh object based on the camera frustum and the AI ​​context data to obtain a sorted list of shadow projection objects; S3, performing light source-object association and performance budget evaluation on the sorted list of shadow projection objects based on the attributes of movable light sources, the current frame rate, and the current GPU load to obtain a list of projectors corresponding to movable light sources; S4, performing light source-object association and performance budget evaluation on the movable light sources; S5. The list of projectors corresponding to the light source is used to select intelligent shadow projectors and apply LOD to obtain a batch of shadows to be rendered for the movable light source; S6. The batch of shadows to be rendered for the movable light source is rendered using light perspective rendering and VSM page filling to obtain the movable light source optimized virtual texture; S7. The scene G buffer of the current screen is obtained; S8. Based on the movable light source optimized virtual texture, the deferred lighting calculation is performed on each pixel in the scene G buffer to obtain the direct light contribution of the shadow; S9. Based on the direct light contribution of the shadow, Lumen global illumination and screen space reflection data, and the game-defined post-processing parameters, the lighting contribution is accumulated to obtain the final rendered frame.

[0023] In step S1, the rendered scene graph, camera view frustum, and AI context data are acquired. The rendered scene graph contains transformation information, material information, and LOD information for all mesh objects in the game world. It should be understood that in complex game scenes, traditional shadow rendering methods suffer from redundant computation and performance bottlenecks due to indiscriminately processing all potential shadow-casting objects. To address this issue, this method requires acquiring detailed information on all mesh objects in the game world to accurately identify and manipulate them. Simultaneously, acquiring camera view frustum data is crucial because it defines the player's visible area, allowing the rendering process to prioritize objects that affect the final image and discard irrelevant objects outside the view frustum. Introducing AI context data further enhances intelligence, allowing the rendering system to dynamically adjust shadow importance based on game logic or player behavior; for example, prioritizing the rendering of shadows of objects closely related to the player's current task or AI behavior. The comprehensive acquisition of this data is a prerequisite for achieving intelligent shadow importance scoring, performance budget assessment, and dynamic LOD application, thereby effectively reducing unnecessary rendering overhead and improving rendering efficiency and frame rate stability.

[0024] One possible implementation of step S1: At the beginning of each frame's rendering phase, the rendering pipeline, i.e., the series of computational stages in graphics processing that convert 3D scene data into the final 2D screen image, firstly acquires the rendering scene graph. The rendering scene graph is a data structure maintained internally by the game engine, logically organizing all 3D entities in the game world. This scene graph is built from asset files during game loading and is updated in real-time during game execution based on object creation, destruction, or movement. Specifically, it contains transformation information for mesh objects: for each mesh object in the scene graph, its position, rotation, and scaling data in the world coordinate system are acquired. These are stored in the form of a 4x4 transformation matrix, used to convert the object's local coordinates to world coordinates. For example, the transformation matrix of a character mesh is updated in real-time to determine its precise position and orientation in the game world. Material information: the material properties associated with each mesh object are acquired, including texture maps such as diffuse, normals, roughness maps, colors, and shading model parameters. This information defines the visual characteristics of the object's surface; although not directly used for shadow casting, it is crucial for the final lighting calculations and visual presentation. LOD information retrieves multiple Levels of Detail (LOD) data preset for each mesh object. A mesh object contains geometric models of different complexities, such as LOD0 (highest level of detail), LOD1, and LOD2. This information indicates the version of the mesh model to be used at different distances or levels of importance.

[0025] Next, the camera view frustum is obtained. The camera view frustum is a truncated cone geometry defined by six planes: the near clipping plane, the far clipping plane, and left, right, top, and bottom. It is calculated using the camera parameters of the current frame, including the camera's position and orientation in the world, its field of view angle (e.g., 90 degrees), its screen aspect ratio (e.g., 16:9), and the distances between the near and far clipping planes (e.g., 0.1 meters for the near clipping plane and 1000 meters for the far clipping plane). These parameters are updated in real-time by the game engine based on player input or preset paths and are used to construct the view frustum for view frustum culling.

[0026] Finally, acquire AI context data. AI context data is a dynamic stream of information obtained from the game logic or artificial intelligence module, reflecting information related to AI behavior or key game states in the game world. For example, this might include: whether a specific enemy is targeted by the player, whether a mission objective is active, whether a non-player character (NPC) is performing a key animation or interaction, or whether the player is currently in stealth mode. This data is provided in the form of Boolean flags, enumeration values, or specific data structures, and its content is preset by the game designers and updated in real-time by the game runtime logic.

[0027] In step S2, based on the camera view frustum and the AI ​​context data, a shadow importance score is assigned to each mesh object to obtain a sorted list of shadow projection objects. Accordingly, the background technology clearly points out that traditional shadow rendering methods often indiscriminately process all potential shadow-projecting objects in a scene, even those located outside the camera view frustum, at great distances, or occupying a negligible pixel area on the screen, consuming valuable GPU resources and leading to performance bottlenecks and frame rate drops. Even advanced technologies such as virtual texture shadows in Unreal Engine, without intelligent input management, may suffer from performance imbalances due to processing unnecessary geometry. Therefore, to solve this inefficient one-size-fits-all rendering method, this application assigns a shadow importance score to each mesh object based on the camera view frustum and AI context data. This allows the rendering pipeline to intelligently identify and quantify the visual contribution and gameplay relevance of each object to the final shadow effect. The camera view frustum data ensures that only objects that affect the currently visible scene are prioritized, avoiding expensive calculations for invisible or unimportant shadows. The introduction of AI context data further enhances intelligence, allowing the rendering process to dynamically adjust the shadow priority of objects based on game logic or player behavior. For example, it prioritizes rendering shadows of objects related to the player's current task or key AI actions. The resulting sorted list of shadow projections provides precise prioritization for subsequent performance budget assessments and intelligent LOD applications, ensuring that computing resources are focused on shadow generation that has the greatest impact on visual effects and user experience. This significantly reduces redundant computation and improves rendering efficiency and frame rate stability.

[0028] Specifically, in one example of this application, Figure 3 This is a flowchart of step S2 in the Unreal Engine-based real-time dynamic lighting and shadow rendering optimization method according to an embodiment of this application. Figure 3 As shown, step S2, based on the camera view frustum and the AI ​​context data, assigns shadow importance scores to each grid object to obtain a sorted list of shadow projections, including: S21, assigning basic shadow importance scores to each grid object based on the grid type of each grid object; S22, adjusting the basic shadow importance scores assigned to each grid object in real time based on the camera view frustum and the AI ​​context data to obtain the sorted list of shadow projections.

[0029] It is understandable that in complex rendering scenes, different types of mesh objects have varying importance to the final visual effect and shadow quality. For example, the accuracy and presence of shadows for a main character model, a large building, or a key game prop are often more critical than those for a patch of grass, a small stone, or a background decoration. Treating all objects' shadows the same without differentiation would result in a significant waste of computational resources on objects with little visual impact, exacerbating the performance bottlenecks and redundant computation issues mentioned in the background. Therefore, this application pre-identifies objects that may require higher shadow quality under any circumstances by assigning a basic shadow importance score based on mesh type at an early stage. This provides a reasonable starting point for subsequent real-time factor adjustments and performance budget allocation, ensuring that computational resources can be more effectively focused on the parts that have the greatest impact on user experience, thereby improving overall rendering efficiency.

[0030] One possible implementation of step S21 is as follows: First, define the mesh type. During game development, various mesh objects in the scene are pre-classified. These classifications are determined based on the object's function in the game, its visual salience, size, or importance in the scene. For example, common mesh types may include: main characters, secondary characters, large buildings, small buildings, key props, ordinary props, terrain, vegetation, special effects particles, etc. These mesh types are marked by artists or technical artists during asset import, or initially classified by automated scripts based on attributes such as the number of vertices and bounding box size.

[0031] Next, a base shadow importance score is set. For each predefined mesh type, a corresponding base shadow importance score is preset. These scores are numerical and can be discrete levels, such as very high, high, medium, low, very low, or consecutive values, such as from 0.0 to 1.0, or integers 100, 80, 50, 20, 10. These scores are set based on the game designer's experience, visual effect requirements, and trade-offs in performance overhead. For example, the main character mesh type might be assigned a very high base shadow importance score, such as 100, because its shadows directly affect the player's visual focus and immersion. Large building mesh types might be assigned a high base shadow importance score, such as 80, because they typically cast large and significant shadows. Ordinary prop mesh types might be assigned a medium base shadow importance score, such as 50. Mesh types such as vegetation or special effect particles might be assigned a low or very low base shadow importance score, such as 20 or 10, because their shadows may be less significant, or their rendering overhead needs to be strictly controlled.

[0032] Finally, scores are assigned. Each mesh object in the acquired rendered scene graph is iterated through. For each mesh object, its labeled mesh type is queried. Then, based on the preset mapping between mesh types and base shadow importance scores, the corresponding score is assigned to that mesh object. For example, if a mesh object is identified as a primary character type, its base shadow importance score is set to extremely high, or 100. In this way, each mesh object receives an initial shadow priority that reflects its inherent visual importance.

[0033] Background technology clearly points out that even advanced technologies in Unreal Engine suffer from performance imbalances due to a lack of intelligent input management, failing to fully realize their potential. Furthermore, existing solutions generally lack mechanisms for dynamically adjusting rendering strategies based on real-time performance and visual importance. The importance of an object's shadow is not static; it changes significantly with camera viewpoint, the object's visibility on the screen, distance, and game logic—the AI ​​context. For example, an object initially assigned a high base score might have a negligible visual contribution from its shadow if it is currently extremely far from the camera, occupies only a tiny pixel area on the screen, or is completely outside the camera's view frustum. Rendering its shadow with high priority in this case would result in significant computational waste. Therefore, the technical solution in this application, by introducing camera view frustum and AI context data for real-time factor adjustment, ensures that shadow rendering resources are intelligently allocated to objects that are truly important to visual effects and game experience in the current frame. This effectively solves the problem of redundant computation, achieves dynamic optimization of rendering strategies, and significantly improves rendering efficiency and frame rate stability.

[0034] Specifically, in one example of this application, step S22, which adjusts the basic shadow importance score assigned to each grid object in real time based on the camera's view frustum and the AI ​​context data to obtain the sorted list of shadow projections, includes: S221, applying a smooth step function decay to the basic shadow importance score based on the distance between each grid object and the camera; S222, applying linear interpolation and clamping to the basic shadow importance score based on the pixel area occupied by each grid object on the screen; S223, determining whether each grid object is within the camera's view frustum to obtain a visibility status judgment result, and adjusting the basic shadow importance score based on a first multiplier factor based on the visibility status judgment result; and S224, adjusting the basic shadow importance score based on a second multiplier factor based on the content hints of the AI ​​context data.

[0035] One possible implementation of step S22: First, execute S221. First, calculate the Euclidean distance from the center point of the mesh object to the camera position. Then, input this distance into a preset smoothing step function. The smoothing step function is a commonly used interpolation function, its mathematical expression being x*x*(3-2*x), where x is a normalized value between 0 and 1. To achieve the attenuation effect, a near-distance threshold, such as 10 meters, and a far-distance threshold, such as 100 meters, are defined. Calculate a normalized distance = (current distance - near-distance threshold) / (far-distance threshold - near-distance threshold) and clamp it between 0.0 and 1.0. Then, input the normalized distance into the smoothing step function to obtain a smooth attenuation factor. The final distance attenuation multiplier is 1 - attenuation factor, making the multiplier close to 1 when the object is close and close to 0 when the object is far away. Finally, multiply the current shadow importance score by the calculated distance attenuation multiplier. For example, if an object has a base score of 80 and a distance of 50 meters, with a preset near distance of 10 meters and a far distance of 100 meters, then the normalized distance = (50-10) / (100-10) ≈ 0.444. After calculation using the smoothing step function, it is approximately 0.416, so the distance decay multiplier is approximately 1 - 0.416 = 0.584. At this point, the score becomes 80 * 0.584 = 46.72.

[0036] Next, execute S222. It's worth noting that pixel area is calculated by projecting the object's world-space bounding box onto screen space and determining the number of pixels it occupies on the screen. First, a minimum pixel area threshold, such as 100 pixels, and a maximum pixel area threshold, such as 10,000 pixels, are preset, along with corresponding minimum multipliers, such as 0.1 and maximum multipliers, such as 1.0. The linear difference is calculated as follows: First, the normalization ratio of the pixel area within the threshold range is calculated as (current pixel area - minimum pixel area threshold) / (maximum pixel area threshold - minimum pixel area threshold), and this ratio is clamped between 0 and 1. Then, the final pixel area multiplier is calculated as: minimum multiplier + (maximum multiplier - minimum multiplier) * normalization ratio. Finally, the current shadow importance score is multiplied by the calculated pixel area multiplier. For example, if an object has a score of 46.72 and a pixel area of ​​1200 pixels, then the normalization ratio = (1200 - 100) / (10000 - 100) ≈ 0.111. At this point, the pixel area multiplier = 0.1 + (1.0 - 0.1) * 0.111 ≈ 0.2. The score becomes 46.72 * 0.2 = 9.344.

[0037] Next, step S223 is executed. First, preliminary frustum culling is performed. When a mesh object is completely outside the camera's view frustum, such as a tree far behind the player character, the frustum culling algorithm explicitly determines it to be completely invisible. In this case, its shadow importance score is multiplied by 0, thus completely eliminating its shadow rendering priority and greatly saving computational resources. Next, to avoid visual abruptness, this step introduces a smooth transition mechanism in a more refined implementation. A transition region is set at the edge of the camera's view frustum, allowing the visibility multiplier to be a floating-point value between 1 and 2, where 1 represents importance at the lowest visibility and 2 represents importance at the highest visibility. Specifically, the visibility state multiplier is calculated in real-time using an interpolation function based on the specific position of the mesh object within the transition region at the edge of the camera's view frustum. For example, after the distance and pixel area adjustments in step S222, several mesh objects currently have a shadow importance score of 9.344. For objects located in the transition zone at the edge of the camera's view frustum, such as a street lamp that has just entered or is about to leave the field of view, the system calculates a smooth visibility multiplier between 1 and 2, i.e., the first multiplier factor, based on its position within the transition zone. A value of 1.2 indicates a moderate increase in its importance, relative to the baseline of 1.0 at the lowest visibility level. For example, 9.344 * 1.2 = 11.2128, preventing abrupt appearances or disappearances of shadows and providing a smoother visual experience. Conversely, for objects completely within the camera's view frustum and far from the edge transition zone, such as a key item box directly in front of the player character and centered in the field of view, the first multiplier factor is set to 2.0, ensuring that its shadow rendering priority is fully guaranteed. This smooth visibility adjustment effectively filters out objects that contribute little to the current visual effect, concentrating computational resources on visible objects that truly require shadow rendering, thus achieving efficient resource management while maintaining visual smoothness.

[0038] Finally, S224 is executed. First, the system looks up preset AI context multipliers. These multipliers are designed to be between 1 and 2 to fine-tune the shadow importance of objects based on the AI ​​context. These AI context multipliers are pre-set and stored in lookup tables or configurations by game designers based on the object's function, importance, or interaction with the player in the game. For example, if the AI ​​context indicates that the mesh object is the player's current target, a second multiplier factor of 1.8 is applied; if it indicates that it is a key quest item, a second multiplier factor of 1.5 is applied; if there is no specific hint, a second multiplier factor of 1.0 is applied. Finally, the current shadow importance score is multiplied by the calculated AI context multiplier to obtain the final shadow importance score after AI context adjustment. For example, if the shadow importance score obtained after the above visibility state judgment is 11.2128, and the AI ​​context indicates that it is the player's current target, then the second multiplier factor is 1.8, and the score becomes 11.2128 * 1.8 ≈ 20.18. After all the above adjustments are completed, each mesh object will have a final shadow importance score reflecting its current real-time importance. The rendering pipeline will then sort all mesh objects in descending order based on these final scores, resulting in a sorted list of shadow projections.

[0039] It's important to note that when adjusting the basic shadow importance score based on multiplier factors using the visibility status assessment results of each mesh object and the content cues from the AI ​​context data, these two parts are not entirely independent but rather interconnected. That is, there is overlap between the content cues from the AI ​​context data and the visibility status assessment results of each mesh object regarding their respective states. Therefore, if the first and second multiplier factors can be correlated, the accuracy of the basic shadow importance score can obviously be improved.

[0040] Preferably, in one embodiment of this application, the setting of the first multiplier factor and the second multiplier factor includes:

[0041] Extracting the initial factor of the first multiplier, the theoretical upper limit of the first multiplier factor, the initial factor of the second multiplier, and the theoretical upper limit of the second multiplier factor—that is, obtaining these values—provides a complete context and boundaries, enabling the optimization of the correlation between multiplier factors to be carried out within a clear, controlled framework that meets design expectations.

[0042] Subtract one from both the first and second initial multiplier factors to obtain the static probability values ​​of the first and second multiplier factors. Considering that in most cases both multipliers lie within the interval [1,2], for more effective multiplier interval correlation, subtract one from each of the two multipliers, for example, denoted as α and β, to constrain them to the interval [0,1], thus considering their dynamic probability superposition characteristics from the perspective of static probability distribution.

[0043] p α =α-1

[0044] p β =β-1

[0045] Here, α and β are the initial factors of the first and second multipliers, respectively, and are obtained by game developers or system designers based on experience and testing. For example, α and β can be 1.45 and 1.5, respectively. α and p β These are the static probability values ​​of the first multiplier factor and the second multiplier factor, respectively. In this way, the multiplier interval can be optimized by dynamically associating under superimposed attributes to achieve the perception of the associated state.

[0046] Based on the theoretical upper limits of the first and second multiplier factors, the correlation normalization benchmark coefficient between the static probability values ​​of the first and second multiplier factors is calculated. In other words, for these two multipliers, within a predetermined interval [1,2], there is usually a defined maximum value, for example, close to 1.5. Therefore, this maximum value is actually used as the normalization benchmark for the correlation. That is, when the correlation between the two multipliers is uncertain, a reasonable upper limit is used to coordinate the mutually exclusive effects under non-overlapping attributes, avoiding differences in dynamic probability intensity under non-pure collaboration. Therefore, the correlation normalization benchmark coefficient is introduced as follows:

[0047]

[0048] Where, α max and β max These are the theoretical upper limits of the first and second multiplier factors, which are maximum values ​​preset by game developers or system designers based on experience, testing, and game requirements, such as α. max and β max The values ​​are 1.5 and 1.6 respectively, where γ is the correlation normalization baseline coefficient;

[0049] Based on the aforementioned correlation normalized baseline coefficients and using a clamping function to perform multiplier dynamic interval correlation on the static probability values ​​of the first and second multiplier factors respectively, optimized static probability values ​​of the first and second multiplier factors are obtained. In other words, the clamping function is used to constrain the mutual exclusion effect of state determination relative to the dynamic interval, thereby enabling correlation state perception under non-pure cooperation based on superposition attributes.

[0050] p′ α =clip(p α ,p β ×γ,p β / γ)

[0051] p′ β =clip(p β ,p α ×γ,p α / γ)

[0052] in,

[0053]

[0054] Where clip is the clamping function, p' α and p' β These are the optimized static probability values ​​of the first multiplier factor and the optimized static probability value of the second multiplier factor. In other words, by using the clamping function, the state judgment is essentially combined with the continuous interval distribution, thereby effectively performing dynamic interval association of the multipliers. In this way, by further performing association state perception on the basis of weakening the dynamic probability intensity state difference, the two predetermined multipliers can be effectively associated, thereby improving the accuracy of the basic shadow importance score.

[0055] The optimized static probability values ​​of the first and second multiplier factors are respectively increased by one to obtain the first and second multiplier factors, respectively:

[0056] a=p′ α +1

[0057] b = p' β +1

[0058] Where a and b are the first multiplier factor and the second multiplier factor, respectively. That is, the static probability value after correlation optimization in the [0,1] interval is remapped back to the original multiplier interval [1,2] to obtain the first multiplier factor and the second multiplier factor that have been co-optimized for adjusting the shadow importance score. Then, the first multiplier factor and the second multiplier factor obtained after optimization can adjust the shadow importance score of the mesh object more accurately and co-factorily.

[0059] In step S3, based on the attributes of the movable light source, the current frame rate, and the current GPU load, the sorted list of shadow projectors is evaluated using light source-object association and performance budget to obtain a list of projectors corresponding to the movable light source. It should be understood that while intelligent scoring and sorting yield a list of potential shadow projectors based on visual importance, this list is still for the entire scene and does not consider the characteristics of individual movable light sources and their actual impact on performance. The background art emphasizes the high computational cost of real-time dynamic lighting and shadow rendering, and the inefficiency of existing solutions when handling large-scale scenes. A scene may contain multiple movable light sources, each with a limited range of influence, and the system's current frame rate and GPU load are dynamically changing. Without precise association and performance budgeting for the shadow projectors of each light source, unnecessary computation may still occur, such as rendering shadows of objects outside the influence range of a light source, or maintaining excessively high shadow quality even when system performance is strained. Therefore, this application ensures that only objects truly within the influence range of a light source are considered for shadow projection through light source-object association, thereby significantly reducing redundant computation. Performance budgeting allows the rendering pipeline to dynamically adjust the amount of shadows cast and the level of detail allowed by the light source based on the current frame rate and graphics processor load. This enables the rendering system to intelligently find the optimal balance between visual quality and performance, avoiding stuttering under high performance pressure while providing more refined shadow effects when performance is ample, thus effectively addressing the performance bottlenecks and efficiency issues mentioned in the background technology.

[0060] Specifically, in one example of this application, the properties of the movable light source include its position, radius of influence, and light source type. It is worth noting that the properties of the movable light source are dynamically acquired and managed by the game engine at runtime. These properties are fundamental to lighting and shadow calculations and are crucial for achieving realistic rendering effects.

[0061] One possible implementation of the properties of movable light sources: Position refers to the precise coordinates of the movable light source in the 3D game world. During game development, designers place light sources in the scene using the engine's editor and set their initial positions. Once the game is running, if a light source is set to be movable, its position will be updated in real time based on game logic, physics simulation, character animation, or script instructions. For example, the position of a flashlight held by a player will constantly change as the player character moves. Internally, the engine manages the transformation information of all game objects, including position, rotation, and scaling, by maintaining a scene graph or component system. The rendering pipeline queries these systems to obtain the current precise world coordinates of each movable light source every frame when lighting and shadow calculations are needed.

[0062] The influence radius defines the maximum distance a movable light source can illuminate or cast shadows from. Objects outside this range will not be affected by the light source. This property is also set by designers for each light source during game development. For example, a point light source might be configured with an influence radius of 20 meters, and a spotlight might have a specific cone angle, with its influence radius determined by that angle and the light source intensity. Internally, the engine stores the influence radius as a core property of the light source component. When the rendering pipeline needs to determine which objects might be affected by a particular light source, it directly queries the influence radius property of that light source and uses it for initial geometry culling.

[0063] Light source type refers to the basic emission pattern and behavioral characteristics of a movable light source. Common types include point lights (emitting light uniformly in all directions), spotlights (emitting light within a cone-shaped area), and directional lights (simulating light sources at infinity, such as sunlight). This attribute is specified by the designer when the light source is created and remains unchanged during gameplay. The light source type determines the mathematical models and algorithms used by the engine to calculate light attenuation, shadow casting direction, and intensity.

[0064] Specifically, in one example of this application, Figure 4 This is a flowchart of step S3 in the Unreal Engine-based real-time dynamic lighting and shadow rendering optimization method according to an embodiment of this application. Figure 4 As shown, step S3, based on the attributes of the movable light source, the current frame rate, and the current GPU load, performs light source-object association and performance budget evaluation on the sorted list of shadow projection objects to obtain the projector list corresponding to the movable light source, including: S31, for each mesh object in the sorted list of shadow projection objects, based on the transformation information of the mesh object and the influence radius of the movable light source, removing mesh objects that are not within the influence range of the movable light source; S32, based on the current frame rate and the current GPU load, dynamically calculating the allowed shadow projector threshold and LOD selection aggression of the movable light source.

[0065] One possible implementation of step S3 is as follows: First, execute S31. For each mesh object, obtain the center point position of the mesh object in world space. Then, calculate the Euclidean distance from the center point of the mesh object to the current movable light source position. Next, compare this calculated distance with the preset influence radius of the movable light source. If the distance from the center point of the mesh object to the light source is greater than the influence radius of the light source, the mesh object is considered to be outside the influence range of the light source and is removed from the potential projector list of the current movable light source. For example, the influence radius of a point light source is set to 20 meters. If there is a mesh object in the sorted list of shadow projection objects whose center point is 25 meters away from the point light source, then this mesh object will be removed and will not cast a shadow for the point light source. After this step, a preliminary filtered projector list for the current movable light source will be obtained, which only contains mesh objects that are theoretically likely to be affected by the light source and cast shadows.

[0066] Next, S32 is executed. First, the current frame rate and current GPU load are obtained. Specifically, the current frame rate is obtained by measuring the number of frames rendered per second, while the current GPU load is obtained by querying the GPU driver or hardware performance counters to obtain its utilization percentage. Then, the rendering pipeline dynamically adjusts two key parameters based on these real-time performance metrics: the shadow caster threshold is a score that determines how high a mesh object's shadow importance score must be to be allowed to cast shadows in subsequent steps. This threshold is dynamically calculated. For example, a performance mapping curve or lookup table can be preset: when the current frame rate is above 60 frames per second and the current GPU load is below 70%, the threshold might be set to a lower value, such as 10, allowing more objects to cast shadows; while when the current frame rate is below 30 frames per second and the current GPU load is above 90%, the threshold might be set to a higher value, such as 80, allowing only the most important objects to cast shadows. Intermediate frame rate and load values ​​can be calculated using linear interpolation or other smoothing functions to obtain the corresponding threshold. This threshold ensures that only the highest priority shadows are rendered when performance is strained. LOD selection aggression is a parameter that guides the strategy for selecting the level of detail (LD) of mesh objects in subsequent steps. It is also dynamically calculated. For example, when performance is good, aggression might be set low, meaning even moderately important objects tend to use a higher level of detail for shadow casting; conversely, when performance is poor, aggression might be set high, meaning even highly important objects might be forced to use a lower level of detail for shadow casting to save rendering overhead. This aggression can be a numerical value, such as 0 to 1, or an offset directly mapped to a level of detail. For example, when aggression is 0, level of detail 0 or 1 might be preferred; when aggression is 1, level of detail 2 or 3 might be preferred. The final result is the list of projectors corresponding to the movable light source, the shadow projector threshold, and the LOD selection aggression.

[0067] In step S4, intelligent shadow projector selection and LOD application are performed on the projector list corresponding to the movable light source to obtain a batch of shadows to be rendered for the movable light source. Correspondingly, in step S3, although irrelevant objects have been eliminated based on the light source's influence range, and the rendering budget, shadow projector threshold, and LOD selection aggressiveness have been calculated based on the current performance, this budget has not yet been specifically applied to each mesh object. Background technology points out that traditional methods suffer from performance bottlenecks due to the lack of intelligent dynamic adjustment strategies. Therefore, in this application, intelligent shadow projector selection and LOD application are performed on the projector list corresponding to the movable light source to dynamically determine the number of objects participating in shadow casting based on real-time performance pressure. When performance is tight, only the most important shadows are retained, directly reducing rendering batches and drawing calls. Furthermore, the most appropriate geometric complexity is selected based on its importance and performance budget. This avoids the huge performance overhead caused by using high-precision models for shadow rendering of all objects, solving the core technical problem of balancing performance and quality in the background technology.

[0068] Specifically, in one example of this application, Figure 5 This is a flowchart of step S4 in the Unreal Engine-based real-time dynamic lighting and shadow rendering optimization method according to an embodiment of this application. Figure 5 As shown, step S4 involves intelligent shadow projector selection and LOD application on the projector list corresponding to the movable light source to obtain a batch of shadows to be rendered for the movable light source, including: S41, selecting mesh objects with shadow importance scores greater than the shadow projector threshold to participate in shadow casting; S42, if the shadow importance score of the mesh object is extremely high, using the highest LOD to cast shadows on the mesh object; S43, if the shadow importance score of the mesh object is medium, using the second-highest LOD to cast shadows on the mesh object; S44, if the shadow importance score of the mesh object is low, using the lowest LOD to cast shadows on the mesh object.

[0069] One possible implementation of step S4: First, execute S41. For each mesh object in the list, the rendering pipeline compares its own shadow importance score with the shadow caster threshold. For example, given the current poor frame rate, the calculated shadow caster threshold is 50. If the shadow importance score of a currently traversed mesh object is 65, since 65 is greater than 50, the object passes the screening and continues to the subsequent LOD selection stage. Conversely, if another mesh object has a score of 30, since 30 is less than 50, the object will be discarded directly and will not participate in the shadow casting of that light source. This step effectively reduces the number of shadow casters that need to be processed based on the real-time performance budget. For mesh objects that pass the S41 screening, the rendering pipeline selects a specific Level of Detail (LOD) model for them based on their shadow importance score level and combined with the LOD selection aggressiveness. For this, the scoring level classification criteria need to be pre-defined; for example, a score greater than 80 can be set as extremely high, 30 to 80 as medium, and less than 30 as low. Specifically, in one example of this application, the highest LOD is LOD0, the second-highest LOD is LOD1 or LOD2, and the lowest LOD is LOD3.

[0070] Next, steps S42 through S44 are executed. If a mesh object has an extremely high shadow importance score, for example, 90, according to rule S42, it will be assigned to use the highest LOD, i.e., LOD0, for shadow casting. However, the LOD selection aggression level will adjust this. If current performance is ample and the aggression level is low, LOD0 will remain in use. But if performance is tight and the aggression level is high, the LOD level may be forcibly lowered by one level, i.e., LOD1 will be used for casting, sacrificing a small amount of detail for performance improvement. If a mesh object has a medium shadow importance score, for example, 55, according to rule S43, it will be assigned to use a secondary LOD, i.e., LOD1 or LOD2. The specific choice between LOD1 and LOD2 can be determined based on the specific position of the score within the medium range, or LOD1 may be chosen by default. Again, the LOD selection aggression level will adjust this. Under high performance pressure, it may be forced to use a lower LOD2 or even LOD3. If a mesh object has a low shadow importance score, for example, 25, but still above the threshold, it will be assigned to use the lowest LOD, i.e., LOD3 model, for shadow casting according to rule S44. In this case, since it is already at the lowest detail level, it is no longer affected by the LOD selection aggressiveness. Ultimately, for each mesh object that passes the S41 screening, it is determined whether it participates in casting and which specific LOD model to use. Combining all these mesh object-LOD model pairings forms the batch of shadows to be rendered for that movable light source.

[0071] In step S5, the batch of shadows to be rendered for the movable light source is rendered using a light perspective and filled with a VSM page to obtain a movable light source-optimized virtual texture. It should be understood that even after obtaining a highly optimized and streamlined batch of shadows to be rendered for the movable light source through intelligent shadow projector selection and level of detail application, efficiently converting these batches into usable shadow data remains a challenge for real-time rendering. Traditional shadow mapping techniques mentioned in the background often require rendering the entire scene into a fixed-size texture, resulting in insufficient resolution, severe jagged edges, or excessive memory and bandwidth consumption due to its large size. Even advanced virtual texture techniques, without intelligent management, may suffer from performance imbalances due to processing unnecessary geometry. Therefore, this application utilizes virtual texture shadow technology to obtain optimized virtual textures in a memory-efficient and performance-friendly manner. By rendering depth information from the light source's perspective and filling virtual texture shadow pages, it can be ensured that texture pages are allocated and filled only for the areas where shadows are actually projected, avoiding redundant storage and rendering of traditional shadow mapping.

[0072] Specifically, in one example of this application, step S5, performing light perspective rendering and VSM page filling on the batch of shadows to be rendered for the movable light source to obtain the movable light source optimized virtual texture, includes: the GPU rendering depth information of each mesh object in the batch of shadows to be rendered for the movable light source from the perspective of the movable light source, and then performing VSM page filling on them to obtain the movable light source optimized virtual texture.

[0073] One possible implementation of step S5 is as follows: First, the rendering pipeline sets up a virtual camera based on the properties of the movable light source, particularly its location and light type. For example, if the light source is a point light, the rendering pipeline sets up six virtual cameras, each corresponding to one of the six faces of the cube map. Each camera projects a perspective image in a different direction, centered on the light source. If the light source is a spotlight, a virtual camera is set up at the light source, facing the light source, and uses a perspective projection that matches the cone angle of the spotlight. For directional light sources, although they don't have a specific location, an orthographically projected virtual camera is set up, facing the same direction as the light source and covering the area in the scene where shadows need to be cast. After setting up the virtual camera, the GPU binds a temporary render target, which is a depth buffer or a texture containing depth and depth square information, to receive the rendering results. Then, the GPU iterates through the mesh objects that have been filtered and have had their level of detail applied in step S4. For each mesh object in the batch, the GPU transforms it from world space to the space of this virtual light source camera and renders only its depth information. In other words, during the rendering process, the pixel shader does not calculate color, but directly outputs the distance and depth value from the pixel to the light source, or, to support subsequent variance shadow mapping technology, it outputs both the depth value and its square value. This depth information is written into a preset temporary rendering target.

[0074] Next, the rendered depth information is filled with VSM (Virtual Texture Shadow) pages. VSM is an efficient shadow map management technique that divides the vast potential shadow space into many fixed-size virtual pages, but only allocates physical memory for those pages that actually contain the shadow-projecting geometry. In this stage, the rendering pipeline analyzes the depth information rendered to the temporary render target in the previous step, identifying which virtual pages are covered by actual depth data. For example, if a mesh object is projected onto a region of virtual shading from the light source's viewpoint, then all virtual pages corresponding to that region will be marked as needing filling. For these marked virtual pages, the VSM system dynamically allocates actual texture memory from a pre-allocated pool of physical pages in graphics memory. This pool of physical pages consists of many fixed-size physical pages, for example, each page is 128x128 pixels. Once the physical pages are allocated, the relevant depth data rendered to the temporary render target in the previous step, including depth and depth squared values, are copied or directly rendered into these newly allocated physical pages. This process ensures that only pages containing actual shadow information are filled, while blank areas without geometry casting shadows do not consume valuable graphics memory. The final output of the movable light source-optimized virtual schlieren is a sparse collection of textures consisting of multiple physical pages that precisely contains the depth information of all shadow projections cast by the movable light source, optimized by S4.

[0075] In step S6, the scene G-buffer for the current screen is obtained. It is understood that deferred shading or deferred rendering is a widely adopted technique designed to address performance issues in multi-light source scenes. Its core idea is to separate geometry rendering from lighting calculations. Therefore, before applying shadows, the rendering pipeline needs to know which locations on the screen require shadows and what the surface properties of these locations are. Obtaining the scene G-buffer for the current screen provides this crucial per-pixel surface data, allowing subsequent lighting and shadow calculations to be performed efficiently in screen space, avoiding redundant geometry rendering.

[0076] One possible implementation of step S6 is as follows: The rendering pipeline first binds multiple render target textures to the GPU, and these textures will be part of the G-buffer. For example, one texture can be bound to store the world space position of each pixel, another texture to store the surface normals, and yet another texture to store the base color, albedo, and possibly other material parameters such as roughness, metallicity, etc. The size of these textures is the same as the screen resolution.

[0077] The GPU then iterates through all the geometry that needs to be rendered to the screen. For each geometry, its vertex data is processed by the vertex shader, converting 3D world coordinates into 2D screen coordinates. Then, during the rasterization stage, the GPU determines which pixels are covered by these geometries. For each covered pixel, the fragment shader is invoked. The fragment shader is the core of G-buffer generation. It doesn't calculate the final color, but rather calculates and outputs various surface properties of the pixel based on the geometry information corresponding to that pixel. For example, it calculates the pixel's precise 3D position in world space and writes it to the texture storing the position in the G-buffer; it calculates the normal vector of the surface containing the pixel, encodes it, and writes it to the texture storing the normals; it also obtains the base color of the material corresponding to the pixel and writes it to the texture storing the base color. If the material contains other properties, such as roughness or metallicity, this information is also calculated and written to other textures in the G-buffer. Sometimes, to save memory, these properties are packaged into different channels of the same texture. For example, one pixel on the screen might correspond to the surface of a red sphere. During the generation of the G-buffer, this pixel stores the world coordinates of that point on the sphere's surface in the position texture (e.g., X = 10.5, Y = 5.2, Z = 3.1), the surface normal vector of that point in the normal texture (e.g., X = 0.7, Y = 0.3, Z = 0.6), and red in the base color texture (e.g., R = 1.0, G = 0.0, B = 0.0). In this way, the G-buffer collects all the necessary lighting calculation information for every visible pixel on the screen during a single geometry rendering process.

[0078] In step S7, virtual shading is optimized based on the movable light source, and delayed lighting calculations are performed on each pixel in the scene G buffer to obtain the direct light contribution of the shadow to be cast. Accordingly, in order to efficiently apply the shadow effect to the final rendered scene in subsequent stages, the rendering pipeline needs to obtain detailed surface information of each visible pixel on the screen and calculate the lighting contribution of these pixels in the absence of shadow occlusion.

[0079] One possible implementation of step S7 is as follows: The rendering pipeline first configures the GPU to read multiple textures from the scene G buffer generated in step S6. These textures contain information such as the world space position, surface normals, and base color (albedo) for each pixel on the screen. Simultaneously, the rendering pipeline acquires the properties of the currently processed movable light source, including its position in world space, color, intensity, and light type. To perform deferred lighting calculations, the rendering pipeline draws a two-dimensional quadrilateral covering the entire screen. Each pixel of this quadrilateral triggers the execution of a fragment shader, thus achieving pixel-by-pixel lighting calculations.

[0080] In the fragment shader, for each pixel on the screen, the rendering pipeline first reads the detailed surface data corresponding to that pixel from the scene's G-buffer. For example, it obtains the pixel's precise position (P) in 3D world space, the surface normal vector at that position, and the surface's base color from the G-buffer. This data is pre-calculated and stored in the geometry pass. Next, the shader uses this surface information obtained from the G-buffer, combined with the properties of the current movable light source, to calculate the direct light contribution received by the pixel from that light source, without considering any shadow occlusion for the time being.

[0081] Lighting calculations follow a physically based lighting model: First, the direction vector from the pixel (P) to the light source is calculated, along with the distance from the pixel to the light source. Then, an attenuation factor is calculated based on the light source type and distance. For example, for a point light source, an inverse squared attenuation is used, meaning the light intensity decreases with the square of the distance. Next, the diffuse component of the light is calculated by taking the dot product of the pixel's surface normal and the ray direction, representing the effect of the angle between the ray and the surface on brightness, and multiplied by the pixel's base color, the light source color and intensity, and the attenuation factor. If the material supports it, a specular component is also calculated, taking into account the viewing direction and the direction of ray reflection to simulate a specular effect. These calculations integrate the light source's color and intensity, as well as the pixel's base color and material properties. For example, a white wall illuminated by a red point light source will have a red direct light contribution, with brightness depending on the light source intensity, distance, and the angle between the ray and the wall's normal.

[0082] Finally, the fragment shader writes the calculated direct light contribution, which has not yet been shadowed—a color value, such as an RGB three-channel floating-point number—into a new render target texture. This new render target texture is the direct light contribution to be shadowed, containing the lighting information for each pixel on the screen under ideal, unobstructed conditions.

[0083] In step S8, the lighting contribution is accumulated based on the direct light contribution to be shaded, Lumen global illumination and screen space reflection data, and game-defined post-processing parameters to obtain the final rendered frame. Background technology clearly points out that traditional rendering methods struggle to balance performance and visual quality, especially when dealing with complex lighting phenomena. A realistic game scene includes not only direct lighting from light sources but also indirect lighting (global illumination) formed by multiple reflections and scatterings of light within the scene, as well as reflections from object surfaces to the surrounding environment. Therefore, this application precisely accumulates and synthesizes all these complex lighting contributions, the global illumination provided by the Lumen system, and the screen space reflection data. Furthermore, various game-defined post-processing effects, such as tone mapping, anti-aliasing, and blooming, are applied to further enhance the artistic expression and visual quality of the image. This comprehensive accumulation and post-processing stage is the final step in achieving high-quality, high-efficiency real-time rendering. It integrates all separately calculated lighting and visual elements, ultimately generating a rendered frame that meets the expected visual effect, thus completely solving the problem of balancing performance and quality mentioned in background technology.

[0084] One possible implementation of step S8 is as follows: The rendering pipeline first configures the GPU to read the direct light contribution to be shaded, as well as the global illumination data provided by the Lumen system (in the form of textures or volumetric textures), and the reflection data generated by the screen space reflection (SSR) system (also a texture). Simultaneously, the rendering pipeline binds a final rendering target, which is either a back buffer for the framebuffer or an intermediate texture for subsequent post-processing.

[0085] Next, the rendering pipeline draws a 2D quadrilateral covering the entire screen, triggering a fragment shader to execute on each pixel of the screen. In this shader, for each pixel, the value is first read from the direct light contribution to be shaded. At this point, a shadow needs to be applied to this direct light contribution. To do this, the shader uses the pixel's world space position provided by the G buffer in step S6 to transform it to the shadow space of the current movable light source, using the light source's view projection matrix, and then samples the movable light source generated in step S5 to optimize the virtual schlieren. A shadow factor is obtained by comparing the sampled depth information with the pixel's own depth, or by using the variance information of the virtual schlieren to smooth the shadow calculation; this factor ranges from 0 to 1, where 0 represents full shadow and 1 represents full illumination. Subsequently, the read direct light contribution to be shaded is multiplied by this shadow factor to obtain the final shaded direct light contribution for that pixel.

[0086] Building upon this, the shader samples the indirect lighting contribution corresponding to that pixel from the Lumen global illumination data. The Lumen system uses techniques such as software ray tracing to pre-calculate or update the light bounce effects in the scene in real time, providing indirect lighting for diffuse and specular reflections. Simultaneously, the shader also samples the reflected light contribution of that pixel from the screen-space reflection data. Screen-space reflection technology utilizes depth and normal information in the G-buffer to simulate the reflection of visible objects within screen space. The direct light contribution from shadows, the Lumen global illumination contribution, and the screen-space reflection contribution are then summed to obtain the overall lighting result for that pixel.

[0087] Finally, this overall lighting result serves as input, passing through a series of game-defined post-processing passes. These post-processing effects are implemented in a chained structure, with each effect being a full-screen rendering process. For example, tone mapping is first applied to map high dynamic range lighting values ​​to the monitor's low dynamic range, while adjusting exposure and contrast—parameters preset by the game designer. Next, a bloom effect might be applied to simulate light overflow in overly bright areas. Then, color grading is performed, adjusting the overall color style of the image through lookup tables or direct color transformations. Finally, anti-aliasing techniques, such as temporal anti-aliasing or fast approximate anti-aliasing, are applied to eliminate jagged edges in the image. These post-processing parameters, such as exposure values, bloom thresholds, and color lookup tables, are all set during game development based on art style and performance requirements. After all post-processing effects, the final image data is written to the frame buffer, forming the final rendered frame, which is then displayed on the user's screen.

[0088] In summary, the Unreal Engine-based real-time dynamic lighting and shadow rendering optimization method based on the embodiments of this application is explained, which addresses the performance bottleneck caused by processing a large number of redundant geometry in real-time dynamic lighting and shadow rendering, as well as the lack of intelligent dynamic adaptability in existing solutions. First, based on camera view frustum and AI context data, a shadow importance score is assigned to each mesh object in the scene, prioritizing potential shadow casters. Then, a performance budget is evaluated based on the current frame rate and GPU load, and intelligent shadow caster selection and LOD application are performed on the sorted list of shadow casters accordingly. That is, the system no longer renders all shadows indiscriminately, but prioritizes the parts with the greatest impact on visual effects and dynamically adjusts rendering details based on real-time performance. Finally, these optimized shadow batches are sent to the light perspective rendering and VSM page filling process to generate movable light source optimized virtual shading, significantly reducing unnecessary computational overhead. This greatly improves rendering efficiency and frame rate stability while ensuring high-quality dynamic lighting and shadow effects, effectively solving the core problem of balancing performance and quality in background techniques.

[0089] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine, characterized in that, include: Acquire rendered scene graphs, camera view frustums, and AI context data. The rendered scene graphs contain transformation information, material information, and LOD information of all mesh objects in the game world. Based on the camera view frustum and the AI ​​context data, a shadow importance score is assigned to each grid object to obtain a sorted list of shadow projections; Based on the properties of the movable light source, the current frame rate, and the current GPU load, the sorted list of shadow projection objects is subjected to light source-object association and performance budget evaluation to obtain the list of projectors corresponding to the movable light source. Intelligent shadow projector selection and LOD application are performed on the list of projectors corresponding to the movable light source to obtain a batch of shadows to be rendered for the movable light source; The batch of shadows to be rendered for movable light sources is subjected to light perspective rendering and VSM page filling to obtain movable light source optimized virtual shading; Get the scene G buffer for the current screen; Based on the movable light source, virtual shading is optimized, and delayed illumination calculations are performed on each pixel in the scene G buffer to obtain the direct light contribution to the shadow. The final rendered frame is obtained by accumulating the lighting contribution based on the direct light contribution to be shaded, Lumen global illumination and screen space reflection data, and game-defined post-processing parameters.

2. The real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to claim 1, characterized in that, Based on the camera view frustum and the AI ​​context data, a shadow importance score is assigned to each mesh object to obtain a sorted list of shadow projections, including: Based on the mesh type of each mesh object, assign a basic shadow importance score to each mesh object; Based on the camera view frustum and the AI ​​context data, the basic shadow importance scores assigned to each grid object are adjusted in real time to obtain the sorted list of shadow projection objects.

3. The real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to claim 2, characterized in that, Based on the camera view frustum and the AI ​​context data, the basic shadow importance scores assigned to each grid object are adjusted in real time to obtain the sorted list of shadow projections, including: Based on the distance between each grid object and the camera, the basic shadow importance score is reduced using a smooth step function; Based on the pixel area occupied by each mesh object on the screen, the basic shadow importance score is linearly interpolated and clamped; Determine whether each grid object is within the camera's field of view to obtain a visibility status judgment result, and adjust the basic shadow importance score based on a first multiplier factor based on the visibility status judgment result; Based on the content prompts of the AI ​​context data, the basic shadow importance score is adjusted by a multiplier based on a second multiplier factor.

4. The real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to claim 3, characterized in that, The setting of the first multiplier factor and the second multiplier factor includes: Extract the initial factor of the first multiplier, the theoretical upper limit of the first multiplier factor, the initial factor of the second multiplier, and the theoretical upper limit of the second multiplier factor; Subtract one from the first initial multiplier factor and the second initial multiplier factor respectively to obtain the static probability values ​​of the first multiplier factor and the second initial multiplier factor; Based on the theoretical upper limit of the first multiplier factor and the theoretical upper limit of the second multiplier factor, calculate the correlation normalized benchmark coefficient between the static probability values ​​of the first multiplier factor and the static probability values ​​of the second multiplier factor; Based on the correlation normalized benchmark coefficients and using the clamping function, multiplier dynamic interval correlation is performed on the first multiplier factor static probability value and the second multiplier factor static probability value to obtain optimized first multiplier factor static probability value and optimized second multiplier factor static probability value. The optimized first multiplier static probability value and the optimized second multiplier static probability value are each added by one to obtain the first multiplier factor and the second multiplier factor.

5. The real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to claim 1, characterized in that, The properties of the movable light source include its location, radius of influence, and type.

6. The real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to claim 5, characterized in that, Based on the properties of movable light sources, the current frame rate, and the current GPU load, a light source-object association and performance budget evaluation are performed on the sorted list of shadow projection objects to obtain a list of projectors corresponding to the movable light sources, including: For each grid object in the sorted list of shadow projections, based on the transformation information of the grid object and the influence radius of the movable light source, grid objects that are not within the influence range of the movable light source are removed; Based on the current frame rate and the current GPU load, the allowable shadow caster threshold and LOD selection aggression of the movable light source are dynamically calculated.

7. The real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to claim 6, characterized in that, Intelligent shadow projector selection and LOD application are performed on the list of projectors corresponding to the movable light source to obtain a batch of shadows to be rendered for the movable light source, including: Mesh objects with a shadow importance score greater than the shadow caster threshold are selected to participate in shadow casting; If the shadow importance score of the mesh object is extremely high, cast shadows on the mesh object using the highest LOD; If the shadow importance score of the mesh object is medium, use secondary LOD to cast shadows on the mesh object; If the shadow importance score of the mesh object is low, the mesh object is shadowed using the lowest LOD.

8. The real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to claim 7, characterized in that, The highest LOD is LOD0, the next highest LOD is LOD1 or LOD2, and the lowest LOD is LOD3.

9. The real-time dynamic lighting and shadow rendering optimization method based on Unreal Engine according to claim 8, characterized in that, Performing light perspective rendering and VSM page filling on the batch of shadows to be rendered for a movable light source to obtain a movable light source optimized virtual texture includes: the GPU rendering depth information of each mesh object in the batch of shadows to be rendered for a movable light source from the perspective of the movable light source, and then performing VSM page filling on them to obtain the movable light source optimized virtual texture.