Mobile terminal global illumination real-time rendering method and device and electronic equipment
By setting up 3D bounding boxes and lighting probes on mobile devices, collecting and storing scene information, and calculating and mapping radiosity values, efficient real-time rendering of global illumination is achieved, solving the problem of high computing resource consumption on mobile devices and improving game performance and experience.
Patent Information
- Application Number
- CN202510999891.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-11-14
AI Technical Summary
Mobile devices consume excessive computing resources when performing global illumination rendering, which affects game performance and experience.
By setting a 3D bounding box volume in the scene, a lighting probe is generated to collect scene information and store it in the form of a structure array. The radiometric value of the lighting probe is calculated, mapped to a 3D texture, and combined with direct lighting to generate a rendered image.
Optimized mobile resource usage, reduced baking time and memory consumption, supported real-time updates when the light source changes, and improved game performance and experience.
Smart Images

Figure CN120953469A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image rendering technology, specifically to a real-time global illumination rendering method, apparatus, and electronic device for mobile devices. Background Technology
[0002] Global illumination is based on geometric optics. It solves the problem of how light rays originating from a light source interact with objects through reflection, refraction, and scattering to form the rendered image. It brings amazing effects to the game's graphics, but it also consumes a lot of computing resources, especially for dynamic scenes with a large number of polygons or on mobile devices.
[0003] In global illumination (GPI) technology, the 3D texture storing radiance is called an irradiance volume, a rendering technique used to calculate global illumination. It divides space into many small volumes, with each pixel recording the light received within each volume. Current UE5 technology utilizes statically baked LightMaps and light probes baked in 3D space to store spherical harmonics, attempting to update indirect lighting based on current direct lighting. This severely consumes the computing resources of mobile devices, reducing game performance and impacting the gaming experience. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method, apparatus, and electronic device for real-time global illumination rendering on a mobile device, which can save computing resources of mobile terminals and improve game performance and gaming experience.
[0005] The first aspect of this application provides a real-time global illumination rendering method for mobile devices, including: Set a 3D bounding box volume in the scene and configure the attribute parameters of the volume; Light probes are uniformly generated within the Volume. The color, normal, and position information of the scene are collected through the light probes and stored as a scene information structure array associated with the light probes. At the same time, sky visibility information is collected and stored separately in the light probes. During the rendering phase, the radiance value of the lighting probe is calculated based on the scene information structure array, and stored together with the sky visibility information in the radiance value attribute variable of the lighting probe. The radiometric values of all illumination probes are mapped and stored in a 3D texture based on their positions; In the pixel shader, radiance values are sampled from the 3D texture based on the world coordinates of the pixel as indirect lighting, which is then combined with direct lighting to generate the rendered image.
[0006] A second aspect of this application provides a real-time global illumination rendering device for mobile devices, comprising: The Volume setting module is used to set a 3D bounding box Volume in the scene and configure the attribute parameters of the Volume; The scene information acquisition module is used to uniformly generate illumination probes within the Volume, collect scene color, normal and position information through the illumination probes, and store them as a scene information structure array associated with the illumination probes in the form of a structure array. At the same time, it collects sky visibility information and stores it separately to the illumination probes. The radiance calculation module is used to calculate the radiance value of the lighting probe based on the scene information structure array during the rendering stage, and store it together with the sky visibility information in the radiance value attribute variable of the lighting probe. The mapping module is used to map and store the radiometric values of all lighting probes to a 3D texture based on their positions; The rendering module is used in the pixel shader to sample radiance values from the 3D texture as indirect lighting based on the world coordinates of the pixels, and merge them with direct lighting to generate a rendered image.
[0007] A third aspect of this application provides an electronic device including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device implements the mobile terminal global illumination real-time rendering method as provided in the first aspect of this application.
[0008] A fourth aspect of this application provides a computer program product including a computer program that, when run, causes the method described in the first aspect of this application to be performed.
[0009] The first aspect of this application provides a real-time global illumination rendering method for mobile devices, comprising setting a three-dimensional bounding box (Volume) in a scene and configuring the attribute parameters of the Volume; uniformly generating lighting probes within the Volume, collecting color, normal, and position information of the scene through the lighting probes, and storing them as a scene information structure array associated with the lighting probes in the form of a structure array, while simultaneously collecting sky visibility information and storing it separately in the lighting probes; during the rendering stage, calculating the radiance value of the lighting probes based on the scene information structure array, and storing it together with the sky visibility information in the radiance value attribute variable of the lighting probes; mapping and storing the radiance values of all lighting probes to a three-dimensional texture based on their positions; and in the pixel shader, sampling the radiance value from the three-dimensional texture as indirect lighting based on the world coordinates of the pixel, and merging it with direct lighting to generate a rendered image. By setting up a 3D bounding box volume and generating lighting probes to collect scene information, efficient real-time rendering of global illumination is achieved, optimizing resource consumption on mobile devices. The evenly distributed lighting probes ensure comprehensive spatial coverage, while a structure array stores color, normal, and position information to improve data organization efficiency. Sky visibility information is stored separately to avoid redundancy. During the rendering stage, radiosity values are dynamically calculated and mapped to 3D textures, enabling pixel shaders to quickly sample indirect lighting and combine it with direct lighting to generate images, significantly reducing baking time and memory consumption. It also supports real-time updates when the light source changes. This saves computing resources on mobile devices, improving game performance and the gaming experience.
[0010] It is understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart illustrating a real-time global illumination rendering method for mobile devices provided in an embodiment of this application. Figure 2 This is a schematic diagram of the structure of the mobile terminal global illumination real-time rendering device provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0013] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0014] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0015] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0016] like Figure 1 As shown, the mobile terminal global illumination real-time rendering method provided in this application embodiment includes the following steps S101 to S106: Step S101: Set a 3D bounding box (Volume) in the scene and configure the Volume's attribute parameters.
[0017] In applications, the properties of a Volume include, but are not limited to, its size and whether to collect surrounding local light sources. A 3D bounding box Volume has attributes such as length, width, height, and a world coordinate, and can store references to local lights around it. Setting the length, width, and height of a Volume is to wrap around buildings and other elements in the scene, performing subsequent calculations within the wrapped area. Scenes without this Volume do not undergo global illumination calculations.
[0018] Step S102: Generate illumination probes uniformly within the Volume. Collect scene color, normal, and position information through the illumination probes and store them as a scene information structure array associated with the illumination probes. At the same time, collect sky visibility information and store it separately in the illumination probes.
[0019] Step S103: During the rendering stage, the radiance value of the lighting probe is calculated based on the scene information structure array, and stored together with the sky visibility information in the radiance value attribute variable of the lighting probe.
[0020] Step S104: Storing the radiometric values of all illumination probes into a 3D texture based on their position mapping.
[0021] Step S105: In the pixel shader, the radiance value is sampled from the 3D texture based on the world coordinates of the pixel as indirect lighting, and then merged with direct lighting to generate a rendered image.
[0022] In one embodiment, a lighting probe is uniformly generated within the Volume. The lighting probe collects color, normal, and position information of the scene, and stores this information as a scene information structure array associated with the lighting probe, including: Step S1021: Arrange the light probes evenly at preset intervals within the Volume.
[0023] In the application, illumination probes are generated uniformly in the Volume based on coordinates, for example, at a spacing of 3 meters.
[0024] Step S1022: Use the camera in Unreal Engine at each light probe location to capture scene information images in six directions.
[0025] In the application, the camera in Unreal Engine is used to capture scene information images in six directions from the Probe location, and the camera is used to capture surrounding objects (covering 360 degrees of space).
[0026] Step S1023: Extract color, normal and world coordinate data from the scene information image and store them as a scene information structure array associated with the lighting probe.
[0027] In the application, color (Albedo), normal (Normal), and world coordinates (Position) are read from scene information images captured from six directions and stored in a structure array.
[0028] This application embodiment ensures the uniformity and comprehensiveness of scene information acquisition by deploying lighting probes at preset intervals within the volume and capturing scene images in six directions; it uses an Unreal Engine camera to cover 360 degrees of space to avoid missing viewpoints; it extracts color, normal, and coordinate data from the images and stores them as a structure array, which is associated with the lighting probes, enhancing data correlation and access efficiency, providing high-precision input for subsequent radiosity calculations, and reducing the impact of scene complexity on performance.
[0029] In one embodiment, the collected sky visibility information is stored separately in the illumination probe, including: Step S1024: For the sky visibility of scene information, determine the sky visibility based on the depth value of the scene information image; When the depth value is zero, the sky is defined as visible. When the depth value is greater than zero, the sky visibility is calculated based on the proportion of pixels that can see the sky.
[0030] In the application, the depth information of scene information images taken from 6 directions is used to determine whether the sky can be seen. The depth value of the sky should be 0 if the sky can be seen, and greater than 0 if the sky cannot be seen. The sky visibility is obtained based on the proportion of pixels that can see the sky and is stored.
[0031] This application's embodiments determine sky visibility by using depth values, simplifying the calculation logic; when the depth value is zero, the visible sky is directly determined, and when the depth is greater than zero, calculations are based on pixel ratios, reducing unnecessary complex calculations; this mechanism efficiently distinguishes between occluded and unoccluded areas, improves the accuracy of sky information, avoids additional resource overhead, and enhances the feasibility of real-time rendering on mobile devices.
[0032] In one embodiment, the method of separately storing the collected sky visibility information to the illumination probe further includes: Step S1025: For the sky visibility of non-scene information, the sky visibility is determined using the depth texture of the Unreal Camera.
[0033] In applications, for the visibility of skylight that is not part of the scene information, the depth texture inherent in the Unreal Camera is used, which represents the depth of other objects in the scene to the camera. If it is skylight (light scattered from the sky into the scene), the depth is 1 or 0, depending on whether the current platform uses DirectX or OpenGL as the underlying graphics API.
[0034] This application embodiment utilizes Unreal Engine's depth texture to process sky visibility, which is not scene information, making full use of the engine's native functions; the depth texture directly provides depth data, quickly determining sky visibility without the need to generate additional intermediate data; this method integrates existing rendering pipelines, reduces custom calculations, improves system compatibility and execution efficiency, and ensures the robustness of sky information in different scenes.
[0035] In one embodiment, calculating the radiance value of the illumination probe based on the scene information structure array includes: Step S1031: Calculate the radiometric value of each scene information in the illumination probe based on the scene information structure array; Step S1032: Take the average value of the radiance values of all scene information as the radiance value of the illumination probe.
[0036] This application embodiment calculates the radiometric value for each scene individually and then takes the average value to ensure that the radiometric result is smooth and stable; the average value aggregation reduces the influence of noise and outliers and reflects the overall lighting distribution around the lighting probe; this step optimizes the uniformity of indirect lighting, avoids local over-brightness or under-brightness, improves the realism of the rendered image, and the calculation process is efficient, meeting the real-time requirements of mobile devices.
[0037] In one embodiment, during the rendering phase, the scene information structure array associated with the Probe is read, and a loop is used to calculate the radiosity value of a single scene surface information using the following formula: in, This is the radiometric value. To represent a function that clamps the dot product result to the range [0,1], This represents the vector dot product operation. This refers to the normal information of the current scene. Direction of the light The color information for the current scene. For the color of the light, For light intensity parameters, This is the shadow value, indicating whether the current scene point is in shadow. In one embodiment, the shadow value is determined by a shadow map and / or a directional distance field; When determining based on shadow maps, a depth map is generated by the light source projection. The depth value of the current point in the shadow map is compared with the actual depth value of the scene to determine whether it is in shadow. When determining based on a directed distance field, query the directed distance field value from the current position to the occlusion or light source direction. If the directed distance field value is inconsistent with the straight-line distance from the current point to the light source, it is determined that the location is in shadow.
[0038] In applications, the required shadow comes from two sources: The shadow map is projected by the light source and is a depth map. By comparing the depth of the current point in the shadow map with the depth of the map itself, it can be determined whether the point is in shadow. This map uses UE5's native shadow calculation method, but you can also calculate it yourself. SDF stands for Directed Distance Field. It is a data structure that forms a distance field for all objects in the scene. This data structure is native to UE5. This distance field is used to quickly find the distance from the current position to the direction of the light source. If there is an obstruction in between, the distance is the distance to the obstruction. If the distance is inconsistent with the straight-line distance from the current point to the light source, it means that the object is in shadow.
[0039] In the application, the baked scene information is passed to the GPU for calculation. The previous structure array is encapsulated into a StructuredBuffer and then passed to the GPU. The StructuredBuffer stores a series of information such as color (Albedo) and normal (Normal). This information is the scene information around the Probe. Using the above, the direct illumination radiance received by a surface point can be calculated.
[0040] In the application, for calculating the radiance of all data in the structure array for all surrounding surface information, the radiance is calculated as a cumulative value and then averaged. The specific calculation formula is as follows: ; in, This is a wrapper function for StructuredBuffer. For the first i Scene information, Total number of scene information.
[0041] In the application, after calculating all surface information, the final average radiometric results in six directions are stored in the ProbeGPU memory. The Probe is stored in a Probe structure on the GPU, unlike the previously baked surrounding scene information which is stored in CPU-accessed memory. It stores the accumulated average radiometric values calculated during the rendering process, while the scene information is stored in a structure array directly accessed by the CPU, which is then used directly for subsequent GPU calculations.
[0042] This application's embodiments calculate the radiance value of a single scene using the above formula, and combine dot product, clamping, and lighting parameters to accurately simulate light interaction; the dot product operation captures the angle between the normal and the light direction, the saturate function limits the range to prevent overflow, and Albedo and shadow values integrate material and occlusion effects; ensuring physical accuracy, generating high-fidelity radiance data, providing a reliable basis for global illumination, and reducing the need for manual adjustments.
[0043] In one embodiment, step S104 includes: Step S1041: Use six textures to store the radiometric values of the scene information structure array for each lighting probe in six directions.
[0044] In the application, the average radiance values in six directions are stored into six RGBA8 format 3D maps, forming an Ambient Cube. Each map stores the indirect lighting results in a specific direction. Each map stores radiance data in a specific direction, and the radiance values in the six directions can be combined to form a data set called the Ambient Cube, whose six data points represent the average radiance values in the six directions.
[0045] Step S1042: Use six RGBA8 format 3D textures to form an Ambient Cube, with each texture storing the radiance value in one direction.
[0046] Step S1043: Calculate the sampling coordinates based on the difference between the world coordinates of the lighting probe and the starting coordinates of the 3D texture.
[0047] In applications, the sampling coordinates can be used to directly access 3D textures (i.e., three-dimensional textures). For example, the sampling coordinates (0,0,0) represent the texture of the pixel at the lower left corner of the 3D texture. This allows the world coordinates to be converted to the sampling coordinates, and the radiometric values of the Probe at a certain position in the six directions can be stored in the 3D textures of these six directions respectively.
[0048] Step S1044: Store the radiometric value of each illumination probe to the corresponding sampling coordinate position of the 3D texture.
[0049] In the application, the storage method is to store the world position of the Probe in the 3D texture, which corresponds to the world position of the 3D texture. One pixel in the 3D texture corresponds to 3m units in world coordinates.
[0050] This application embodiment constructs an environment cube using six RGBA8 format textures, stores radiometric values in different directions, and optimizes data organization; after calculating the sampling coordinates, it maps them to a 3D texture, making the discrete probe data continuous; this method supports fast texture sampling, reduces pixel shader lookup overhead, and the environment cube structure efficiently expresses omnidirectional lighting, improving the rendering speed and resource utilization of indirect lighting.
[0051] In one embodiment, the formula for calculating the sampling coordinates is: ; in, These are the 3D texture sampling coordinates corresponding to the current lighting probe. The UV coordinates are 0-1 coordinates used during image sampling. The world coordinates of the current illumination probe. These are the starting coordinates of the 3D texture.
[0052] The embodiments of this application calculate the UV sampling coordinates based on the difference between the light probe position and the texture coordinates. The formula is simple and the calculation is efficient. The coordinates are normalized by division and directly correspond to the texture pixels. This step ensures the accurate mapping from world coordinates to texture space, avoids interpolation errors, enhances the spatial consistency of lighting data, simplifies shader implementation, and improves the performance of the overall rendering pipeline.
[0053] In one embodiment, step S105 includes: The AmbientCube is composed of the final average radiosity values read from 6 3D textures. The reading method is to calculate the final sampled UV value based on the world coordinate position in the pixel shader and the UV calculation method, and then read it from the texture.
[0054] Finally, the calculation of the lighting results sampled from the 3D texture is as follows: ; in, The average radiosity value read from the 3D texture. It is the dot product of the pixel normal value in the pixel shader and the current direction vector.
[0055] The sampled lighting result calculated by the above formula is the cumulative value of the reflected light from the surrounding scene surface at this location, i.e., indirect lighting.
[0056] In applications, direct lighting is the result of direct illumination of the surface by sunlight, point light, etc. in the normal UE rendering process. It represents the light intensity received at the current point, and this value already exists in the UE rendering process.
[0057] In applications, final illumination = direct illumination + indirect illumination.
[0058] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0059] This application also provides a mobile real-time global illumination rendering device for performing the steps described in the above embodiments of the mobile real-time global illumination rendering method. The mobile real-time global illumination rendering device can be a virtual appliance within an electronic device, run by the electronic device's processor, or it can be the electronic device itself.
[0060] like Figure 2 As shown in the embodiment of this application, the mobile terminal global illumination real-time rendering device 100 includes: Volume setting module 101 is used to set a 3D bounding box Volume in the scene and configure the attribute parameters of the Volume; The scene information acquisition module 102 is used to uniformly generate light probes within the Volume, collect the scene's color, normal, and position information through the light probes, and store them as a scene information structure array associated with the light probes in the form of a structure array. At the same time, it collects sky visibility information and stores it separately to the light probes. The radiance calculation module 103 is used to calculate the radiance value of the lighting probe based on the scene information structure array during the rendering stage, and store it together with the sky visibility information in the radiance value attribute variable of the lighting probe. The mapping module 104 is used to map and store the radiometric values of all illumination probes to a 3D texture based on their positions. The rendering module 105 is used in the pixel shader to sample radiance values from the 3D texture as indirect lighting based on the world coordinates of the pixel, and merge them with direct lighting to generate a rendered image.
[0061] In applications, the modules in a mobile global illumination real-time rendering device can be software program modules, or they can be implemented through different logic circuits integrated in a processor, or they can be implemented through multiple distributed processors.
[0062] like Figure 3 As shown, this application embodiment also provides an electronic device 200, including: at least one processor 201 ( Figure 3 The diagram shows only one processor, memory 202, and computer program 203 stored in memory 202 and executable on at least one processor 201. When processor 201 executes computer program 203, it implements the steps in the various method embodiments described above.
[0063] In applications, electronic devices may include, but are not limited to, processors and memory. Those skilled in the art will understand that... Figure 3 This is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than shown, or a combination of certain components, or different components.
[0064] In applications, the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0065] In applications, memory can be an internal storage unit of an electronic device in some embodiments, such as a hard drive or RAM. In other embodiments, memory can be an external storage device of the electronic device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal and external storage units of the electronic device. Memory is used to store operating systems, applications, bootloaders, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.
[0066] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0067] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0068] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps described in the various method embodiments above.
[0069] This application provides a computer program product, including a computer program, which, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.
[0070] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0071] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0072] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0073] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0074] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0075] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A real-time global illumination rendering method for mobile devices, characterized in that, include: Set a 3D bounding box volume in the scene and configure the attribute parameters of the volume; Light probes are uniformly generated within the Volume. The color, normal, and position information of the scene are collected through the light probes and stored as a scene information structure array associated with the light probes. At the same time, sky visibility information is collected and stored separately in the light probes. During the rendering phase, the radiance value of the lighting probe is calculated based on the scene information structure array, and stored together with the sky visibility information in the radiance value attribute variable of the lighting probe. The radiometric values of all illumination probes are mapped and stored in a 3D texture based on their positions; In the pixel shader, radiance values are sampled from the 3D texture based on the world coordinates of the pixel as indirect lighting, which is then combined with direct lighting to generate the rendered image.
2. The mobile terminal global illumination real-time rendering method as described in claim 1, characterized in that, Light probes are uniformly generated within the Volume. These probes collect scene color, normal, and position information, which is then stored as a scene information structure array associated with the light probes, including: Illumination probes are evenly distributed at preset intervals within the Volume; At each light probe location, use a camera in Unreal Engine to capture scene information images in six directions; Color, normal, and world coordinate data are extracted from the scene information image and stored as a scene information structure array associated with the lighting probe.
3. The mobile terminal global illumination real-time rendering method as described in claim 1, characterized in that, The collection of sky visibility information is stored separately in the light probe, including: For the sky visibility of scene information, the sky visibility is determined based on the depth value of the scene information image; wherein when the depth value is zero, it is determined that the sky is visible, and when the depth value is greater than zero, the sky visibility is calculated based on the proportion of pixels that can see the sky. For sky visibility that is not part of the scene information, the depth texture of the Unreal Camera is used to determine the sky visibility.
4. The mobile terminal global illumination real-time rendering method as described in claim 1, characterized in that, The radiance value of the illumination probe is calculated based on the scene information structure array, including: Calculate the radiometric value of each scene information in the illumination probe based on the scene information structure array; The radiance values of all scene information are averaged to obtain the radiance value of the illumination probe.
5. The mobile terminal global illumination real-time rendering method as described in claim 4, characterized in that, The formula for calculating the radiometric value of each scene information is as follows: in, This is the radiometric value. To represent a function that clamps the dot product result to the range [0,1], This represents the vector dot product operation. This refers to the normal information of the current scene. For the direction of the light, The color information for the current scene. For the color of the light, For light intensity parameters, This is the shaded value.
6. The mobile terminal global illumination real-time rendering method as described in claim 5, characterized in that, The shadow value is determined by a shadow map and / or a directional distance field; When the determination is based on the shadow map, a depth map is generated by the light source projection, and it is determined whether the current point is in the shadow by comparing the depth value of the current point in the shadow map with the actual depth value of the scene; When making a determination based on the directional distance field, the directional distance field value from the current position to the occlusion or the light source is queried. If the directional distance field value is inconsistent with the straight-line distance from the current point to the light source, it is determined that the location is in shadow.
7. The mobile terminal global illumination real-time rendering method as described in claim 1, characterized in that, The process of storing the radiometric values of all illumination probes into a 3D texture based on their position mapping includes: Six textures are used to store the radiometric values of the scene information structure array for each lighting probe in six directions; An Ambient Cube is composed of six RGBA8 format 3D textures, with each texture storing a radiance value in one direction. The sampling coordinates are calculated based on the difference between the world coordinates of the lighting probe and the starting coordinates of the 3D texture. The radiometric value of each illumination probe is stored in the corresponding sampling coordinate position of the three-dimensional texture.
8. The mobile terminal global illumination real-time rendering method as described in claim 7, characterized in that, ; The indirect lighting is calculated using the following formula: ; in, The average radiosity value read from the 3D texture. It is the dot product of the pixel normal value in the pixel shader and the current direction vector.
9. A mobile terminal global illumination real-time rendering device, characterized in that, include: The Volume setting module is used to set a 3D bounding box Volume in the scene and configure the attribute parameters of the Volume; The scene information acquisition module is used to uniformly generate illumination probes within the Volume, collect scene color, normal and position information through the illumination probes, and store them as a scene information structure array associated with the illumination probes in the form of a structure array. At the same time, it collects sky visibility information and stores it separately to the illumination probes. The radiance calculation module is used to calculate the radiance value of the lighting probe based on the scene information structure array during the rendering stage, and store it together with the sky visibility information in the radiance value attribute variable of the lighting probe. The mapping module is used to map and store the radiometric values of all lighting probes to a 3D texture based on their positions; The rendering module is used in the pixel shader to sample radiance values from the 3D texture as indirect lighting based on the world coordinates of the pixels, and merge them with direct lighting to generate a rendered image.
10. An electronic device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, the electronic device performs the method as described in any one of claims 1-8.