Real-time dynamic light and shadow rendering optimization method based on unreal engine
By obtaining the rendering scene graph and AI context data in Unreal Engine, assigning shadow importance scores to mesh objects, and combining light source properties and GPU load to make intelligent shadow caster selections, the performance bottlenecks of light and shadow rendering and the difficulty in balancing visual effects in complex scenes are solved, achieving efficient light and shadow rendering optimization.
Patent Information
- Application Number
- CN202510862018.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-06-25
AI Technical Summary
Existing technologies face performance bottlenecks and difficulty balancing visual effects when rendering real-time dynamic light and shadow in complex scenes, especially when processing a large amount of redundant geometry, which leads to a drop in frame rate and a waste of computing resources.
By obtaining the rendering scene graph, camera frustum and AI context data, shadow importance scores are assigned to mesh objects, and intelligent shadow caster selection and LOD application are performed based on light source properties and GPU load, virtual schlieren generation is optimized, and finally lighting contribution accumulation is performed to improve rendering efficiency.
It significantly reduces unnecessary computing overhead, 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.
Smart Images

Figure CN120747334A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of light and shadow rendering, and more specifically, to a real-time dynamic light and shadow rendering optimization method based on Unreal Engine. Background Art
[0002] In the field of modern graphics rendering, especially in real-time interactive applications developed with advanced game engines such as Unreal Engine, dynamic lighting and shadow effects are crucial for building immersive and realistic virtual worlds. Accurate 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, especially shadow generation in complex scenes, is one of the most computationally expensive links in the graphics rendering pipeline. With the increasing complexity of scenes, the increase in the number of light sources, and the pursuit of higher visual quality, traditional shadow rendering methods often face huge performance bottlenecks, resulting in frame rate drops and screen freezes, which seriously affect the user experience. How to effectively optimize the performance of real-time dynamic lighting and shadow rendering while ensuring visual effects has become a key issue that needs to be urgently addressed in the current field of graphics technology.
[0003] Existing real-time shadow rendering solutions, such as traditional shadow mapping or cascaded shadow mapping, can achieve dynamic shadow effects, but their efficiency and quality often struggle to balance when handling large-scale, highly detailed scenes. These methods typically require rendering depth information for all potential shadow-casting objects for each light source, regardless of whether these objects significantly contribute to the final visible shadow, resulting in a large amount of redundant calculations. For example, objects that are outside the camera's view frustum, are extremely far away, or occupy a very small pixel area on the screen may have negligible shadow contributions, but still consume precious GPU resources. Even advanced technologies such as virtual texture shadows introduced in Unreal Engine, while improving resolution and detail, can still lead to performance bottlenecks 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] In order to solve the above problems, according to one aspect of the present application, a real-time dynamic light and shadow rendering optimization method based on Unreal Engine is provided, which includes:
[0006] Get the rendered scene graph, camera frustum, and AI context data. The rendered scene graph contains transformation information, material information, and LOD information for all mesh objects in the game world.
[0007] Assigning a shadow importance score to each mesh object based on the camera frustum and the AI context data to obtain a ranked shadow caster list;
[0008] Based on the properties of the movable light source, the current frame rate, and the current GPU load, perform light source-object association and performance budget evaluation on the sorted shadow casting object list to obtain a projector list corresponding to the movable light source;
[0009] Performing intelligent shadow caster 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;
[0010] Performing light perspective rendering and VSM page filling on the batch of shadows to be rendered for the movable light source to obtain optimized virtual schlieren for the movable light source;
[0011] Get the scene G buffer of the current screen;
[0012] Based on the movable light source, the virtual schlieren are optimized, and a delayed lighting calculation is performed on each pixel in the scene G buffer to obtain a direct light contribution to be shadowed;
[0013] The final rendered frame is obtained by accumulating the lighting contribution based on the direct light contribution to be shadowed, Lumen global illumination and screen space reflection data, and the post-processing parameters defined by the game.
[0014] Compared to existing technologies, this application provides an Unreal Engine-based real-time dynamic lighting and shadow rendering optimization method that addresses performance bottlenecks caused by processing large amounts 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 the camera frustum and AI context data, each mesh in the scene is assigned a shadow importance score, prioritizing potential shadow casters. Subsequently, 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. In other words, the system no longer renders all shadows indiscriminately, but prioritizes those with the greatest visual impact and dynamically adjusts rendering details based on real-time performance. Finally, these optimized batches of shadows to be rendered are fed into the ray perspective rendering and VSM page filling processes to generate virtual schlieren optimized for movable light sources. This significantly reduces unnecessary computational overhead, significantly improving rendering efficiency and frame rate stability while maintaining high-quality dynamic lighting and shadow effects, effectively resolving the core issue of the prior art in balancing performance and quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other purposes, features, and advantages of the present application will become more apparent through a more detailed description of the embodiments of the present application in conjunction with the accompanying drawings. The accompanying drawings are intended to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. 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 light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application.
[0017] Figure 2 This is a data flow diagram of a real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application.
[0018] Figure 3 This is a flowchart of step S2 in the real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application.
[0019] Figure 4 This is a flowchart of step S3 in the real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application.
[0020] Figure 5 This is a flowchart of step S4 in the real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. While the drawings illustrate certain embodiments of the present disclosure, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0022] In response to the problems in the above background technology, this application proposes a real-time dynamic light and shadow rendering optimization method based on Unreal Engine. Figure 1 This is a flowchart of a real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application. Figure 2 The data flow diagram of the real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to the embodiment of the present application is shown in FIG. Figure 1 and Figure 2As shown, according to the embodiment of the present application, the real-time dynamic light and shadow rendering optimization method based on the Unreal Engine includes: S1, obtaining a rendering scene graph, a camera cone and AI context data, wherein the rendering scene graph contains transformation information, material information and LOD information of all mesh objects in the game world; S2, based on the camera cone and the AI context data, assigning a shadow importance score to each mesh object to obtain a sorted shadow projection list; S3, based on the properties of the movable light source and the current frame rate and the current GPU load, performing light source-object association and performance budget evaluation on the sorted shadow projection list to obtain a projector list corresponding to the movable light source; S4, The projector list corresponding to the light source performs intelligent shadow projector selection and LOD application to obtain a batch of shadows to be rendered for the movable light source; S5, performs light perspective rendering and VSM page filling on the batch of shadows to be rendered for the movable light source to obtain optimized virtual schlieren for the movable light source; S6, obtains the scene G buffer of the current screen; S7, based on the optimized virtual schlieren of the movable light source, performs delayed lighting calculation on each pixel in the scene G buffer to obtain the direct light contribution to be shadowed; S8, accumulates the lighting contribution based on the direct light contribution to be shadowed, Lumen global illumination and screen space reflection data and post-processing parameters defined by the game to obtain the final rendered frame.
[0023] In step S1, the rendering scene graph, camera frustum, and AI context data are acquired. The rendering 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 indiscriminately process all potential shadow-casting objects, leading to a large amount of redundant computation and performance bottlenecks. To address this issue, the present method requires detailed information about all mesh objects in the game world to enable accurate identification and manipulation of these objects. Furthermore, acquiring camera frustum data is crucial because it defines the area visible to the player, enabling the rendering process to prioritize objects that impact the final image and cull irrelevant objects outside the 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 shadows of objects closely related to the player's current task or AI behavior. The comprehensive acquisition of this data is a prerequisite for intelligent shadow importance scoring, performance budget assessment, and dynamic LOD application, effectively reducing unnecessary rendering overhead and improving rendering efficiency and frame rate stability.
[0024] A possible implementation of step S1: At the beginning of each frame's rendering, the rendering pipeline, a series of computational stages in the graphics processing that converts 3D scene data into the final 2D screen image, first obtains the rendered scene graph. The rendered scene graph is a data structure maintained internally by the game engine that logically organizes all 3D entities in the game world. This scene graph is constructed from asset files when the game loads and is updated in real time as objects are created, destroyed, or moved during gameplay. Specifically, it contains transformation information for mesh objects: for each mesh in the scene graph, its position, rotation, and scale in world coordinates are obtained. This data is stored as a 4x4 transformation matrix and is used to transform the object's local coordinates into world coordinates. For example, the transformation matrix for a character mesh is updated in real time to accurately determine its position and orientation in the game world. Material information: The material properties associated with each mesh are obtained, including texture maps such as diffuse, normal, roughness map, color, and shading model parameters. This information defines the visual characteristics of the object's surface. While not directly used for shadow casting, it is crucial for final lighting calculations and visual presentation. LOD information, which retrieves data about the multiple levels of detail (LODs) preset for each mesh. A mesh may contain geometry at different levels of complexity, such as LOD0 (highest detail), LOD1, and LOD2. This information indicates which version of the mesh should be used at different distances or importance.
[0025] Next, obtain the camera's view frustum. The camera's view frustum is a geometrically truncated cone defined by six planes: the near clipping plane, the far clipping plane, the left clipping plane, the right clipping plane, the top clipping plane, and the bottom clipping plane. It is calculated using the current frame's camera parameters, including the camera's position in the world, its orientation, the field of view angle (e.g., 90 degrees), the 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 frustum culling.
[0026] Finally, obtain AI context data. AI context data is a dynamic stream of information obtained from the game logic or AI module. It reflects information related to AI behavior or key game states in the game world. For example, this may 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 stealthed. This data is provided in the form of Boolean flags, enumeration values, or specific data structures. Its content is preset by the game designer and updated in real time by the game runtime logic.
[0027] In step S2, a shadow importance score is assigned to each mesh object based on the camera frustum and the AI context data to obtain a ranked list of shadow casters. Accordingly, background art clearly indicates that traditional shadow rendering methods often indiscriminately process all potential shadow-casting objects in the scene. Even objects that are outside the camera frustum, extremely far away, or occupy a negligible pixel area on the screen consume valuable GPU resources, leading to performance bottlenecks and frame rate drops. Even advanced technologies such as virtual texture shadows in Unreal Engine can lead to performance imbalances due to processing unnecessary geometry if they lack intelligent input management. Therefore, to address this inefficient, one-size-fits-all rendering approach, the present application assigns a shadow importance score to each mesh object based on the camera frustum and AI context data. This allows the rendering pipeline to intelligently identify and quantify each object's visual contribution and gameplay relevance to the final shadow effect. The camera frustum data ensures that only objects that have an impact on the currently visible image 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 shadows of objects related to the player's current task or key AI behaviors. The resulting sorted list of shadow casters provides a precise priority basis for subsequent performance budget assessment and intelligent LOD application, ensuring that computing resources are focused on shadow generation that has the greatest impact on visual effects and user experience, significantly reducing redundant calculations and improving rendering efficiency and frame rate stability.
[0028] Specifically, in one example of the present application, Figure 3 Flowchart of step S2 in the real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application. Figure 3 As shown, step S2, based on the camera view cone and the AI context data, assigns a shadow importance score to each mesh object to obtain a sorted shadow projection list, including: S21, based on the mesh type of each mesh object, assigning a basic shadow importance score to each mesh object; S22, based on the camera view cone and the AI context data, performing real-time factor adjustment on the basic shadow importance score assigned to each mesh object to obtain the sorted shadow projection list.
[0029] It should be understood that in complex rendering scenes, different types of mesh objects have different importance to the final visual effects and shadow quality. For example, the accuracy and presence of the shadow of a main character model, a large building, or a key game prop are usually more critical than that of a piece of grass, a small stone, or a background decoration. If these objects are not distinguished and the shadows of all objects are treated equally, a large amount of computing resources will be wasted on objects that have little visual impact, thereby exacerbating the performance bottlenecks and redundant calculation problems mentioned in the background technology. Based on this, the present application pre-identifies those objects that may require higher shadow quality in any case by assigning basic shadow importance scores according to mesh types at an early stage, providing a reasonable starting point for subsequent real-time factor adjustments and performance budget allocations, ensuring that computing resources can be more effectively focused on the parts that have the greatest impact on user experience, thereby improving overall rendering efficiency.
[0030] A possible specific implementation process of step S21 is as follows: First, define the mesh type. During the game development process, various types of mesh objects in the scene are pre-classified. These classifications are determined based on the object's function in the game, visual prominence, size, or its 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 effect particles, etc. These mesh types are marked by artists or technical artists when the assets are imported, or preliminarily classified by automated scripts based on properties such as the number of vertices and bounding box size of the mesh.
[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 take a discrete scale (e.g., Very High, High, Medium, Low, Very Low) or a continuous scale (e.g., 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 quality requirements, and performance trade-offs. For example, a main character mesh type might be given a very high base shadow importance score (e.g., 100) because its shadows directly impact the player's visual focus and immersion. Large building mesh types might be given a high base shadow importance score (e.g., 80) because they typically cast large and noticeable shadows. Common prop mesh types might be given a medium base shadow importance score (e.g., 50). Mesh types such as vegetation or special effect particles might be given a low or very low base shadow importance score (e.g., 20 or 10) because their shadows may be less noticeable or their rendering cost needs to be strictly controlled.
[0032] Finally, assign scores. Iterate over each mesh in the rendered scene graph. For each mesh, query its tagged mesh type. Then, based on a pre-defined mapping between mesh type and base shadow importance score, assign the corresponding score to the mesh. For example, if a mesh is identified as a primary character type, its base shadow importance score is set to Very High, or a value of 100. This way, each mesh is given an initial shadow priority that reflects its inherent visual importance.
[0033] The background art clearly points out that even the advanced technologies in Unreal Engine suffer from performance imbalances and are unable to fully realize their potential due to the lack of intelligent input management. 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 the camera's viewing angle, the object's visibility on the screen, its distance, and the game logic, i.e., the AI context. For example, if an object originally assigned a high base score is currently very far from the camera, occupies only a very small pixel area on the screen, or is completely outside the camera's frustum, then the visual contribution of its shadow will be negligible. Rendering its shadow with high priority at this time will result in a huge waste of computation. Therefore, in the technical solution of this application, by introducing camera frustum and AI context data for real-time factor adjustment, it can ensure that shadow rendering resources are intelligently allocated to those objects that are truly important to the visual effects and game experience in the current frame, thereby effectively solving the problem of redundant calculations and achieving dynamic optimization of rendering strategies, significantly improving rendering efficiency and frame rate stability.
[0034] Specifically, in an example of the present application, step S22, based on the camera cone and the AI context data, performs real-time factor adjustment on the basic shadow importance score assigned to each mesh object to obtain the sorted shadow projection object list, including: S221, based on the distance between each mesh object and the camera, performs a smooth step function attenuation on the basic shadow importance score; S222, based on the pixel area occupied by each mesh object on the screen, performs linear interpolation and clamping on the basic shadow importance score; S223, determines whether each mesh object is within the camera cone to obtain a visibility status judgment result, and performs a multiplier adjustment on the basic shadow importance score based on a first multiplier factor based on the visibility status judgment result; S224, based on the content prompt of the AI context data, performs a multiplier adjustment on the basic shadow importance score based on a second multiplier factor.
[0035] A possible specific implementation process 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 smooth step function. The smooth step function is a commonly used interpolation function, and its mathematical expression is such as x*x*(3-2*x), where x is a normalized value between 0 and 1. To achieve the attenuation effect, a close distance threshold is defined, such as 10 meters and a far distance threshold is defined, such as 100 meters. Calculate a normalized distance = (current distance - close distance threshold) / (far distance threshold - close distance threshold) and clamp it between 0.0 and 1.0. Then, input the normalized distance into the smooth step function to obtain a smooth attenuation factor. The final distance attenuation multiplier is 1-attenuation factor, so that when the object is close, the multiplier is close to 1, and when the object is far, the multiplier is close to 0. Finally, the current shadow importance score is multiplied by the calculated distance attenuation multiplier. For example, if an object has a base score of 80 and is at a distance of 50 meters, with a preset close distance of 10 meters and a far distance of 100 meters, then the normalized distance = (50-10) / (100-10) ≈ 0.444. After the smoothed step function calculation, this is approximately 0.416, and 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 is worth mentioning that the pixel area is obtained by projecting the world space bounding box of the object into the screen space and calculating 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, as well as corresponding minimum multipliers, such as 0.1 and maximum multipliers, such as 1.0, are preset. The linear difference is calculated as follows: first, the normalized ratio of the pixel area within the threshold range is calculated = (current pixel area - minimum pixel area threshold) / (maximum pixel area threshold - minimum pixel area threshold) and clamped between 0 and 1. Then, the final pixel area multiplier is calculated = minimum multiplier + (maximum multiplier - minimum multiplier) * normalized 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, the normalized ratio = (1200-100) / (10,000-100)≈0.111. At this time, the pixel area multiplier = 0.1 + (1.0 - 0.1) * 0.111 ≈ 0.2. The score becomes 46.72 * 0.2 = 9.344.
[0037] Then, S223 is executed. Initial frustum culling is performed. When a mesh object is completely outside the camera's frustum, such as a tree far behind the player character, the frustum culling algorithm explicitly determines that it is completely invisible. At this point, its shadow importance score is multiplied by 0, completely removing its shadow rendering priority and significantly saving computational resources. To avoid visual abruptness, this step introduces a smooth transition mechanism in a more refined implementation. This involves setting a transition region at the edge of the camera's 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 mesh object's specific position within the transition region at the edge of the camera's frustum. Specifically, after the distance and pixel area adjustments in step S222, multiple mesh objects currently have a shadow importance score of 9.344. For objects within the transition zone at the edge of the camera's frustum, such as a streetlight just entering or leaving the field of view, the system calculates a smooth visibility multiplier between 1 and 2 based on their position within the transition zone. This first multiplier, for example, 1.2, indicates a moderate increase in their importance relative to the baseline of 1.0 at minimum visibility (e.g., 9.344 * 1.2 = 11.2128). This avoids abrupt shadow appearances and provides a smoother visual experience. Conversely, for objects completely within the camera's frustum and away from the transition zone, such as a key item box directly in front of the player character and completely centered in the field of view, their first multiplier is set to 2.0, ensuring their shadow rendering priority is fully protected. This smooth visibility adjustment more effectively filters out objects that contribute less to the current visual quality, focusing computing resources on visible objects that truly require shadow rendering. This ensures visual smoothness while achieving efficient resource management.
[0038] Finally, S224 is executed. First, the system searches for preset AI context multipliers. These multipliers are designed to range between 1 and 2 and are used to fine-tune the object's shadow importance based on the AI context. These AI context multipliers are pre-set by the game designer and stored in a lookup table or configuration 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 target currently being interacted with by the player, a second multiplier of 1.8 is applied; if it indicates that it is a mission-critical item, a second multiplier of 1.5 is applied; if there is no specific indication, a second multiplier 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 adjusted by the AI context. For example, if the shadow importance score obtained after the visibility state determination described above is 11.2128, and the AI context indicates that it is the player's current target, the second multiplier is 1.8, resulting in a score of 11.2128 * 1.8 ≈ 20.18. After all of the above adjustments are completed, each mesh will have a final shadow importance score that reflects its current real-time importance. The rendering pipeline will sort all meshes in descending order based on these final scores, resulting in a sorted list of shadow casters.
[0039] It's important to note that while the base shadow importance score is adjusted based on the multiplier factors above, both based on the visibility state of each mesh and the AI contextual data hint, these two components are not completely independent but rather interrelated. Specifically, the AI contextual data hint and the visibility state of each mesh overlap in terms of the mesh's state. Therefore, if the first and second multipliers can be correlated, the accuracy of the base shadow importance score can be significantly improved.
[0040] Preferably, in one embodiment of the present application, the setting of the first multiplication factor and the second multiplication factor includes:
[0041] Extracting the first multiplier initial factor, the first multiplier factor theoretical upper limit, the second multiplier initial factor, and the second multiplier factor theoretical upper limit. That is, obtaining these values can provide complete context and boundaries, so that the correlation optimization between the multiplier factors can be carried out within a clear, controlled, and design-intended framework;
[0042] The first multiplier initial factor and the second multiplier initial factor are respectively subtracted by one to obtain the first multiplier factor static probability value and the second multiplier factor static probability value. In order to take into account that in most cases, both parts of the multipliers are in the interval [1, 2], and therefore, in order to make a more effective multiplier interval association, the two parts of the multipliers, for example, α and β, are respectively subtracted by one to constrain them to the interval [0, 1], so as to consider their dynamic probability superposition characteristics from the static probability distribution dimension, that is:
[0043] p α =α-1
[0044] p β =β-1
[0045] Among them, α and β are the first multiplier initial factor and the second multiplier initial factor, which are obtained based on the experience and testing of game developers or system designers. For example, α and β can be 1.45 and 1.5 respectively. α and p β They are the static probability value of the first multiplier factor and the static probability value of the second multiplier factor, so that the multiplier interval can achieve the optimal selection of the association state perception through the dynamic association under the superposition attribute;
[0046] Based on the theoretical upper limit of the first multiplier factor and the theoretical upper limit of the second multiplier factor, the correlation normalization benchmark coefficient between the static probability value of the first multiplier factor and the static probability value of the second multiplier factor is calculated. That is, for these two parts of the multiplier, within the predetermined interval [1, 2], there is usually a defined maximum value, for example, close to 1.5. Therefore, the maximum value here is actually used as a normalized benchmark for the correlation. That is, when the correlation relationship between the two parts of the multiplier is uncertain, a reasonable upper limit is used to coordinate the mutual exclusion effect under non-overlapping attributes to avoid the difference in dynamic probability intensity state under non-pure cooperation. Therefore, the correlation normalization benchmark coefficient is introduced as follows:
[0047]
[0048] Among them, α max and β max It is the theoretical upper limit of the first multiplier factor and the theoretical upper limit of the second multiplier factor. It is the maximum value pre-set by the game developer or system designer based on experience, testing and game requirements, such as α max and β max are 1.5 and 1.6 respectively, and γ is the correlation normalization benchmark coefficient;
[0049] Based on the association normalization reference coefficient and using a clamping function, the first multiplier factor static probability value and the second multiplier factor static probability value are respectively associated with each other in a multiplier dynamic interval to obtain an optimized first multiplier factor static probability value and an optimized second multiplier factor static probability value. That is, the clamping function is used to constrain the mutually exclusive effect of state judgment relative to the dynamic interval, thereby performing association state perception under non-pure collaboration based on superposition properties, that is:
[0050] p′ α =clip(p α ,p β ×γ,p β / γ)
[0051] p′ β =clip(p β ,p α ×γ,p α / γ)
[0052] in,
[0053]
[0054] Among them, clip is the clamping function, p' α and p' β They are the optimized static probability value of the first multiplier factor and the optimized static probability value of the second multiplier factor, that is, through the clamping function, the state judgment is essentially combined with the continuous interval distribution, thereby effectively performing the dynamic interval association of the multipliers. In this way, by further performing the associated state perception on the basis of weakening the difference in the dynamic probability intensity state, the two predetermined multipliers can be effectively associated, thereby improving the accuracy of the basic shadow importance score;
[0055] The optimized first multiplier factor static probability value and the optimized second multiplier factor static probability value are respectively added by one to obtain the first multiplier factor and the second multiplier factor, that is:
[0056] a=p′ α +1
[0057] b=p′ β +1
[0058] Among them, a and b are the first multiplier factor and the second multiplier factor respectively, that is, the static probability value after association optimization in the interval [0,1] is remapped back to the original multiplier interval [1,2] to obtain the first multiplier factor and the second multiplier factor that have been collaboratively optimized and finally used to adjust the shadow importance score. Thereafter, the optimized first multiplier factor and the second multiplier factor can more accurately and collaboratively adjust the shadow importance score of the mesh object.
[0059] In step S3, based on the properties of the movable light sources, the current frame rate, and the current GPU load, the sorted list of shadow casters is subjected to light-object association and performance budget evaluation to obtain a list of projectors corresponding to the movable light sources. It should be understood that while intelligent scoring and sorting yield a list of potential shadow casters 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 performance impact. The background art emphasizes the high computational cost of real-time dynamic lighting and shadow rendering, as well as the inefficiency of existing solutions when processing 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 each light source's shadow casters, unnecessary computation can still occur, such as rendering shadows for objects outside a light source's range of influence or maintaining excessively high shadow quality even when system performance is strained. Therefore, the present application utilizes light-object association to ensure that only objects truly within a light source's range of influence are considered for casting shadows, significantly reducing redundant computation. Performance budget assessment allows the rendering pipeline to dynamically adjust the number of shadow casts and the level of detail allowed for a light source based on the current frame rate and GPU load. This enables the rendering system to intelligently find the optimal balance between visual quality and runtime performance, avoiding lags when performance is high while providing more refined shadow effects when performance is sufficient, effectively resolving 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 position, influence radius, 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 the basis for lighting and shadow calculations and are crucial for achieving realistic rendering effects.
[0061] A possible specific implementation process of the properties of movable light sources: Position refers to the precise coordinates of the movable light source in the three-dimensional game world. During the game development stage, the designer places the light source in the scene through the engine's editor and sets its initial position. Once the game is running, if the light source is set to be movable, its position will be updated in real time according to the game logic, physical simulation, character animation or script instructions. For example, the position of a flashlight held by a player will change continuously as the player's character moves. The engine manages the transformation information of all game objects, including position, rotation and scale, by maintaining a scene graph or component system. When the rendering pipeline needs to perform lighting and shadow calculations in each frame, it will query and obtain the current precise world coordinate position of each movable light source from these systems.
[0062] The influence radius defines the maximum distance range within which a movable light source can illuminate or cast shadows. Objects outside this range will not be affected by the light source. This property is also set by the designer for each light source during game development. For example, a point light source may be configured with an influence radius of 20 meters, and a spotlight may have a specific cone angle, and its influence radius is determined by this angle and the intensity of the light source. The engine stores the influence radius internally as a core property of the light source component. When the rendering pipeline needs to determine which objects may be affected by a certain light source, it directly queries the influence radius property of the light source and uses it for preliminary geometry culling.
[0063] The light type is the basic emission pattern and behavior of a movable light source. Common types include point lights (emitting light uniformly in all directions), spotlights (emitting light within a cone), and directional lights (simulating an infinitely distant light source, such as sunlight). This property is specified by the designer when the light source is created and remains constant for the duration of the game. The light type determines the mathematical model and algorithm used by the engine to calculate light attenuation, shadow casting direction, and intensity.
[0064] Specifically, in one example of the present application, Figure 4 Flowchart of step S3 in the real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application. Figure 4 As shown, step S3, based on the properties 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 shadow projection object list to obtain a projector list corresponding to the movable light source, including: S31, for each mesh object in the sorted shadow projection object list, based on the transformation information of the mesh object and the influence radius of the movable light source, eliminates the 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 calculates the shadow projector threshold and LOD selection aggressiveness allowed by the movable light source.
[0065] A possible specific implementation process of step S3: First, execute S31. For each mesh object, obtain the center point position of the mesh object in the world space. Then, calculate the Euclidean distance from the center point of the mesh object to the position of the current movable light source. 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 out of 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 shadow projection object list 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 preliminarily filtered projector list for the current movable light source will be obtained, which only contains mesh objects that may theoretically 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. The rendering pipeline then 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's shadow importance score must be in order to be allowed to cast shadows in subsequent steps. This threshold is calculated dynamically. For example, a performance mapping curve or lookup table can be pre-set: when the current frame rate is above 60 frames per second and the current GPU load is below 70%, the threshold may be set to a lower value, such as 10, allowing more objects to cast shadows; whereas when the current frame rate is below 30 frames per second and the current GPU load is above 90%, the threshold may 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 determine the corresponding threshold. This threshold ensures that only the highest-priority shadows are rendered during performance constraints. LOD selection aggressiveness is a parameter that guides the strategy for selecting mesh LODs in subsequent steps. It is also calculated dynamically. For example, when performance is good, the aggressiveness may be set to low, meaning that even moderately important objects tend to use higher LODs for shadow casting; while when performance is poor, the aggressiveness may be set to high, meaning that even highly important objects may be forced to use lower LODs for shadow casting to save rendering overhead. This aggressiveness can be a number, such as 0 to 1, or an offset that maps directly to the LOD level. For example, when the aggressiveness is 0, LODs 0 or 1 may be preferred; when the aggressiveness is 1, LODs 2 or 3 may be preferred. The result is a list of casters, a shadow caster threshold, and LOD selection aggressiveness for the movable light source.
[0067] In step S4, intelligent shadow caster 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 influence range of the light source, and the rendering budget, shadow caster threshold and LOD selection aggressiveness have been calculated based on the current performance status, this budget has not yet been specifically applied to each mesh object. Background technology points out that traditional methods lead to performance bottlenecks due to the lack of intelligent dynamic adjustment strategies. Therefore, in this application, intelligent shadow caster 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 projection according to real-time performance pressure, and only the most important shadows are retained when performance is tight, directly reducing rendering batches and drawing calls, and further selecting the most appropriate geometric complexity based on their importance and performance budget. This avoids the huge performance overhead brought about by using high-precision models for shadow rendering for all objects, and solves the core technical problem of the difficulty in balancing performance and quality in the background technology.
[0068] Specifically, in one example of the present application, Figure 5 Flowchart of step S4 in the real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to an embodiment of the present application. Figure 5 As shown, step S4, intelligent shadow caster 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, including: S41, selecting a mesh object whose shadow importance score is greater than the shadow caster threshold to participate in shadow projection; 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 secondary 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] A possible implementation of step S4: First, execute S41. For each mesh object in the list, the rendering pipeline compares its shadow importance score with the shadow caster threshold. For example, based on the current low frame rate, the calculated shadow caster threshold is 50. If a mesh object currently traversed has a shadow importance score of 65, since 65 is greater than 50, it passes the screening and proceeds to the subsequent LOD selection stage. Conversely, if another mesh object has a score of 30, since 30 is less than 50, it is directly discarded and does not participate in the shadow casting of the light source. This step effectively reduces the number of shadow casters 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 based on their shadow importance score and the aggressiveness of the LOD selection. To achieve this, the score classification criteria need to be pre-defined. For example, a score greater than 80 can be set as very high, between 30 and 80 as medium, and less than 30 as low. Specifically, in an example of the present application, the highest LOD is LOD0, the secondary LOD is LOD1 or LOD2, and the lowest LOD is LOD3.
[0070] Next, the decisions from S42 to S44 are executed. If a mesh's shadow importance score is extremely high, for example, a score of 90, then according to the rules of S42, it will be assigned to use the highest LOD, namely, the LOD0 model, for shadow casting. However, the LOD selection aggressiveness adjusts this. If performance is sufficient and the aggressiveness is low, LOD0 will remain. However, if performance is tight and the aggressiveness is high, it may be forced to downgrade the LOD level to LOD1, sacrificing a small amount of detail in exchange for improved performance. If a mesh's shadow importance score is medium, for example, a score of 55, then according to the rules of S43, it will be assigned to use a secondary LOD, either LOD1 or LOD2. The choice of LOD1 or LOD2 can be determined based on the score's position within the medium range, or LOD1 can be selected by default. Similarly, the LOD selection aggressiveness adjusts this. Under high performance pressure, it may be forced to use a lower LOD2 or even LOD3. If a mesh object's shadow importance score is low, for example, a score of 25, but still above the threshold, it will be assigned to use the lowest LOD, that is, the LOD3 model, for shadow casting according to the rules of S44. In this case, since it is already the lowest detail, it is no longer affected by the aggressiveness of the LOD selection. Finally, for each mesh object that passes the S41 screening, it is determined whether it participates in the projection and which specific LOD model to use. Combining all these mesh object-LOD model pairs forms a batch of shadows to be rendered for the movable light source.
[0071] In step S5, the shadow batches to be rendered for the movable light sources are subjected to light perspective rendering and VSM page filling to obtain optimized virtual schlieren for the movable light sources. It should be understood that even if a highly optimized and streamlined shadow batch to be rendered for the movable light sources is obtained through intelligent shadow caster selection and detail level application, how to efficiently convert these batches into actually usable shadow data is still a challenge faced by real-time rendering. The traditional shadow mapping technology mentioned in the background art often requires rendering the entire scene into a fixed-size texture, resulting in insufficient resolution, severe aliasing, or occupying a large amount of memory and bandwidth due to excessive size. Even advanced virtual texture technology, without intelligent management, may cause performance imbalance due to processing unnecessary geometry. Therefore, the present application utilizes virtual texture shadow technology to obtain optimized virtual schlieren in a memory-efficient and performance-friendly manner. By rendering depth information from the light source perspective and performing virtual texture shadow page filling, it can be ensured that texture pages are only allocated and filled for the areas where shadows are actually cast, avoiding the redundant storage and rendering of traditional shadow maps.
[0072] Specifically, in an example of the present application, step S5, performs light perspective rendering and VSM page filling on the batch of shadows to be rendered for the movable light source to obtain the optimized virtual schlieren of the movable light source, including: the GPU renders the 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 fills the VSM page on it to obtain the optimized virtual schlieren of the movable light source.
[0073] One possible implementation of step S5: First, the rendering pipeline sets up a virtual camera based on the properties of the movable light source, specifically its position and light type. For example, if the light source is a point light, the rendering pipeline sets up six virtual cameras, one for each of the six faces of the cubemap. Each camera is centered at the light source and uses a perspective projection facing a different direction. If the light source is a spotlight, a virtual camera is set up at the light source, facing in its direction, and using a perspective projection that matches the spotlight's cone angle. For directional lights, although they have no specific position, an orthographically projected virtual camera is set up, facing in the same direction as the light source and covering the area of the scene where shadows are to be cast. After setting up the virtual cameras, the GPU binds a temporary render target—a depth buffer or a texture containing depth and depth squared information—to receive the rendered results. The GPU then iterates over the meshes filtered and applied to the level of detail in step S4. For each mesh in the batch, the GPU transforms it from world space to the space of the virtual light camera and renders only its depth information. That is, during the rendering process, the pixel shader does not calculate the color, but directly outputs the depth value of the distance from the pixel to the light source, or to support the subsequent variance shadow mapping technology, outputs the depth value and its square value at the same time. This depth information is written to the preset temporary rendering target.
[0074] Next, the rendered depth information is populated with VSM (Virtual Texture Shadow) pages. VSM is an efficient shadow map management technique that divides the large potential shadow space into fixed-size virtual pages, allocating physical memory only for those pages that actually contain shadow-casting geometry. During this phase, the rendering pipeline analyzes the depth information rendered to the temporary render target in the previous step and identifies which virtual pages are covered by actual depth data. For example, if a mesh object, from the light's perspective, casts a shadow over a certain area of the virtual schlieren, all virtual pages corresponding to that area are marked for populating. 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 consists of fixed-size physical pages, for example, each 128x128 pixels. Once the physical pages are allocated, the relevant depth data, including depth and depth-squared values, rendered to the temporary render target in the previous step is copied or rendered directly into these newly allocated physical pages. This process ensures that only pages containing actual shadow information are filled, while empty areas without geometry casting shadows do not take up valuable graphics memory. The final output of the movable light optimized virtual schlieren is a sparse texture collection consisting of multiple physical pages that accurately contains the depth information of all shadow casters cast by the movable light after S4 optimization.
[0075] In step S6, the scene G buffer of the current screen is obtained. It is understandable that deferred shading or deferred rendering is a widely adopted technology that aims to solve performance problems in multi-light source scenes. Its core idea is to separate geometry rendering from lighting calculations. Therefore, before applying shadows, the rendering pipeline must first know which positions on the screen need to be shadowed and what properties the surfaces at these positions have. The purpose of obtaining the scene G buffer of the current screen is to provide these critical pixel-by-pixel surface data, thereby allowing subsequent lighting and shadow calculations to be performed efficiently in screen space, avoiding repeated geometry rendering.
[0076] In one possible implementation of step S6, the rendering pipeline first binds multiple render target textures to the GPU. These textures will be used as 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 normal, and another texture to store the base color, albedo, and possibly other material parameters such as roughness and metallic. The size of these textures is the same as the screen resolution.
[0077] The GPU then iterates over all the geometries that need to be rendered to the screen. For each geometry, its vertex data is processed by a vertex shader, converting 3D world coordinates into 2D screen coordinates. Then, during the rasterization phase, the GPU determines which pixels are covered by these geometries. For each covered pixel, the fragment shader is invoked. The fragment shader is the heart of G-buffer generation. It doesn't calculate the final color, but instead calculates and outputs various surface attributes for that pixel based on the geometry information corresponding to the pixel. For example, it calculates the pixel's exact 3D position in world space and writes it to a texture storing the position in the G-buffer. It calculates the normal vector for the surface at the pixel and encodes it into a texture storing the normal. 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 includes other attributes, such as roughness or metallic, this information is also calculated and written to other textures in the G-buffer. Sometimes, to save memory, these attributes are packed into different channels of the same texture. For example, a pixel on the screen corresponds to the surface of a red sphere. During the G-buffer generation process, the position texture stores the world coordinates of that point on the sphere's surface (e.g., X=10.5, Y=5.2, Z=3.1). The normal texture stores the surface normal vector for that point (e.g., X=0.7, Y=0.3, Z=0.6). The base color texture stores the color of red (e.g., R=1.0, G=0.0, B=0.0). In this way, the G-buffer gathers all the necessary lighting calculation information for every visible pixel on the screen during a single geometry rendering pass.
[0078] In step S7, virtual schlieren are optimized based on the movable light source, and deferred lighting calculation is performed on each pixel in the scene G-buffer to obtain the direct light contribution to be shadowed. Accordingly, in order to efficiently apply the shadow effect to the final rendered scene in the subsequent stage, 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] A possible specific implementation process of step S7: The rendering pipeline first sets up the GPU so that it can read multiple textures in the scene G buffer generated in step S6. These textures contain information such as the world space position, surface normal, and base color (albedo) corresponding to each pixel on the screen. At the same time, the rendering pipeline obtains the properties of the movable light source currently being processed, including its position, color, intensity, and light source type in world space. In order to perform deferred lighting calculations, the rendering pipeline draws a two-dimensional quadrilateral covering the entire screen. Each pixel of this quadrilateral will trigger the execution of a fragment shader, thereby realizing 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 the pixel from the scene G buffer. For example, it obtains the exact position (P) of the pixel in 3D world space, the normal vector of the surface at that position, and the base color of the surface from the G buffer. This data is pre-calculated and stored by the geometry channel. The shader then 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 the light source, without considering any shadow occlusion for the time being.
[0081] Lighting calculations follow the physical lighting model: First, the direction vector from the pixel (P) to the light source's position and the distance from the pixel to the light source are calculated. Then, a light attenuation factor is calculated based on the light source type and distance. For example, for point lights, inverse squared attenuation is used, meaning the light intensity decreases with the square of the distance. Next, the diffuse component of the lighting is calculated. This is calculated by taking the dot product of the pixel's surface normal and the light direction, representing the effect of the angle between the light and the surface on brightness. This is then multiplied by the pixel's base color, the light source's color, the light intensity, and the attenuation factor. If supported by the material, a specular component is also calculated, taking into account the viewing direction and the direction of the light reflection to simulate highlights. These calculations take into account 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 direct light contribution of red, with brightness depending on the light source's intensity, distance, and the angle between the light source and the wall normal.
[0082] Finally, the fragment shader writes the calculated, unshadowed direct light contribution, a color value, such as a floating-point number with three RGB channels, to a new render target texture. This new render target texture is the direct light contribution to be shadowed, which contains the lighting information for each pixel on the screen under ideal, unobstructed conditions.
[0083] In step S8, the lighting contributions are accumulated based on the direct light contribution to be shadowed, the Lumen global illumination and screen-space reflection data, and the post-processing parameters defined by the game to obtain the final rendered frame. The background art clearly points out that traditional rendering methods are difficult to strike a balance between performance and visual quality, especially when dealing with complex lighting phenomena. A realistic game scene not only includes direct lighting from the light source, but also indirect lighting (global illumination) formed by multiple reflections and scattering of light in the scene, as well as the reflection of the surrounding environment by the surface of the object. Therefore, the present application accurately accumulates and synthesizes all these complex lighting contributions, the global illumination provided by the Lumen system, and the screen-space reflection data. On this basis, various post-processing effects defined by the game, such as tone mapping, anti-aliasing, bloom, etc., need to be applied to further enhance the artistic expression and visual quality of the image. This comprehensive accumulation and post-processing stage is the last step in achieving high-quality and efficient real-time rendering. It integrates all separately calculated lighting and visual elements to ultimately generate a rendered frame that meets the expected visual effects, thereby completely solving the problem of balancing performance and quality mentioned in the background art.
[0084] A possible specific implementation of step S8: The rendering pipeline first sets up the GPU to enable it to read the direct light contribution to be shadowed, as well as the global illumination data provided by the Lumen system (in the form of textures or volume textures), and the reflection data generated by the screen space reflection (SSR) system (also a texture). At the same time, the rendering pipeline binds a final rendering target, which is the back buffer of the frame buffer or an intermediate texture for subsequent post-processing chains.
[0085] Next, the rendering pipeline draws a 2D quad that covers the entire screen, triggering a fragment shader to execute at each pixel on the screen. In this shader, for each pixel, the value of the direct light contribution to be shadowed is first read. At this point, shadows need 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, transforms it to the shadow space of the current movable light, uses the light's view projection matrix, and then samples the movable light's optimized virtual schlieren generated in step S5. By comparing the sampled depth information with the pixel's own depth, or by using the variance information of the virtual schlieren to perform smooth shadow calculations, a shadow factor is calculated, ranging from 0 to 1, with 0 indicating full shadow and 1 indicating full illumination. The read direct light contribution to be shadowed is then multiplied by this shadow factor to obtain the final shadowed direct light contribution for the pixel.
[0086] On this basis, the shader will sample the indirect lighting contribution corresponding to the pixel from the Lumen global illumination data. The Lumen system uses technologies such as software ray tracing to pre-calculate or update the light bounce effect in the scene in real time, providing indirect lighting for diffuse and specular reflections. At the same time, the shader will also sample the reflected light contribution of the pixel from the screen space reflection data. Screen space reflection technology uses the depth and normal information in the G buffer to simulate the reflection of visible objects in screen space. The shadowed direct light contribution, Lumen global illumination contribution, and screen space reflection contribution are accumulated to obtain the comprehensive lighting result of the pixel.
[0087] Finally, this comprehensive lighting result is fed into a series of game-defined post-processing passes. These post-processing effects are implemented in a chained structure, with each effect representing a full-screen rendering pass. For example, tone mapping is first applied to map high-dynamic-range lighting values to the display's low dynamic range, while also adjusting exposure and contrast, parameters predetermined by the game designer. A bloom effect might then be applied to simulate light spillover in overly bright areas. Color grading is then performed, adjusting the overall color style of the image using lookup tables or direct color transformations. Finally, anti-aliasing techniques such as temporal anti-aliasing or fast approximate anti-aliasing are applied to smooth out jagged edges. These post-processing parameters, such as exposure, bloom threshold, and color lookup tables, are set during game development based on artistic style and performance requirements. After all these post-processing effects are applied, the final image data is written to the frame buffer, resulting in the final rendered frame, which is then presented to 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 the present application, is described. This method addresses performance bottlenecks caused by processing large amounts 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 the camera frustum and AI context data, a shadow importance score is assigned to each mesh in the scene, prioritizing potential shadow casters. Subsequently, 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. In other words, the system no longer renders all shadows indiscriminately, but prioritizes those with the greatest visual impact and dynamically adjusts rendering details based on real-time performance. Finally, these optimized batches of shadows to be rendered are fed into the ray perspective rendering and VSM page filling processes to generate virtual schlieren optimized for movable light sources. This significantly reduces unnecessary computational overhead, significantly improving rendering efficiency and frame rate stability while ensuring high-quality dynamic lighting and shadow effects, effectively resolving the core issue of the prior art in balancing performance and quality.
[0089] While various embodiments of the present disclosure have been described above, the above descriptions are illustrative, non-exhaustive, and not intended to be limiting of 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 selected to best explain the principles of the embodiments, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A real-time dynamic light and shadow rendering optimization method based on Unreal Engine, characterized in that: include: Get the rendered scene graph, camera frustum, and AI context data. The rendered scene graph contains transformation information, material information, and LOD information for all mesh objects in the game world. Assigning a shadow importance score to each mesh object based on the camera frustum and the AI context data to obtain a ranked shadow caster list; Based on the properties of the movable light source, the current frame rate, and the current GPU load, perform light source-object association and performance budget evaluation on the sorted shadow casting object list to obtain a projector list corresponding to the movable light source; Performing intelligent shadow caster 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; Performing light perspective rendering and VSM page filling on the batch of shadows to be rendered for the movable light source to obtain optimized virtual schlieren for the movable light source; Get the scene G buffer of the current screen; Based on the movable light source, the virtual schlieren are optimized, and a delayed lighting calculation is performed on each pixel in the scene G buffer to obtain a direct light contribution to be shadowed; The final rendered frame is obtained by accumulating the lighting contribution based on the direct light contribution to be shadowed, Lumen global illumination and screen space reflection data, and the post-processing parameters defined by the game.
2. The real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to claim 1, characterized in that: Based on the camera frustum and the AI context data, each mesh object is assigned a shadow importance score to obtain a ranked list of shadow casters, including: assigning a base shadow importance score to each mesh object based on a mesh type of each mesh object; Based on the camera frustum and the AI context data, a base shadow importance score assigned to each mesh object is adjusted by a real-time factor to obtain the sorted shadow caster list.
3. The real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to claim 2, characterized in that: Based on the camera frustum and the AI context data, a base shadow importance score assigned to each mesh object is adjusted in real time to obtain the sorted shadow casting object list, comprising: Performing a smooth step function attenuation on the base shadow importance score based on the distance between each mesh object and the camera; Based on the pixel area occupied by each mesh object on the screen, linearly interpolate and clamp the base shadow importance score; Determining whether each mesh object is within the camera frustum to obtain a visibility state determination result, and performing a multiplier adjustment based on a first multiplier factor on the basic shadow importance score based on the visibility state determination result; Based on the content hint 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 light and shadow rendering optimization method based on Unreal Engine according to claim 3, characterized in that: The setting of the first multiplication factor and the second multiplication factor includes: Extracting a first multiplier initial factor, a first multiplier factor theoretical upper limit, a second multiplier initial factor, and a second multiplier factor theoretical upper limit; Subtracting one from each of the first multiplier initial factor and the second multiplier initial factor to obtain a first multiplier factor static probability value and a second multiplier factor static probability value; Calculating, based on the theoretical upper limit of the first multiplier factor and the theoretical upper limit of the second multiplier factor, a correlation normalized reference coefficient between the static probability value of the first multiplier factor and the static probability value of the second multiplier factor; Based on the correlation normalization reference coefficient and using a clamping function, performing multiplier dynamic interval correlation on the first multiplier factor static probability value and the second multiplier factor static probability value respectively to obtain an optimized first multiplier factor static probability value and an optimized second multiplier factor static probability value; The optimized first multiplication factor static probability value and the optimized second multiplication factor static probability value are respectively added by one to obtain the first multiplication factor and the second multiplication factor.
5. The real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to claim 1, characterized in that: The properties of the movable light source include position, influence radius and light source type.
6. The real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to claim 5, characterized in that: Based on the properties of the movable light source, the current frame rate, and the current GPU load, the light source-object association and performance budget evaluation is performed on the sorted shadow casting object list to obtain a list of projectors corresponding to the movable light source, including: For each mesh object in the sorted shadow caster list, based on the transformation information of the mesh object and the influence radius of the movable light source, culling the mesh object that is not within the influence range of the movable light source; The shadow caster threshold and LOD selection aggressiveness allowed for the movable light are dynamically calculated based on the current frame rate and the current GPU load.
7. The real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to claim 6, characterized in that: Perform intelligent shadow caster selection and LOD application on the caster list corresponding to the movable light source to obtain a batch of shadows to be rendered for the movable light source, including: Selecting mesh objects with shadow importance scores greater than the shadow caster threshold to participate in shadow casting; If the shadow importance score of the mesh object is extremely high, use the highest LOD to cast shadows on the mesh object; If the shadow importance score of the mesh object is medium, use the secondary LOD to cast shadows on the mesh object; If the shadow importance score of the mesh object is low, the lowest LOD is used to cast shadows on the mesh object.
8. The real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to claim 7, characterized in that: The highest LOD is LOD0, the secondary LOD is LOD1 or LOD2, and the lowest LOD is LOD3.
9. The real-time dynamic light and shadow rendering optimization method based on Unreal Engine according to claim 8, characterized in that: The batch of shadows to be rendered for the movable light source is rendered from a ray perspective and filled with a VSM page to obtain an optimized virtual schlieren for the movable light source, comprising: a GPU rendering depth information for 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 filling the VSM page to obtain the optimized virtual schlieren for the movable light source.
Citation Information
Patent Citations
Game scene rendering method and device, equipment and medium
CN117547816A
Virtual reality building roaming method and system based on scene rendering
CN119888041A
Real-time rendering method and device based on visual limitation, equipment and storage medium
CN119888055A
Method and system for improving shadowing in a graphics rendering system
US5870097A
Image rendering method and apparatus, electronic device, computer-readable storage medium, and computer program product
WO2023202254A1
Cited By
Three-dimensional scene optimization method and system for collaborative rendering of dynamic LOD and view cone elimination based on space-time prediction
CN120931472A