A pixel shadow rendering algorithm suitable for mobile games, a rendering device, an electronic device and a storage medium

By constructing pixel lighting partitions and partition rendering strategies that are jointly constrained by the current frame and the previous frame, a lighting prior map and a partition confidence map are generated. This solves the problem of unstable path assignment of pixel lighting partitions in mobile games under the risk of continuous frame lighting changes and local distortion, thereby improving rendering stability and resource allocation efficiency.

CN122391392APending Publication Date: 2026-07-14

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Filing Date
2026-04-17
Publication Date
2026-07-14

Smart Images

  • Figure CN122391392A_ABST
    Figure CN122391392A_ABST
Patent Text Reader

Abstract

The application discloses a pixel light and shadow rendering algorithm suitable for mobile phone games, a rendering device, electronic equipment and a storage medium, and particularly relates to the field of mobile terminal real-time rendering, and comprises the following steps: acquiring scene primitive data, light source data and terminal running data of a current frame of the mobile phone game, and writing the data into positions, normals, depths, albedos, metallicities, roughnesses and occlusion amounts according to pixels to generate a current frame lightweight geometry buffer; and performing convolution extraction and time sequence updating operation on the current frame lightweight geometry buffer, a last frame partition result, a last frame shadow result and a last frame time result after aligning the pixel positions. The current frame lightweight geometry buffer, the last frame partition result, the last frame shadow result and the last frame time result are combined to generate a light receiving prior graph, a partition credibility graph and a distortion risk graph, so that the pixel path attribution is simultaneously constrained by continuous frame changes and local risks, and the light and shadow jump caused by the inaccurate partition of the previous stage and the frame time jitter are relatively inhibited and synchronously appear.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of real-time rendering technology for mobile devices, and more specifically, to a pixel lighting and shadow rendering algorithm, rendering device, electronic device, and storage medium suitable for mobile games. Background Technology

[0002] In real-time rendering of mobile games, existing solutions typically revolve around balancing lighting and shadow performance, frame rate maintenance, and terminal adaptation. In practice, they often involve first building a lightweight geometry buffer, then classifying pixels based on the relationship between pixel normals and light source direction, neighborhood depth difference, and ambient occlusion results. Subsequently, diffuse reflection, specular highlights, and ambient light calculations are performed, and PCF filtering, slope offset correction, and material BRDF correction are applied to shadow areas. Finally, the resolution, sampling kernel, LOD, and post-processing configuration are combined with the device's settings. Taking a multiplayer team battle scene in an open-world mobile game as an example, the screen will simultaneously experience rapid camera turns, dense character movement, skill effect stacking, particle occlusion switching, screen resolution adjustment, and frequency decrease after the terminal temperature rises. At this time, not only is it required that the lighting and shadow results be continuous and stable, but also that the pixel computing budget within a single frame be kept within a limited range. Under this condition, the existing processing chain will continue to exhibit the following phenomenon: some pixels that are at the boundary of rapid lighting switching are still classified into the direct lighting calculation path in the current frame, while their continuous frame lighting trend and shadow residue have been transferred to the shadow candidate path. Other pixels that have entered a stable direct lighting state are still retained in the high-cost shadow processing set, which leads to the subsequent layered lighting, adaptive shadow, material correction, and device classification all being based on the inaccurate partitioning results, resulting in non-critical pixels occupying the computing budget, insufficient calculation of critical pixels, and simultaneous occurrence of local area lighting jumps and frame jitter. The technical problem this application aims to solve is: how to enable pixel lighting partitioning to combine continuous frame lighting changes and local distortion risks to form a stable and accurate path assignment result under the dynamic operation constraints of mobile games, and to constrain subsequent lighting, shadow, material and device-level processing accordingly, so as to avoid the entire rendering chain from becoming unstable in image quality and frame rate due to inaccurate previous partitioning. Summary of the Invention

[0003] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide a pixel lighting and shadow rendering algorithm, rendering device, electronic device, and storage medium suitable for mobile games. By constructing a pixel lighting partitioning and partition rendering strategy linkage processing flow that jointly constrains the current frame and the previous frame, the problems mentioned in the background art are solved.

[0004] To achieve the above objectives, the present invention provides the following technical solution: a pixel lighting and shadow rendering algorithm suitable for mobile games, comprising: S1. Obtain scene image data, light source data and terminal running data of the current frame of the mobile game, and write position, normal, depth, albedo, metallicity, roughness and occlusion by pixel to generate a lightweight geometry buffer for the current frame. S2. Align the current frame's lightweight geometric buffer with the previous frame's partitioning result, shadow result, and frame timing result by pixel position, and then perform convolution extraction and temporal update operations to generate the lighting prior map, partitioning confidence map, and distortion risk map corresponding to each pixel. S3. Based on the prior light map, the partition confidence map, the distortion risk map, and the light source angle, neighborhood depth difference, occlusion amount, and frustum marker corresponding to each pixel, perform frustum culling and pixel classification, divide the pixels within the frustum into direct light area, indirect light area, and shadow candidate area, and generate a pixel partition map. S4. Input the pixel partition map, partition confidence map, distortion risk map, terminal operation data and the action benefit of the previous frame into the strategy update calculation, determine the calculation precision, shadow sampling method, material correction method and culling range of each partition according to the updated strategy value, and generate the partition rendering strategy. S5. Based on the pixel partition map and partition rendering strategy, perform diffuse reflection calculation and specular reflection calculation for the direct light area, perform ambient light calculation for the indirect light area, perform adaptive radius PCF filtering and slope bias correction for the shadow candidate area, and perform lightweight GGX micro-surface BRDF correction and hierarchical synthesis output for each partition to generate the pixel color of the current frame and the partition results, shadow results, frame time results and motion gains for the next frame.

[0005] In a preferred embodiment, S1 includes: S1-1. Perform screen projection of the current frame based on scene primitive data, map each scene primitive to the corresponding pixel position, and read the primitive position, primitive normal, material albedo, metallicity and roughness of each mapped pixel to generate a pixel attribute set. S1-2. Based on the pixel attribute set and light source data, perform depth sorting on multiple primitives corresponding to the same pixel position, retain the position, normal, depth, albedo, metallicity and roughness of the first primitive in the sorting, and calculate the occlusion amount according to the occlusion path length and occlusion direction overlap of the remaining primitives at the pixel position to the first primitive, and generate a pixel write set. S1-3. Based on the terminal operation data, perform component compression and sequential encoding on the position, normal, depth, albedo, metallicity, roughness and occlusion amount of the pixel writing set, and write them to the buffer according to the pixel position to generate the current frame lightweight geometry buffer.

[0006] In a preferred embodiment, S2 includes: S2-1. Read the screen coordinates, normals, depth, albedo, metallicity, roughness, and occlusion of each pixel in the current frame's lightweight geometry buffer. Read the previous frame's partition value and shadow value at the same screen coordinates from the previous frame's partitioning and shadow results. If there is no value at the same screen coordinates, read the first value in the adjacent pixels in the order of top, bottom, left, and right as the padding value. At the same time, copy the previous frame's time result to each pixel to generate an aligned pixel set. S2-2. Taking each pixel in the aligned pixel set as the center, read the neighboring pixels within the three rows and three columns of the pixel's neighborhood, and assign convolution weights to each neighboring pixel with the center position as 4, the top, bottom, left, and right positions as 2, and the four corner positions as 1. Specifically, the sum of the products of the normals of each neighboring pixel and the corresponding components of the normal of the center pixel, plus one minus the occlusion amount of the neighboring pixel, is multiplied by the corresponding convolution weight of the neighboring pixel and accumulated to generate the cumulative illumination value of the current frame; the depth of each neighboring pixel is compared with the center image... The absolute values ​​of the differences in pixel depth, the absolute values ​​of the differences between the occlusion amounts of each neighboring pixel and the center pixel, and the absolute values ​​of the differences between the previous frame partition values ​​of each neighboring pixel and the center pixel are added together, multiplied by the convolution weights corresponding to the neighboring pixels, and accumulated to generate the current frame partition cumulative value; the absolute values ​​of the differences between the previous frame shadow values ​​of each neighboring pixel and the center pixel shadow values ​​are added to the previous frame time value, multiplied by the convolution weights corresponding to the neighboring pixels, and accumulated to generate the current frame distortion cumulative value; S2-3. For each pixel, subtract the shadow value of the previous frame corresponding to that pixel from the current frame's cumulative light value to generate a priori light value; sort the current frame's cumulative partition values ​​in the entire frame's pixel range from smallest to largest, and write the reverse order position corresponding to the sorting position as the partition confidence value; multiply the current frame's cumulative distortion value by the frame time value of the previous frame corresponding to that pixel to generate a distortion risk value; and write it into the priori light map, the partition confidence map, and the distortion risk map according to the screen coordinates.

[0007] In a preferred embodiment, S3 includes: S3-1. Read the corresponding prior light value, confidence value and distortion risk value for each pixel in the prior light map, the confidence value of the partition and the distortion risk map. Read the light source angle, neighborhood depth difference, occlusion amount and frustum mark corresponding to the pixel. When the frustum mark is outside the frustum, write the pixel as a culled pixel and generate the pixel set inside the frustum. S3-2. For each pixel in the pixel set within the view frustum, multiply the prior value of the received light by the cosine of the angle corresponding to the angle between the light source and the pixel to generate a direct light determination value; multiply the partition confidence value by the occlusion amount and then subtract the neighborhood depth difference to generate an indirect determination value; multiply the distortion risk value by the neighborhood depth difference and then add the occlusion amount to generate a shadow determination value. S3-3. For each pixel, compare the direct light determination value, indirect light determination value, and shadow determination value. When the shadow determination value is greater than the direct light determination value and greater than the indirect light determination value, write the pixel into the shadow candidate area. When the direct light determination value is greater than the indirect light determination value and greater than the shadow determination value, write the pixel into the direct light area. Write the remaining pixels into the indirect light area and output the pixel partition map according to the pixel position.

[0008] In a preferred embodiment, S4 includes: S4-1. Count the number of pixels and the number of boundary pixels in each partition according to the pixel partition map. Accumulate the partition confidence value of all pixels in each partition according to the partition confidence map and divide it by the number of pixels in that partition to generate the partition confidence value. Accumulate the distortion risk value of all pixels in each partition according to the distortion risk map and divide it by the number of pixels in that partition to generate the partition risk value. Multiply the partition risk value by the number of boundary pixels and divide it by the partition confidence value to generate the partition ranking value. For each partition, a first action, a second action, and a third action are generated sequentially. The first action is full-resolution calculation, nine-point shadow sampling, three material corrections, and zero-circle culling. The second action is half-resolution calculation, five-point shadow sampling, two material corrections, and one-circle culling. The third action is quarter-resolution calculation, one-point shadow sampling, one material correction, and two-circle culling. At the same time, the first duration value, the second duration value, and the third duration value are generated by multiplying the number of pixels in the corresponding partition by the sum of the resolution coefficient, the number of shadow sampling points, and the number of material corrections for the corresponding action. The resolution coefficient is determined by the ratio of the computational resolution corresponding to the action to the original resolution. The resolution coefficient for a full-resolution action is one, the resolution coefficient for a half-resolution action is one-half, and the resolution coefficient for a quarter-resolution action is one-quarter. The number of shadow sampling points is determined according to the number of sampling positions that participate in depth comparison during the shadow sampling process. Nine shadow sampling points correspond to nine shadow sampling points, five shadow sampling points correspond to five shadow sampling points, and one shadow sampling point corresponds to one shadow sampling point. The number of material correction items is determined according to the number of material correction calculation items retained in the action. Retaining three material corrections corresponds to three material correction items, retaining two material corrections corresponds to two material correction items, and retaining one material correction corresponds to one material correction item.

[0009] In a preferred embodiment, S4 further includes: S4-2. Based on the action gains of the previous frame, read the historical gains of the same action for the first, second, and third actions of each partition, add the historical gains of the same action to the partition sorting value, and then divide them by the first, second, and third duration values ​​respectively to generate the first, second, and third gain values. Sort the partitions in descending order of their partition sorting values, and select the action with the highest gain value for each partition as the current action according to the sorting results. When the accumulated duration value corresponding to the current action is greater than the available duration of the current frame, replace the current action of the partition with the action with the second highest gain value and re-accumulate it to generate the partition action set. The action revenue is calculated by adding the historical revenue of the corresponding action in the same partition to the partition ranking value, and then dividing by the duration value of the corresponding action. S4-3. Based on the partition action set and the relationship between adjacent partitions, read the current actions of adjacent partitions one by one. When there are differences in the calculation precision, shadow sampling method or culling range of adjacent partitions, compare the partition ranking values ​​corresponding to the two adjacent partitions. When the partition ranking value of one partition is greater than the partition ranking value of the other partition, retain the current action corresponding to the partition whose partition ranking value satisfies the greater than relationship, and replace the current action corresponding to the other partition with the action ranked next in the benefit value, until the calculation precision, shadow sampling method and culling range of all adjacent partitions are consistent. Then, write the calculation precision, shadow sampling method, material correction method and culling range of the final retained actions of each partition into the partition rendering strategy.

[0010] In a preferred embodiment, S5 includes: S5-1. Based on the pixel partition map and partition rendering strategy, for pixels in the direct light area, read the albedo, normal, light source direction, viewing direction, and light source color. Multiply the albedo by the light source color and then multiply by the cosine of the angle between the normal and the light source direction to generate the diffuse reflection value. Perform a power operation on the cosine of the angle between the viewing direction and the half-angle direction according to the specular exponent corresponding to the partition rendering strategy and then multiply by the light source color to generate the specular value. For pixels in the indirect light area, read the occlusion amount and the average albedo in the three-row, three-column neighborhood. Multiply the ambient light color by one and subtract the occlusion amount, then multiply by the average albedo to generate the ambient light value. S5-2. Based on the pixel partition map and partition rendering strategy, read the center depth and the three-row, three-column neighborhood depth of the pixels in the shadow candidate area. Calculate the sum of the absolute values ​​of the differences between the center depth and each neighborhood depth. Sort the sum of the absolute values ​​of the differences of all pixels in the shadow candidate area from largest to smallest. Select nine sampling points when the sorting position is in the first third, five sampling points when the sorting position is in the middle third, and three sampling points when the sorting position is in the last third. Multiply the result of subtracting the cosine of the angle between the normal and the light source direction by the sampling radius to generate the slope offset value. Compare the depth of each sampling point with the center depth plus the slope offset value point by point. Divide the number of sampling points that satisfy the less than relationship by the total number of sampling points to generate the shadow occlusion value. S5-3. According to the partitioned rendering strategy, read the metallicity and roughness of pixels in the direct light area, indirect light area, and shadow candidate area respectively. Write the square of the roughness as the distribution value. Write the product of the cosine of the angle between the normal and the viewing direction and the cosine of the angle between the normal and the light source direction as the occlusion value. Add the five-fold product of the metallicity and the cosine of the angle between the viewing direction and the half-angle direction as the reflection value. Then multiply the distribution value, occlusion value, and reflection value with the diffuse value, specular value, ambient light value, and shadow occlusion value according to the partition correspondence to generate the pixel color of the current frame. Write the pixel color of the current frame according to the pixel position to the frame buffer. Write the pixel partition of the current frame as the partition result. Write the shadow occlusion value corresponding to the shadow candidate area pixel as the shadow result. Write the difference between the start time and the end time of the current frame as the frame time result. Write the sum of the absolute values ​​of the differences between all pixel colors of the current frame and the pixel colors of the same position in the previous frame divided by the frame time result as the action gain.

[0011] A pixel-based lighting and shadow rendering device suitable for mobile games, comprising: The buffer building module is used to obtain scene image data, light source data and terminal running data of the current frame of the mobile game, and write position, normal, depth, albedo, metallicity, roughness and occlusion by pixel to generate a lightweight geometry buffer for the current frame. The prior generation module is used to align the current frame's lightweight geometric buffer with the previous frame's partitioning result, shadow result, and time result by pixel position, and then perform convolution extraction and temporal update operations to generate the lighting prior map, partitioning confidence map, and distortion risk map corresponding to each pixel. The partitioning determination module, based on the prior light map, partitioning confidence map, distortion risk map, and the light source angle, neighborhood depth difference, occlusion amount, and frustum marker corresponding to each pixel, performs frustum culling and pixel classification, dividing the pixels within the frustum into direct light area, indirect light area, and shadow candidate area, and generating a pixel partitioning map. The strategy update module is used to input the pixel partition map, partition confidence map, distortion risk map, terminal running data and the action benefit of the previous frame into the strategy update calculation, and determine the calculation precision, shadow sampling method, material correction method and culling range for each partition according to the updated strategy value, and generate the partition rendering strategy. The rendering output module performs diffuse reflection and specular reflection calculations on the direct light area, ambient light calculations on the indirect light area, adaptive radius PCF filtering and slope offset correction on the shadow candidate area, and lightweight GGX micro-surface BRDF correction and hierarchical compositing output on each partition, generating the pixel color of the current frame as well as the partition results, shadow results, frame time results and motion gains for the next frame.

[0012] An electronic device, comprising: The processor, and the memory connected to the processor; Memory is used to store computer programs; The processor is used to call and execute computer programs in memory to perform the algorithm.

[0013] A storage medium includes: a computer program stored in the storage medium, which, when executed by a processor, implements the various steps of the algorithm.

[0014] The technical effects and advantages of this invention are as follows: 1. By jointly generating a priori light map, a partition confidence map, and a distortion risk map by using the current frame's lightweight geometric buffer and the previous frame's partitioning results, shadow results, and frame time results, the pixel path attribution can be constrained by both continuous frame changes and local risks, thereby relatively suppressing the simultaneous occurrence of light and shadow jumps and frame time jitter caused by the inaccuracy of the previous partitioning. 2. By performing alignment, padding, and neighborhood convolution summation on the current frame field and the previous frame field according to pixel position, and generating partition confidence value with the full frame sorting result, local depth changes, occlusion changes, and partition changes can be written into the same calculation chain, thereby relatively improving the classification stability of fast light-receiving switching boundaries. 3. By statistically analyzing the confidence value, risk value, and number of boundary pixels of the pixel partition map, and updating the partition strategy in conjunction with the action reward, a partition-level resource allocation process with reinforcement learning characteristics is formed, thereby concentrating the computing budget on risk partitions and reducing the computing power consumption of non-critical pixels. 4. By introducing neighborhood convolution extraction and inter-frame state readback in the prior generation stage of light exposure, a light exposure risk extraction process with deep learning local representation features is formed. This process can incorporate instantaneous light exposure relationship and historical shadow residue into the partitioning criteria, thereby relatively improving the continuity of shadow candidate area identification. 5. By performing lighting calculations, shadow occlusion calculations, and lightweight GGX micro-surface BRDF corrections on the direct light area, indirect light area, and shadow candidate area respectively, and completing hierarchical compositing output according to the partition rendering strategy, lighting, shadows, materials, and terminal adaptation can be linked along the same path, thereby relatively improving the stability of real-time rendering on mobile devices. Attached Figure Description

[0015] Figure 1 This is a flowchart of the method steps of the present invention.

[0016] Figure 2 This is a schematic diagram of the device module of the present invention. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Refer to the instruction manual appendix Figure 1-2 The present invention provides a pixel lighting and shadow rendering algorithm suitable for mobile games, comprising: S1. Obtain scene image data, light source data and terminal running data of the current frame of the mobile game, and write position, normal, depth, albedo, metallicity, roughness and occlusion by pixel to generate a lightweight geometry buffer for the current frame. In this embodiment, step S1 is used to organize the primitive information, lighting information, and terminal status in the current frame scene into buffered data that can be directly read pixel by pixel, so that step S2 can directly read the position, normal, depth, albedo, metallicity, roughness, and occlusion amount, and on this basis, continue to generate a priori lighting map, a partition confidence map, and a distortion risk map; the processing order of step S1 is as follows: first, in step S1-1, the scene primitives are projected onto the current frame screen coordinate plane and the pixel positions covered by the primitives are determined; then, in step S1-2, the previous layer primitives are filtered out from multiple primitives corresponding to the same pixel position and the occlusion amount of the subsequent layer primitives on the previous layer primitives is calculated; then, in step S1-3, the written fields are quantized and encoded in combination with the terminal running data and written to the buffer; this implementation process includes the following steps: In step S1-1, screen projection of the current frame is performed based on scene metadata. This converts primitive-level data into pixel-level attribute input, providing primitive attributes corresponding to pixel positions for depth sorting in step S1-2 and buffer writing in step S1-3. Specifically, the primitive vertex coordinates, primitive normals, material albedo, metallicity, and roughness in the scene metadata are read first. Then, the current frame camera position, camera orientation, projection viewpoint, and screen resolution are read. The observation coordinate transformation and projection coordinate transformation are performed sequentially on the primitive vertex coordinates to obtain the projected contour of each primitive on the current frame screen coordinate plane. Then, using whether the pixel center point falls inside the projection outline as the coverage judgment rule, the set of covered pixels corresponding to each primitive is determined, and the position, normal, material albedo, metallicity and roughness of the corresponding primitive are read one by one according to the pixel position. The reading results are written into the pixel attribute table according to the pixel position and primitive number to generate the set of pixel attributes to be read in step S1-2. When the primitive projection area is less than one pixel, the pixel where the projection center is located is written as the covered pixel. When the primitive vertex coordinates are missing, the projection processing of the current primitive is stopped and the current primitive number is recorded as an invalid primitive, so that step S1-2 skips the current primitive. In step S1-2, a pixel write set is generated based on the pixel attribute set and light source data generated in step S1-1. This set determines the preceding primitive from multiple primitives corresponding to the same pixel location and writes the occlusion effect of the following primitive on the preceding primitive as the occlusion amount that can be directly written to the buffer in step S1-3. Specifically, all primitives corresponding to the same pixel location in the pixel attribute set generated in step S1-1 are first sorted according to their depth values ​​in the observation direction from smallest to largest. The primitive at the top of the sorted list is written as the preceding primitive, and its position, normal, depth, albedo, metallicity, and roughness are retained. Then, the occlusion path length and occlusion direction are calculated for each primitive at the same pixel location other than the preceding primitive. The occlusion path length is the depth difference obtained by subtracting the depth of the previous layer primitive from the current primitive depth. The occlusion direction coincidence is the value obtained by multiplying the three corresponding components of the current primitive normal and the previous layer primitive normal respectively and then adding them together. Then, the occlusion path length of each other primitive is multiplied by the occlusion direction coincidence and accumulated to obtain the occlusion amount of the current pixel position. Finally, the position, normal, depth, albedo, metallicity, roughness and occlusion amount of the previous layer primitive are written into the pixel write table to generate the pixel write set to be read in step S1-3. When there is only one primitive corresponding to the same pixel position, the occlusion amount is written as zero. When the depth values ​​of multiple primitives are the same, the primitive with the earlier primitive number is retained as the previous layer primitive. In steps S1-3, a lightweight geometry buffer for the current frame is generated based on the pixel write set generated in step S1-2 and the terminal running data. This buffer compresses the fields obtained in step S1-2 into a buffer format that can be directly read by the terminal in its current state, allowing it to be directly accessed in step S2. Specifically, the running resolution and buffer bit width configuration in the terminal running data are read first. Then, component quantization is performed on the position, normal, depth, albedo, metallicity, roughness, and occlusion amount in the pixel write set generated in step S1-2. Specifically, the position is quantized using three coordinate components, and the normal is quantized using three directional components. Quantization is performed separately for depth, albedo, metallicity, roughness, and occlusion. Then, sequential encoding is performed in a fixed order of position, normal, depth, albedo, metallicity, roughness, and occlusion, and the encoding results are written to the buffer address according to the pixel position to generate the lightweight geometry buffer of the current frame directly read in step S2. When the terminal running data does not provide a buffer bit width configuration, position and normal are quantized with high bit width, while depth, albedo, metallicity, roughness, and occlusion are quantized with low bit width. When there are missing fields in the pixel write set, the missing fields are written to zero and quantization and encoding are continued. Through the processing of steps S1-1 to S1-3, the pixel fields directly called in the subsequent step S2 have all been written in the current frame lightweight geometry buffer according to the pixel position. The previous layer primitive filtering results and occlusion amount have also been calculated and written to the corresponding pixel positions in step S1. When reading in step S2, there is no need to return to the primitive layer to repeat the calculation. In practical applications: In multiplayer battle scenarios, character primitives, skill effect primitives, and scene building primitives may be projected onto the same screen area simultaneously. First, in step S1-1, each primitive is projected onto the current frame screen coordinate plane and the set of covered pixels is determined. Then, in step S1-2, multiple primitives at the same pixel position are sorted by depth value from smallest to largest. The previous layer primitives are retained, and the sum of the products of the depth difference of the remaining primitives relative to the previous layer primitives and the corresponding normal components is accumulated as the occlusion amount. Subsequently, in step S1-3, according to the current running resolution of the terminal and the buffer bit width configuration, the position, normal, depth, albedo, metallicity, roughness, and occlusion amount are written into the buffer in a fixed order, which yields the current frame lightweight geometry buffer directly read in step S2.

[0019] S2. Align the current frame's lightweight geometric buffer with the previous frame's partitioning result, shadow result, and frame timing result by pixel position, and then perform convolution extraction and temporal update operations to generate the lighting prior map, partitioning confidence map, and distortion risk map corresponding to each pixel. In a preferred embodiment, step S2 aligns the current frame lightweight geometric buffer generated in step S1 with the previous frame's partitioning result, shadow result, and frame time result to the same screen coordinate system. Then, it generates a priori lighting map, a partitioning confidence map, and a distortion risk map through local convolution accumulation and inter-frame updates. This ensures that step S3, when classifying pixels, not only relies on the instantaneous lighting state of the current frame but also utilizes the partitioning changes, shadow changes, and frame time burden information from the previous frame. The purpose of introducing deep learning and reinforcement learning here is not to replace the convolution extraction and temporal updates in the current claims, but to provide a more stable prior foundation for subsequent steps: deep learning corresponds to the representation of local pixel relationships, and reinforcement learning corresponds to the utilization of feedback from previous and subsequent frames. In this embodiment, these two approaches are implemented as current frame neighborhood convolution extraction, previous frame result backreading, frame time copying, pixel-by-pixel accumulation, and full-frame sorting updates, without introducing additional model outputs. This allows step S2 to retain both an executable pixel-level computation chain and a temporal feedback foundation for subsequent policy updates. This implementation process includes the following steps: In step S2-1, the screen coordinates, normals, depth, albedo, metallicity, roughness, and occlusion of each pixel in the current frame's lightweight geometry buffer are read. The previous frame's partition value and shadow value at the same screen coordinates are also read from the previous frame's partitioning and shadow results. This process writes the current frame's pixel field and the previous frame's state field to the same pixel location, enabling step S2-2 to directly read the current frame's attributes and the previous frame's state simultaneously within a pixel-by-pixel neighborhood. Specifically, the screen coordinates in the current frame's lightweight geometry buffer are used as an index to search for the previous frame's partitioning and shadow values ​​at the same screen coordinates in the previous frame's partitioning and shadow results. If no value is found at the same screen coordinates, the values ​​are read in the order of top, bottom, left, and right. The first read value among adjacent pixels is taken as the padding value. This is done to avoid interrupting subsequent convolution calculations due to the absence of a single pixel during camera panning, character displacement, or edge cropping. When there are no read values ​​above, below, left, and right, the previous frame partition value and the previous frame shadow value are written to zero to indicate that there is no inheritable previous frame state at the current pixel position. Then, the frame time result of the previous frame is copied as a frame-level scalar to the position extension field corresponding to all pixels in the current frame, so that each pixel carries the same frame time value of the previous frame when entering step S2-2. The purpose of this process is to map the frame-level duration burden to a pixel-level callable field, which facilitates the joint accumulation of local distortion and frame time pressure in the future. Finally, the aligned pixel set for further reading in step S2-2 is generated. In step S2-2, three rows and three columns of neighboring pixels are read centered on each pixel in the aligned pixel set, and the current frame's cumulative illumination value, current frame's cumulative partition value, and current frame's cumulative distortion value are generated respectively. This serves to merge the local geometric relationships, occlusion relationships, and state changes of the previous frame into three types of cumulative values ​​that can be directly updated in step S2-3. Specifically, nine pixels within the three rows and three columns of the neighborhood are read centered on the location of the center pixel, and convolutional weights are assigned as follows: center position 4, top position 2, bottom position 2, left position 2, right position 2, top left corner position 1, top right corner position 1, bottom left corner position 1, and bottom right corner position 1. The reason for using this set of convolutional weights is... The center position and the cross-shaped neighborhood have a more direct relationship in screen space, while the four corner pixels play a more significant role in edge supplementation. Therefore, the center position has a higher weight than the four corner positions. Subsequently, three types of cumulative calculations are performed on each neighboring pixel: In the cumulative illumination calculation, the three corresponding components of the normal of the neighboring pixel and the normal of the center pixel are multiplied and then added together to obtain the sum of normal products. Then, the result obtained by subtracting the occlusion amount of the neighboring pixel is multiplied by the sum of normal products and multiplied by the convolution weight corresponding to the current neighboring pixel. The results of all nine neighboring pixels are accumulated to generate the cumulative illumination value of the current frame. The significance of this processing is that it considers both the proximity of the normal direction and the degree of occlusion reduction at the same time, avoiding the mistaken identification of occluded pixels as strongly illuminated pixels based solely on the normal relationship. In the partition cumulative calculation, the absolute values ​​of the differences between the depths of neighboring pixels and the center pixel, the absolute values ​​of the differences between the occlusion amounts of neighboring pixels and the center pixel, and the absolute values ​​of the differences between the partition values ​​of neighboring pixels and the center pixel in the previous frame are first calculated. Then, these three absolute values ​​are added together and multiplied by the convolution weights corresponding to the current neighboring pixels. The results from all nine neighboring pixels are then accumulated to generate the current frame's partition cumulative value. This process merges the local structural changes in the current frame with the partition state changes in the previous frame into the same cumulative value, which is used to generate the partition confidence value later. In the distortion cumulative calculation, the absolute values ​​of the differences between the shadow values ​​of neighboring pixels and the center pixel in the previous frame are first calculated. The absolute value of the difference between the frame shadow values ​​is then added to the frame time value of the previous frame copied to the current pixel position, and multiplied by the convolution weight corresponding to the current neighboring pixels. The results of all nine neighboring pixels are accumulated to generate the cumulative distortion value of the current frame. Here, the frame time value of the previous frame is directly included in the accumulation to write the overall rendering pressure of the previous frame into the distortion accumulation process of the current pixel, thereby providing a benefit background for the reinforcement learning strategy update in the subsequent step S4. If the neighboring pixels are located outside the screen boundary, the field corresponding to the center pixel is used to replace the missing field outside the boundary to continue to complete the accumulation calculation, avoiding the accumulation interruption at the boundary position due to incomplete neighborhood. In step S2-3, the current frame cumulative illumination value, current frame partition cumulative value, and current frame cumulative distortion value generated in step S2-2 are updated pixel-by-pixel and sorted across the entire frame. This process converts the three cumulative values ​​into the illumination prior map, partition confidence map, and distortion risk map directly read in step S3. Specifically, for each pixel, the current frame cumulative illumination value is subtracted from the previous frame shadow value to generate an illumination prior value, which is then written into the illumination prior map according to screen coordinates. This process uses the local illumination accumulation result of the current frame to offset the shadow residue from the previous frame, ensuring that subsequent pixel classification uses not just illumination intensity, but an illumination prior value that has already eliminated the influence of historical shadows. Then, the current frame partition cumulative values ​​of all pixels are sorted across the entire frame according to their numerical values. Sort the pixels from smallest to largest. When the total number of pixels in the whole frame is N, write the pixel with the sort position 1 as the reverse order position N, and write the pixel with the sort position N as the reverse order position 1. Thus, write the reverse order position corresponding to each pixel as the partition confidence value, and write it into the partition confidence map according to the screen coordinates. The reverse order position is used here instead of directly retaining the cumulative value. The purpose is to compress the cumulative values ​​in different scenes into the same comparable order, so that it can be directly used in steps S3 and S4. When the current frame partition cumulative values ​​of multiple pixels are the same, the order of sorting is determined according to the screen coordinates first horizontally and then vertically to eliminate sorting conflicts. Then, for each pixel, multiply the current frame distortion cumulative value with the frame time value corresponding to the current pixel in the previous frame to generate a distortion risk value, and write it into the distortion risk map according to the screen coordinates. The purpose of this processing is to link the intensity of local shadow changes with the overall frame time burden of the previous frame, so that when determining the shadow candidate area in step S3, the pixel position that has both local distortion changes and is under high frame time pressure background can be identified first. After the processing of steps S2-3, the prior light value, partition confidence value and distortion risk value required by step S3 have been written into the corresponding graph according to the screen coordinates, and the action benefit update used in step S4 also has a pixel-by-pixel risk source. Through steps S2-1 to S2-3, the prior lighting map, partition confidence map, and distortion risk map directly read in step S3 have been generated. The current frame normal relationship, depth change, occlusion change, and the partitioning result, shadow result, and frame time result of the previous frame have also been aligned, padded, convolved in the neighborhood, and updated pixel-by-pixel in step S2. Therefore, step S3 does not need to return to the current frame's lightweight geometric buffer and the previous frame's result to repeatedly retrieve values. Simultaneously, the inter-frame feedback chain formed in step S2 provides the input basis for the reinforcement learning strategy update in step S4, and the neighborhood convolution accumulation process in step S2 corresponds to the computational approach of local feature extraction in deep learning processing. In practical applications: when mobile game screens... When a character quickly turns around, switches skill shadows, and experiences fluctuations in terminal frame time, in step S2-1, the current frame pixels are aligned with the previous frame partition results and the previous frame shadow results according to screen coordinates, and missing positions are filled in the order of top, bottom, left, and right. In step S2-2, the cumulative light value, partition cumulative value, and distortion cumulative value are calculated for the three rows and three columns of each pixel's neighborhood. Finally, in step S2-3, the cumulative light value minus the previous frame shadow value is written as the light prior value, the reverse order of the partition cumulative value across the entire frame is written as the partition confidence value, and the product of the distortion cumulative value and the previous frame time value is written as the distortion risk value. This provides step S3 with three types of input images that can simultaneously reflect the local structural changes of the current frame and the feedback state of the previous frame.

[0020] S3. Based on the prior light map, the partition confidence map, the distortion risk map, and the light source angle, neighborhood depth difference, occlusion amount, and frustum marker corresponding to each pixel, perform frustum culling and pixel classification, divide the pixels within the frustum into direct light area, indirect light area, and shadow candidate area, and generate a pixel partition map. In this embodiment, step S3 is used to perform frustum filtering and lighting classification on the pixels of the current frame based on the prior lighting map, partition confidence map, and distortion risk map generated in step S2, thereby fixing the rendering path required by the subsequent step S5 to the direct light area, indirect light area, and shadow candidate area in advance; the processing order of step S3 is as follows: first, in step S3-1, the prior lighting value, partition confidence value, distortion risk value, and current frame geometric relationship field corresponding to each pixel are read, and pixels outside the frustum are filtered out; then, in step S3-2, the direct light determination value, indirect light determination value, and shadow determination value are calculated for the pixels within the frustum respectively; then, in step S3-3, the three determination values ​​are compared and written into the pixel partition map according to the comparison result; this implementation process includes the following steps: In step S3-1, the corresponding lighting prior value, partition confidence value, and distortion risk value are read for each pixel in the lighting prior map, partition confidence map, and distortion risk map. The light source angle, neighborhood depth difference, occlusion amount, and view frustum marker of the corresponding pixel are also read. This serves to filter out pixels outside the view frustum in the current frame that do not participate in subsequent rendering classification, preventing subsequent judgment value calculations from falling on invalid pixels. Specifically, the three pixel values ​​at the same position in the lighting prior map, partition confidence map, and distortion risk map are first read according to screen coordinates. Then, the occlusion amount corresponding to the screen coordinates in the current frame's lightweight geometry buffer is read, along with the current frame's camera position, camera orientation, projection angle, and clipping distance. A view frustum inclusion judgment is performed on the current frame pixel position. If the current frame pixel position falls inside the view frustum, it is written as inside the view frustum; otherwise, it is written as outside the view frustum. When the view frustum is outside the view frustum, it is written as "outside the view frustum," thus obtaining the view frustum label. Then, the three corresponding components of the current frame pixel normal and the light source direction are multiplied and summed to obtain the result, which is used as the cosine value of the angle corresponding to the light source angle. The absolute values ​​of the differences between the depth of the center pixel and the depths of the other eight neighboring pixels in the three-row, three-column neighborhood of the current frame pixel are read as the neighborhood depth difference. When the view frustum label is outside the view frustum, the current pixel is written as the culled pixel. When the view frustum label is inside the view frustum, the current pixel, along with the prior light value, partition confidence value, distortion risk value, the cosine value of the angle corresponding to the light source angle, the neighborhood depth difference, and the occlusion amount, are written into the pixel table inside the view frustum to generate the pixel set inside the view frustum to be read in step S3-2. When there is a missing position at the screen boundary in the three-row, three-column neighborhood, the depth of the center pixel is used to replace the depth of the missing position to continue calculating the neighborhood depth difference. In step S3-2, direct illumination decision value, indirect illumination decision value, and shadow decision value are calculated for each pixel in the pixel set within the frustum. This serves to classify illumination prior, occlusion relationship, local depth change, and distortion risk into three directly comparable decision quantities. Specifically, for each pixel within the frustum, the illumination prior value is first multiplied by the cosine of the angle corresponding to the light source angle to generate the direct illumination decision value. Then, for each pixel within the frustum, the partition confidence value is multiplied by the occlusion amount, and the neighborhood depth difference is subtracted to generate the indirect illumination decision value. Finally, for each pixel within the frustum, the distortion risk value is multiplied by the neighborhood depth difference, and the occlusion risk value is added. The occlusion is used to generate shadow determination values. The above three types of determination values ​​correspond to three different pixel states: the direct light determination value represents the degree to which the current pixel remains consistent with the light source direction after removing the shadow residue from the previous frame; the indirect light determination value represents the degree of occlusion accumulation of the current pixel when the local depth change is low; and the shadow determination value represents the degree of shadow participation of the current pixel under the superposition of local depth fluctuations and distortion risk. After processing in step S3-2, each pixel in the view frustum corresponds to a direct light determination value, an indirect light determination value, and a shadow determination value, and is written into the determination value table to be read in step S3-3. In step S3-3, the direct illumination determination value, indirect illumination determination value, and shadow determination value are compared for each pixel, and a pixel partition map is output. This serves to convert the three types of determination values ​​obtained in step S3-2 into partition results that are directly called in subsequent steps S4 and S5. Specifically, for each pixel within the view frustum, the direct illumination determination value, indirect illumination determination value, and shadow determination value are read. When the shadow determination value is greater than both the direct illumination determination value and the indirect illumination determination value, the current pixel is written into the shadow candidate region. Direct light area; in all other cases, the current pixel is written to the indirect light area. Specifically, when the shadow judgment value is equal to the direct light judgment value, the shadow judgment value is equal to the indirect light judgment value, the direct light judgment value is equal to the indirect light judgment value, or all three judgment values ​​are equal, the pixel is written to the indirect light area to eliminate classification conflicts when comparing the same pixel. Then, the partition corresponding to each pixel is written to the pixel partition map according to the screen coordinates. Pixels outside the view frustum are written as culled pixel markers, and pixels inside the view frustum are written as direct light area, indirect light area, or shadow candidate area, respectively, to generate the pixel partition map to be read in steps S4 and S5. Through the processing of steps S3-1 to S3-3, the current frame pixels have completed the frustum filtering and three types of lighting classification according to screen coordinates. Step S4 can directly count the number of pixels in each partition, the number of boundary pixels, and the relationship between adjacent partitions based on the pixel partition map. Step S5 can also directly call the rendering calculation paths corresponding to the direct light area, indirect light area, and shadow candidate area according to the pixel partition map. In practical applications: when the player controls the character to quickly turn and enter the edge of the building shadow, firstly, in step S3-1, the frustum inclusion judgment is performed on the current frame pixels and pixels outside the frustum are filtered out. Then, in step S3-2, the direct light judgment value, indirect light judgment value, and shadow judgment value are calculated respectively. Finally, in step S3-3, pixels whose shadow judgment value is greater than the other two judgment values ​​are written into the shadow candidate area, pixels whose direct light judgment value is greater than the other two judgment values ​​are written into the direct light area, and the remaining pixels are written into the indirect light area. Thus, the pixel partition map that can be directly called by steps S4 and S5 can be obtained.

[0021] S4. Input the pixel partition map, partition confidence map, distortion risk map, terminal operation data and the action benefit of the previous frame into the strategy update calculation, determine the calculation precision, shadow sampling method, material correction method and culling range of each partition according to the updated strategy value, and generate the partition rendering strategy. In this embodiment, step S4 is used to convert the pixel partition map, partition confidence map, and distortion risk map generated in step S3 into a partition rendering strategy that can directly constrain the rendering path in step S5. Its focus is not on re-dividing pixels, but on determining the computational precision, shadow sampling method, material correction method, and culling range for each partition in the current frame, based on the confidence level, risk level, boundary distribution, and available terminal time of each partition. The processing sequence of step S4 is as follows: first, in step S4-1, the basic partition quantities are statistically analyzed and partition sorting values ​​are formed. Simultaneously, a first action, a second action, and a third action, along with corresponding duration values, are generated for each partition. Then, in step S4-2, the current action is selected for each partition based on the action gains from the previous frame, forming a partition action set. Subsequently, in step S4-3, the action differences between adjacent partitions are eliminated based on the relationship between adjacent partitions and written into the partition rendering strategy. This implementation process includes the following steps: In step S4-1, a partition ranking value and a set of actions corresponding to each partition are generated based on the pixel partition map, partition confidence map, and distortion risk map. This process first converts the pixel-level distribution into a partition-level ranking result, and then fixes the subsequent selectable computation paths into a finite set of actions. Specifically, in the pixel partition map, the number of pixels is first counted according to the direct light area, indirect light area, and shadow candidate area. Then, for each partition, the four adjacent pixels above, below, left, and right are checked pixel by pixel. If at least one of the four adjacent pixels belongs to a different partition, the current pixel is recorded as a boundary pixel, and the number of boundary pixels is accumulated. Subsequently, in the partition confidence map, the partition confidence values ​​of all pixels in the current partition are accumulated and divided by the number of pixels in the current partition to generate a partition confidence value. In the distortion risk map, the distortion risk values ​​of all pixels in the current partition are accumulated and divided by the number of pixels in the current partition to generate a partition risk value. The partition risk value is then multiplied by the number of boundary pixels and divided by the partition confidence value to generate a partition ranking value. When the partition confidence value is zero, it is set to one, and the partition ranking value is calculated again. After calculating the partition sorting values, three actions are generated sequentially for each partition. The first action corresponds to full-resolution operation, nine-point shadow sampling, three material corrections, and zero-circle culling; the second action corresponds to half-resolution operation, five-point shadow sampling, two material corrections, and one-circle culling; and the third action corresponds to quarter-resolution operation, one-point shadow sampling, one material correction, and two-circle culling. The resolution coefficient is determined by the ratio of the operation resolution to the original resolution: full-resolution operation corresponds to one, half-resolution operation corresponds to one-half, and quarter-resolution operation corresponds to one-quarter. The number of shadow sampling points is determined by the number of sampling positions participating in depth comparison during shadow sampling: nine-point shadow sampling corresponds to nine, five-point shadow sampling corresponds to five, and one-point shadow sampling corresponds to one. The number of material corrections is determined by... The number of material correction calculation items retained in the action is determined. Three material corrections correspond to distribution value calculation, occlusion value calculation, and reflection value calculation; two material corrections correspond to distribution value calculation and reflection value calculation; and one material correction corresponds to reflection value calculation. Zero-circle culling means retaining all pixels in the current partition; one-circle culling means culling the boundary pixels of the current partition; and two-circle culling means culling the pixels in the same partition that are adjacent to the boundary pixels above, below, left, and right. Then, the first duration value, the second duration value, and the third duration value are generated by multiplying the number of pixels in the current partition by the sum of the resolution coefficient of the corresponding action, the number of shadow sampling points, and the number of material correction items. The partition sorting value, the first action, the second action, the third action, the first duration value, the second duration value, and the third duration value are written into the action table for step S4-2 to read. In step S4-2, a partition action set is generated based on the action revenue of the previous frame and the action table generated in step S4-1. The purpose is to first determine the revenue value for each partition and then select the current action under the constraint of the available duration of the current frame. Specifically, the available duration of the current frame is first read from the terminal running data. The available duration of the current frame is obtained by subtracting the duration occupied before the start of the current frame from the target frame period. Then, the historical revenue of the same action is read for the first, second, and third actions of each partition. The historical revenue of the same action is taken from the action revenue cache of the previous frame that is the same type and action number as the current partition. If there is no corresponding revenue in the action revenue cache of the previous frame, the historical revenue of the same action is written as zero. Then, the historical revenue of the same action is added to the partition sort value of the current partition and then divided by the first duration value, the second duration value, and the third duration value, respectively, to generate the first revenue value, the second revenue value, and the third revenue value. The method for obtaining action revenue here is as follows: add the historical revenue of the corresponding action in the same partition to the partition ranking value, and then divide by the duration value of the corresponding action; after completing the revenue value calculation, first sort the partitions from largest to smallest according to the partition ranking value, and then select the action corresponding to the largest value among the first, second, and third revenue values ​​for each partition as the current action, and simultaneously accumulate the duration value corresponding to the current action; when the accumulated duration value is greater than the available duration of the current frame, replace the current action of the current partition with the action corresponding to the second-ranked revenue value and re-accumulate; when the action corresponding to the second-ranked revenue value still makes the accumulated duration value greater than the available duration of the current frame, replace the current action of the current partition with the action corresponding to the third-ranked revenue value and re-accumulate; after completing the selection of all partitions, write the current action corresponding to each partition into the partition action table to generate a partition action set for step S4-3 to read; In step S4-3, a partition rendering strategy is generated based on the partition action set and the relationship between adjacent partitions. This strategy aims to eliminate conflicts between adjacent partitions in terms of computational precision, shadow sampling method, and culling range, thus preventing action switching breakpoints from occurring at adjacent boundaries in step S5. Specifically, the process involves first checking the four adjacent pixels above, below, left, and right in the pixel partition map pixel by pixel. When the current pixel and its adjacent pixels belong to different partitions, the adjacent partition relationship between the two partitions is recorded. Then, the current actions corresponding to the two partitions with adjacent partition relationships are read one by one, and the computational precision, shadow sampling method, and culling range of the two current actions are compared. If at least one of the three is different, the partition ranking values ​​corresponding to the two adjacent partitions are compared. If the partition ranking value of one partition is greater than that of the other partition, the current action corresponding to the partition that satisfies the greater than relationship is retained, and the current action corresponding to the other partition is replaced with the action ranked last in the profit value. If the current action corresponding to the other partition is already the action ranked last in the profit value, the action is kept unchanged. After completing one replacement, re-examine the relationship between all adjacent partitions until there are no differences in the calculation precision, shadow sampling method, and culling range of all adjacent partitions; finally, write the calculation precision, shadow sampling method, material correction method, and culling range of each partition in the final retention action into the partition rendering strategy according to the partition number, so that step S5 can read it directly; Through the processing of steps S4-1 to S4-3, the computational precision, shadow sampling method, material correction method, and culling range required for step S5 have been written into the partition rendering strategy by partition. The pixel partition map generated in step S3 has also been further transformed from pixel-level classification results into partition-level action constraints. In subsequent rendering, it is not necessary to reselect actions pixel by pixel. In practical applications: when the shadow candidate area is distributed along the edge of the building and the direct light area and the indirect light area appear in the same screen area at the same time, in step S4-1, the number of pixels and the number of boundary pixels in each partition are counted according to the pixel partition map, and the first action, the second action, and the third action and the corresponding duration value are generated. Then, in step S4-2, the current action is selected for each partition by combining the action benefit of the previous frame and the available duration of the current frame. Finally, in step S4-3, the current actions that differ between adjacent partitions are adjusted according to the relationship between adjacent partitions and written into the partition rendering strategy. This allows step S5 to directly execute the corresponding computational precision, shadow sampling method, material correction method, and culling range by partition.

[0022] S5. Based on the pixel partition map and partition rendering strategy, perform diffuse reflection calculation and specular reflection calculation for the direct light area, perform ambient light calculation for the indirect light area, perform adaptive radius PCF filtering and slope bias correction for the shadow candidate area, and perform lightweight GGX micro-surface BRDF correction and hierarchical synthesis output for each partition to generate the pixel color of the current frame and the partition results, shadow results, frame time results and motion gains for the next frame. In this embodiment, step S5 is used to perform corresponding lighting calculations, shadow calculations, and material correction calculations for the direct light area, indirect light area, and shadow candidate area according to the pixel partition map and partition rendering strategy, and write back the current frame rendering result as the partition result, shadow result, frame time result, and action gain to be called in the next frame; the processing order of step S5 is as follows: first, in step S5-1, the diffuse reflection value, specular value, and ambient light value are calculated by partition; then, in step S5-2, the shadow occlusion value is calculated for the shadow candidate area; and finally, in step S5-3, material correction, pixel color synthesis, and result write-back are performed according to the partition rendering strategy; this implementation process includes the following steps: In step S5-1, the diffuse reflection and specular values ​​of pixels in the direct light zone and the ambient light value of pixels in the indirect light zone are calculated according to the pixel partition map and the partition rendering strategy. This is to first complete the basic illumination calculation for different partitions, providing input for material correction and color synthesis in step S5-3. Specifically, in the direct light zone, the albedo, normal, light source direction, viewing direction, and light source color are read according to the pixel position. The viewing direction is obtained by pointing from the current frame camera position to the current pixel position. The half-angle direction is obtained by adding the viewing direction and the light source direction and then normalizing. The specular index is mapped by the material correction method in the partition rendering strategy. Three material corrections correspond to the first specular index, two material corrections correspond to the second specular index, and one material correction corresponds to the third specular index. Then, the albedo is multiplied by the light source color and then multiplied by the normal and the light source color. The diffuse reflection value is generated by multiplying the three corresponding components of the direction and adding them together. Then, the cosine value of the angle obtained by multiplying the three corresponding components of the viewing direction and the half-angle direction is calculated by exponentiation of the specular index and multiplied by the light source color. For the indirect light area, the occlusion amount is read by pixel position, and the albedo of all pixels in the three-row-three-column neighborhood is read and averaged. Then, the ambient light color in the scene ambient light parameters is read, and the ambient light color is multiplied by one and the occlusion amount is subtracted, and then multiplied by the average albedo to generate the ambient light value. When there is a missing position at the boundary in the three-row-three-column neighborhood, the albedo of the center pixel is used to replace the albedo of the missing position and the average value is calculated. After processing in step S5-1, the diffuse reflection value and specular value corresponding to the pixels in the direct light area and the ambient light value corresponding to the pixels in the indirect light area are written into the current frame lighting buffer for reading in step S5-3. In step S5-2, shadow occlusion values ​​are calculated for pixels in the shadow candidate region based on the pixel partitioning map and partitioning rendering strategy. This process converts the local depth and normal direction changes of the shadow candidate region pixels into shadow values ​​directly used in subsequent color compositing. Specifically, for each pixel in the shadow candidate region, the center depth and the depth of its three rows and three columns of neighboring pixels are read. The sum of the absolute values ​​of the differences between the center depth and the depths of the other eight neighboring pixels is calculated to obtain the depth difference sum corresponding to the current pixel. Then, the depth difference sums corresponding to all pixels in the shadow candidate region are sorted from largest to smallest. When the total number of pixels in the shadow candidate region is M, the values ​​at the sorting positions are rounded down to the nearest integer. The first third of the pixels is written as a nine-point sample, the pixels in the sorted position from the first third after rounding down to the first two thirds after rounding down are written as five-point samples, and the remaining sorted positions are written as three-point samples. The sampling radius is determined by the number of sampling points. Nine-point sampling corresponds to the first sampling radius, five-point sampling corresponds to the second sampling radius, and three-point sampling corresponds to the third sampling radius. The first, second, and third sampling radii are given in advance by the partition rendering strategy. Then, the cosine value of the angle obtained by multiplying the current pixel normal and the three corresponding components of the light source direction is read and added. The result of subtracting the cosine value of the angle is multiplied by the sampling radius to generate the slope offset value. Next, based on the number of sampling points corresponding to the current pixel, select the corresponding number of sampling point depths from the three-row, three-column neighborhood. Compare each sampling point depth with the center depth plus the slope offset value point by point. When the sampling point depth is less than the sum of the center depth and the slope offset value, record that the current sampling point satisfies the less than relationship. Finally, divide the number of sampling points that satisfy the less than relationship by the total number of sampling points to generate a shadow occlusion value and write it to the shadow cache according to the pixel position. When the total number of pixels in the shadow candidate area is not divisible by three, the remaining pixels after sorting are assigned to the last third. When the sampling neighborhood crosses the screen boundary, use the center depth to replace the missing depth outside the boundary and continue the comparison. In step S5-3, according to the partitioned rendering strategy, material correction, color synthesis, and result writing are performed on the pixels in the direct light area, the indirect light area, and the shadow candidate area, respectively. The purpose is to convert the illumination and shadow values ​​obtained in steps S5-1 and S5-2 into the pixel colors of the current frame and simultaneously generate the feedback values ​​to be called in the next frame. In specific processing, the metallicity and roughness are read according to the pixel position. The roughness is multiplied by the roughness and written as the distribution value. The cosine value of the angle obtained by multiplying the normal and the three corresponding components of the viewing direction and adding them together is multiplied by the cosine value of the angle obtained by multiplying the normal and the three corresponding components of the light source direction and adding them together is written as the occlusion value. The cosine value of the angle obtained by multiplying the three corresponding components of the viewing direction and the half-angle direction is multiplied by itself five times and then added to the metallicity and written as the reflection value. In the three-material correction process, all distribution, occlusion, and reflection values ​​are involved in color synthesis; in the two-material correction process, both distribution and reflection values ​​are involved; and in the one-material correction process, only reflection values ​​are involved. Color synthesis is then performed according to the corresponding partition relationships: for direct light areas, the distribution, occlusion, and reflection values ​​are multiplied sequentially by the diffuse and specular values ​​and then summed to generate the current frame's pixel color; for indirect light areas, the distribution, occlusion, and reflection values ​​are multiplied sequentially by the ambient light value and then summed to generate the current frame's pixel color; for shadow candidate areas, the distribution, occlusion, and reflection values ​​are multiplied sequentially by the diffuse, specular, and shadow occlusion values ​​and then summed to generate the current frame's pixel color. After color synthesis is completed, the current... The frame pixel color is written to the frame buffer according to the pixel position. The current frame pixel partition is written as the partition result. The shadow occlusion value corresponding to the shadow candidate pixel is written as the shadow result. The current frame end time minus the current frame start time is written as the frame time result. Then, the absolute value of the difference between all pixel colors in the current frame and the pixel color at the same position in the previous frame is accumulated pixel by pixel and divided by the frame time result, and written as the action gain. When the frame time result is zero, the action gain is written as the sum of the absolute values ​​of the difference between all pixel colors in the current frame and the pixel color at the same position in the previous frame. After processing in step S5-3, the current frame pixel color, partition result, shadow result, frame time result and action gain are all written to the corresponding buffers for the next frame steps S2 and S4 to continue reading. Through steps S5-1 to S5-3, the direct light area, indirect light area, and shadow candidate area respectively complete basic lighting calculation, shadow calculation, material correction calculation, and pixel color synthesis. The rendering result of the current frame is also synchronously written back as the partition result, shadow result, frame-time result, and motion gain to be called in the next frame. Subsequent step S2 can continue to use the partition result, shadow result, and frame-time result, and step S4 can continue to use the motion gain. In practical applications: when the character is located at the edge of the building's shadow and the terminal simultaneously executes specular material display, first in step S5- In step S5-1, diffuse reflection and specular values ​​are calculated for the direct light area and ambient light values ​​are calculated for the indirect light area. Then, in step S5-2, nine-point sampling, five-point sampling, or three-point sampling is determined according to the depth difference and sorting position of the shadow candidate pixels, and shadow occlusion values ​​are generated. Finally, in step S5-3, the distribution value, occlusion value, and reflection value participating in color synthesis are determined according to the partition rendering strategy, and the pixel color of the current frame is written to the frame buffer. The pixel partition of the current frame, shadow occlusion value, frame time result, and action gain are written to the corresponding cache, thus completing the rendering of the current frame and providing feedback input for the next frame.

[0023] Furthermore, a pixel-based lighting and shadow rendering device suitable for mobile games includes: The buffer building module is used to obtain scene image data, light source data and terminal running data of the current frame of the mobile game, and write position, normal, depth, albedo, metallicity, roughness and occlusion by pixel to generate a lightweight geometry buffer for the current frame. The prior generation module is used to align the current frame's lightweight geometric buffer with the previous frame's partitioning result, shadow result, and time result by pixel position, and then perform convolution extraction and temporal update operations to generate the lighting prior map, partitioning confidence map, and distortion risk map corresponding to each pixel. The partitioning determination module, based on the prior light map, partitioning confidence map, distortion risk map, and the light source angle, neighborhood depth difference, occlusion amount, and frustum marker corresponding to each pixel, performs frustum culling and pixel classification, dividing the pixels within the frustum into direct light area, indirect light area, and shadow candidate area, and generating a pixel partitioning map. The strategy update module is used to input the pixel partition map, partition confidence map, distortion risk map, terminal running data and the action benefit of the previous frame into the strategy update calculation, and determine the calculation precision, shadow sampling method, material correction method and culling range for each partition according to the updated strategy value, and generate the partition rendering strategy. The rendering output module performs diffuse reflection and specular reflection calculations on the direct light area, ambient light calculations on the indirect light area, adaptive radius PCF filtering and slope offset correction on the shadow candidate area, and lightweight GGX micro-surface BRDF correction and hierarchical compositing output on each partition, generating the pixel color of the current frame as well as the partition results, shadow results, frame time results and motion gains for the next frame.

[0024] Furthermore, an electronic device includes: The processor, and the memory connected to the processor; Memory is used to store computer programs; The processor is used to call and execute computer programs in memory to perform the algorithm.

[0025] Furthermore, a storage medium includes: a computer program stored in the storage medium, which, when executed by a processor, implements the various steps of the algorithm.

[0026] Working principle: This scheme first organizes the primitives, lighting, and terminal state in the current frame scene into a lightweight geometric buffer that is read pixel by pixel. Then, it aligns the current frame pixels with the partitioning results, shadow results, and frame-time results of the previous frame according to screen coordinates. Through neighborhood convolution and inter-frame updates, it obtains the lighting prior map, partition confidence map, and distortion risk map. Subsequently, based on the lighting prior, occlusion relationship, local depth change, and view frustum range, the pixels are divided into direct light area, indirect light area, and shadow candidate area. Then, combined with the number of pixels, boundary distribution, confidence level, risk level, and terminal availability time of each partition, the corresponding calculation precision, shadow sampling method, material correction method, and culling range are assigned to each partition. Finally, diffuse reflection, specular, ambient light, shadow occlusion, and material correction calculations are performed by partition, the current frame pixel color is output, and the partitioning results, shadow results, frame-time results, and action benefits are written back to the next frame for continued use. Therefore, the results of the previous frame will continuously affect the partitioning and strategy selection of the next frame. For example, in multiplayer team battles in mobile games, character movement, skill effects, building occlusion, and camera rotation occur simultaneously, causing the lighting and shadow states of the same area in the image to change continuously. This solution first extracts the position, normal, depth, and material information of each pixel from the current frame, and then combines this with the partitioning and shadow results left from the previous frame to determine which pixels are closer to the direct light area, which pixels are closer to the indirect light area, and which pixels need to be focused on shadow processing. For partitions with significant changes and high risk, the solution allocates higher computational precision and more shadow sampling points. For partitions with weak changes and low risk, the solution reduces computational intensity and expands the culling range. This ensures that the lighting and shadow changes remain consistent when the character is near the edge of the building's shadow, and also concentrates computing resources on more critical areas when the terminal's computing power is limited.

[0027] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A pixel lighting and shadow rendering algorithm suitable for mobile games, characterized in that, include: S1. Obtain scene image data, light source data and terminal running data of the current frame of the mobile game, and write position, normal, depth, albedo, metallicity, roughness and occlusion by pixel to generate a lightweight geometry buffer for the current frame. S2. Align the current frame's lightweight geometric buffer with the previous frame's partitioning result, shadow result, and frame timing result by pixel position, and then perform convolution extraction and temporal update operations to generate the lighting prior map, partitioning confidence map, and distortion risk map corresponding to each pixel. S3. Based on the prior light map, the partition confidence map, the distortion risk map, and the light source angle, neighborhood depth difference, occlusion amount, and frustum marker corresponding to each pixel, perform frustum culling and pixel classification, divide the pixels within the frustum into direct light area, indirect light area, and shadow candidate area, and generate a pixel partition map. S4. Input the pixel partition map, partition confidence map, distortion risk map, terminal operation data and the action benefit of the previous frame into the strategy update calculation, determine the calculation precision, shadow sampling method, material correction method and culling range of each partition according to the updated strategy value, and generate the partition rendering strategy. S5. Based on the pixel partition map and partition rendering strategy, perform diffuse reflection calculation and specular reflection calculation for the direct light area, perform ambient light calculation for the indirect light area, perform adaptive radius PCF filtering and slope bias correction for the shadow candidate area, and perform lightweight GGX micro-surface BRDF correction and hierarchical synthesis output for each partition to generate the pixel color of the current frame and the partition results, shadow results, frame time results and motion gains for the next frame.

2. The pixel lighting and shadow rendering algorithm for mobile games according to claim 1, characterized in that: S1 includes: S1-1. Perform screen projection of the current frame based on scene primitive data, map each scene primitive to the corresponding pixel position, and read the primitive position, primitive normal, material albedo, metallicity and roughness of each mapped pixel to generate a pixel attribute set. S1-2. Based on the pixel attribute set and light source data, perform depth sorting on multiple primitives corresponding to the same pixel position, retain the position, normal, depth, albedo, metallicity and roughness of the first primitive in the sorting, and calculate the occlusion amount according to the occlusion path length and occlusion direction overlap of the remaining primitives at the pixel position to the first primitive, and generate a pixel write set. S1-3. Based on the terminal operation data, perform component compression and sequential encoding on the position, normal, depth, albedo, metallicity, roughness and occlusion amount of the pixel writing set, and write them to the buffer according to the pixel position to generate the current frame lightweight geometry buffer.

3. The pixel lighting and shadow rendering algorithm for mobile games according to claim 2, characterized in that: S2 includes: S2-1. Read the screen coordinates, normals, depth, albedo, metallicity, roughness, and occlusion of each pixel in the current frame's lightweight geometry buffer. Read the previous frame's partition value and shadow value at the same screen coordinates from the previous frame's partitioning and shadow results. If there is no value at the same screen coordinates, read the first value in the adjacent pixels in the order of top, bottom, left, and right as the padding value. At the same time, copy the previous frame's time result to each pixel to generate an aligned pixel set. S2-2. Taking each pixel in the aligned pixel set as the center, read the neighboring pixels within the three rows and three columns of the pixel's neighborhood, and assign convolution weights to each neighboring pixel with the center position as 4, the top, bottom, left, and right positions as 2, and the four corner positions as 1. Specifically, the sum of the products of the normals of each neighboring pixel and the corresponding components of the normal of the center pixel, plus one minus the occlusion amount of the neighboring pixel, is multiplied by the corresponding convolution weight of the neighboring pixel and accumulated to generate the cumulative illumination value of the current frame; the depth of each neighboring pixel is compared with the center image... The absolute values ​​of the differences in pixel depth, the absolute values ​​of the differences between the occlusion amounts of each neighboring pixel and the center pixel, and the absolute values ​​of the differences between the previous frame partition values ​​of each neighboring pixel and the center pixel are added together, multiplied by the convolution weights corresponding to the neighboring pixels, and accumulated to generate the current frame partition cumulative value; the absolute values ​​of the differences between the previous frame shadow values ​​of each neighboring pixel and the center pixel shadow values ​​are added to the previous frame time value, multiplied by the convolution weights corresponding to the neighboring pixels, and accumulated to generate the current frame distortion cumulative value; S2-3. For each pixel, subtract the shadow value of the previous frame corresponding to that pixel from the current frame's cumulative light value to generate a priori light value; sort the current frame's cumulative partition values ​​in the entire frame's pixel range from smallest to largest, and write the reverse order position corresponding to the sorting position as the partition confidence value; multiply the current frame's cumulative distortion value by the frame time value of the previous frame corresponding to that pixel to generate a distortion risk value; and write it into the priori light map, the partition confidence map, and the distortion risk map according to the screen coordinates.

4. The pixel lighting and shadow rendering algorithm for mobile games according to claim 3, characterized in that: S3 includes: S3-1. Read the corresponding prior light value, confidence value and distortion risk value for each pixel in the prior light map, the confidence value of the partition and the distortion risk map. Read the light source angle, neighborhood depth difference, occlusion amount and frustum mark corresponding to the pixel. When the frustum mark is outside the frustum, write the pixel as a culled pixel and generate the pixel set inside the frustum. S3-2. For each pixel in the pixel set within the view frustum, multiply the prior value of the received light by the cosine of the angle corresponding to the angle between the light source and the pixel to generate a direct light determination value; multiply the partition confidence value by the occlusion amount and then subtract the neighborhood depth difference to generate an indirect determination value; multiply the distortion risk value by the neighborhood depth difference and then add the occlusion amount to generate a shadow determination value. S3-3. For each pixel, compare the direct light determination value, indirect light determination value, and shadow determination value. When the shadow determination value is greater than the direct light determination value and greater than the indirect light determination value, write the pixel into the shadow candidate area. When the direct light determination value is greater than the indirect light determination value and greater than the shadow determination value, write the pixel into the direct light area. Write the remaining pixels into the indirect light area and output the pixel partition map according to the pixel position.

5. A pixel lighting and shadow rendering algorithm suitable for mobile games according to claim 4, characterized in that: S4 includes: S4-1. Count the number of pixels and the number of boundary pixels in each partition according to the pixel partition map. Accumulate the partition confidence value of all pixels in each partition according to the partition confidence map and divide it by the number of pixels in that partition to generate the partition confidence value. Accumulate the distortion risk value of all pixels in each partition according to the distortion risk map and divide it by the number of pixels in that partition to generate the partition risk value. Multiply the partition risk value by the number of boundary pixels and divide it by the partition confidence value to generate the partition ranking value. For each partition, a first action, a second action, and a third action are generated sequentially. The first action is full-resolution operation, nine-point shadow sampling, three material corrections, and zero-circle culling. The second action is half-resolution operation, five-point shadow sampling, two material corrections, and one-circle culling. The third action is quarter-resolution operation, one-point shadow sampling, one material correction, and two-circle culling. At the same time, the first duration value, the second duration value, and the third duration value are generated by multiplying the number of pixels in the corresponding partition by the sum of the resolution coefficient, the number of shadow sampling points, and the number of material corrections for the corresponding action.

6. A pixel lighting and shadow rendering algorithm suitable for mobile games according to claim 5, characterized in that: S4 further includes: S4-2. Based on the action gains of the previous frame, read the historical gains of the same action for the first, second, and third actions of each partition, add the historical gains of the same action to the partition sorting value, and then divide them by the first, second, and third duration values ​​respectively to generate the first, second, and third gain values. Sort the partitions in descending order of their partition sorting values, and select the action with the highest gain value for each partition as the current action according to the sorting results. When the accumulated duration value corresponding to the current action is greater than the available duration of the current frame, replace the current action of the partition with the action with the second highest gain value and re-accumulate it to generate the partition action set. S4-3. Based on the partition action set and the relationship between adjacent partitions, read the current actions of adjacent partitions one by one. When there are differences in the calculation precision, shadow sampling method or culling range of adjacent partitions, compare the partition ranking values ​​corresponding to the two adjacent partitions. When the partition ranking value of one partition is greater than the partition ranking value of the other partition, retain the current action corresponding to the partition whose partition ranking value satisfies the greater than relationship, and replace the current action corresponding to the other partition with the action ranked next in the benefit value, until the calculation precision, shadow sampling method and culling range of all adjacent partitions are consistent. Then, write the calculation precision, shadow sampling method, material correction method and culling range of the final retained actions of each partition into the partition rendering strategy.

7. A pixel lighting and shadow rendering algorithm suitable for mobile games according to claim 6, characterized in that: S5 includes: S5-1. Based on the pixel partition map and partition rendering strategy, for pixels in the direct light area, read the albedo, normal, light source direction, viewing direction, and light source color. Multiply the albedo by the light source color and then multiply by the cosine of the angle between the normal and the light source direction to generate the diffuse reflection value. Perform a power operation on the cosine of the angle between the viewing direction and the half-angle direction according to the specular exponent corresponding to the partition rendering strategy and then multiply by the light source color to generate the specular value. For pixels in the indirect light area, read the occlusion amount and the average albedo in the three-row, three-column neighborhood. Multiply the ambient light color by one and subtract the occlusion amount, then multiply by the average albedo to generate the ambient light value. S5-2. Based on the pixel partition map and partition rendering strategy, read the center depth and the three-row, three-column neighborhood depth of the pixels in the shadow candidate area. Calculate the sum of the absolute values ​​of the differences between the center depth and each neighborhood depth. Sort the sum of the absolute values ​​of the differences of all pixels in the shadow candidate area from largest to smallest. Select nine sampling points when the sorting position is in the first third, five sampling points when the sorting position is in the middle third, and three sampling points when the sorting position is in the last third. Multiply the result of subtracting the cosine of the angle between the normal and the light source direction by the sampling radius to generate the slope offset value. Compare the depth of each sampling point with the center depth plus the slope offset value point by point. Divide the number of sampling points that satisfy the less than relationship by the total number of sampling points to generate the shadow occlusion value. S5-3. According to the partitioned rendering strategy, read the metallicity and roughness of pixels in the direct light area, indirect light area, and shadow candidate area respectively. Write the square of the roughness as the distribution value. Write the product of the cosine of the angle between the normal and the viewing direction and the cosine of the angle between the normal and the light source direction as the occlusion value. Add the five-fold product of the metallicity and the cosine of the angle between the viewing direction and the half-angle direction as the reflection value. Then multiply the distribution value, occlusion value, and reflection value with the diffuse value, specular value, ambient light value, and shadow occlusion value according to the partition correspondence to generate the pixel color of the current frame. Write the pixel color of the current frame according to the pixel position to the frame buffer. Write the pixel partition of the current frame as the partition result. Write the shadow occlusion value corresponding to the shadow candidate area pixel as the shadow result. Write the difference between the start time and the end time of the current frame as the frame time result. Write the sum of the absolute values ​​of the differences between all pixel colors of the current frame and the pixel colors of the same position in the previous frame divided by the frame time result as the action gain.

8. A pixel lighting and shadow rendering device suitable for mobile games, used to execute the algorithm according to any one of claims 1-7, characterized in that, include: The buffer building module is used to obtain scene image data, light source data and terminal running data of the current frame of the mobile game, and write position, normal, depth, albedo, metallicity, roughness and occlusion by pixel to generate a lightweight geometry buffer for the current frame. The prior generation module is used to align the current frame's lightweight geometric buffer with the previous frame's partitioning result, shadow result, and time result by pixel position, and then perform convolution extraction and temporal update operations to generate the lighting prior map, partitioning confidence map, and distortion risk map corresponding to each pixel. The partitioning determination module, based on the prior light map, partitioning confidence map, distortion risk map, and the light source angle, neighborhood depth difference, occlusion amount, and frustum marker corresponding to each pixel, performs frustum culling and pixel classification, dividing the pixels within the frustum into direct light area, indirect light area, and shadow candidate area, and generating a pixel partitioning map. The strategy update module is used to input the pixel partition map, partition confidence map, distortion risk map, terminal running data and the action benefit of the previous frame into the strategy update calculation, and determine the calculation precision, shadow sampling method, material correction method and culling range for each partition according to the updated strategy value, and generate the partition rendering strategy. The rendering output module performs diffuse reflection and specular reflection calculations on the direct light area, ambient light calculations on the indirect light area, adaptive radius PCF filtering and slope offset correction on the shadow candidate area, and lightweight GGX micro-surface BRDF correction and hierarchical compositing output on each partition, generating the pixel color of the current frame as well as the partition results, shadow results, frame time results and motion gains for the next frame.

9. An electronic device, characterized in that, include: The processor, and the memory connected to the processor; Memory is used to store computer programs; The processor is used to invoke and execute a computer program in memory to perform the algorithm as described in any one of claims 1-7.

10. A storage medium, characterized in that, include: The storage medium stores a computer program, which, when executed by a processor, implements the steps of the algorithm as described in any one of claims 1-7.